Data is copied from secondary storage (HDD, SSD) to RAM as and when it is needed. This is because using a HDD as the primary memory would cause a computer to perform much slower (a HDD or SSD is not directly accessible to the CPU, and isn’t as fast as RAM).