Copy all files from my old hard drive to my new one
Solution 1
I would not recommend dd
for this task. It will copy sector by sector, raw disk data; so it will work only if the partitions are exactly the same size and layout (leading to corruption otherwise). And then you have again another almost-full partion, that you have to extend... messy. And if the source filesystem is almost full, it's probably quite fragmented, and using dd
will copy the fragmentation over.
rsync
is a good option, but in this case, giving that you are copying locally to a blank, new disk, I think that the good old cp
will do(1). Use it as(2)(3)
cd sourcedir; cp -av . /destdir
...and be patient. This will rewrite all files, and in the process, the fragmentation of the new filesystem will be better than the original one.
On the speed point of view, this should fill the I/O buffers and then the copy will proceed at the maximum data transfer that the disks (and the bus) allow. If the system is otherwise idle, I do not think that there will be huge difference in speed between any method.
Notes:
(1) caveat: if you have a LOT of small files, cp
can be slow. There is an old tar
trick for this case... but it's a bit dangerous, so ask if you need it.
(2) v
here means verbose, it will print each file it's copying. It will slow down a bit (or a lot if you have a lot of small files) the copy. YMMV.
(3) if there are files of different users, you will need to say sudo cp...
to maintain correct ownerships and modes.
Solution 2
you can either use some tools like clonezilla , redo backup
or you can use command line tools such the command dd
dd if=/dev/sdXX of=/dev/sdXX bs=4096
check this for how to dd
or the command rsync
rsync -av /mount-point-of-first-drive /mount-point-of-second-drive
based on @Rman, for your case it's better to use rsync. Else if you want to use dd
you shoulf specify the hdd size to copy and then you have to correct the partition size using gparted
.
Related videos on Youtube
Frank
Updated on September 18, 2022Comments
-
Frank over 1 year
I'm changing my old hard drive (500GB full) with a new one (1TB). I use it to backup all my files, so I just need the best way to copy all files from old one to new one, but I don't want to use the normal file manager to transfer files because I think the process will take a very long time (I have to transfer 500GB of files), so is there a better way to do that?
For instance, do programs like
clonezilla
help me in this situation?-
Rinzwind about 9 yearsIt will take a long time with any tool you use ;-) Is it a desktop? If so ...
dd
might be the quickest. -
Frank about 9 yearsyes it is a desktop. I would use the simple file manager to transfer. How can I use
dd
? -
Rinzwind about 9 yearsGeneral idea: create a 500Gb partition on the 1Tb. Hang the 500Gb into your system together with the 1Tb and use
dd
to copy it over (it probably is what clonezilla will do so the answer probably is yes to your question ;-) )
-
-
Rmano about 9 years
dd
will not work if the partitions are of different sizes. It will mess up the disk.rsync
, on the other hand, is usually the fastest and safest option. Rewriting the files will also re-allocate the space, avoiding to copy the fragmentation (whichdd
will happily copy too...) -
hanetzer about 4 yearsTheoretically one could dd if the source is smaller than the destination. Just need to fire up gdisk/fdisk, delete the partition, create a new partition with the same start sector and end at the end of the disk, fsck it, and resize2fs it to fill out the rest of the space.