Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My laptop hard drive was faulty so I requested and just received a new one. Now, I need to migrate my data over. This task seems easier said than done. The two drives are the same size, so I figure dd should work but I haven't seen explicit instructions on what exactly to do, and I'm scared for my data experimenting.

My setup is that these drives are 500gb and internal so I can only have one connected at a time. About 250gb on the hard drive is used. I have two partitions on the drive: a boot partition (50 megs), and a logical partition containing root (20gb), swap (8gb), home (435 gb). and reinstalling the operating system (gentoo) is not an option due to the fact that my bandwidth is severely limited right now. The only vehicle I have is an external USB hard drive with about 400gb capacity. I'm currently booted off of an ubuntu livecd in order to do the transfer.

  • Should I use dd to just copy the input drive into a file on the external HD? Or will this also try to allocate all the free space and thus not fit?
  • Will zipping everything a la dd if=/dev/sda bs=100M | gzip -c > /media/ext/image.img fix that issue?
  • Should I use dd to copy the /boot and / partition to a file on the external HD, and just copy my /home directory as files?
  • Will either of these options leave me in trouble with booting and/or grub or something on the new drive?

Thanks!
Mala

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Yeah I'd take the dd approach. Back up your data first onto that external of yours.

  • Should I use dd to just copy the input drive into a file on the external HD? Or will this also try to allocate all the free space and thus not fit?

No. You can backup your drive as a regular imaged file, or even pipe to dd to gzip and back it up as a regular file. This way you save space:

dd bs=1024 if=/dev/sda conv=noerror,sync | gzip -9 > /mnt/usb/backup.dmg.gz

of course, replacing the drives appropriately.

  • Should I use dd to copy the / partition to a file on the external HD, and just copy my /home directory as files?

It depends. If you have a lot of custom configurations you don't want to lose, I'd just back up the whole thing. If not then your method would suffice.

  • Will either of these options leave me in trouble with booting and/or grub or something on the new drive?

If the drives are identical, and you use dd correctly, and plug the new drive in just like the other, you should be golden.

share|improve this answer
    
sigh I can't both back up the data and do the migration for lack of space :-\. So I'll have to wing it and hope for the best. Thanks for the command, I'm trying it now –  Mala Dec 23 '09 at 21:36
    
so just so I got everything right, once that command's done, I take out the old HD, put in the new one, and what command do I run to restore everything? –  Mala Dec 23 '09 at 21:38
    
Hopyfully with gzip it will compress it a fair bit so you can fit both. Let me know how it goes! –  John T Dec 23 '09 at 21:38
    
While on a LiveCD, you can use gzip -dc /mnt/usb/backup.dmg.gz | dd of=/dev/hd#. Ensure both drives are mounted to those locations, replace # with the drive letter of the empty drive you're restoring to (eg, hda,hdb). –  John T Dec 23 '09 at 21:41
    
Yes. It will continue on read errors. If you'd like a much stricter dd, check out DDRescue ( forensicswiki.org/wiki/Ddrescue ). It will retry on error. It is available in Ubuntu and on bootable CD ( sysresccd.org/Main_Page ). –  John T Dec 23 '09 at 22:11

use Clonezilla to backup the 500 GB drive to the external HDD (if only 250 GB are used, then it's no problem to fit the image onto the 400 GB drive).

fit the replacement drive into the laptop and use Clonezilla again to restore the image to the new drive.

share|improve this answer
    
The page says, under Limitations, "* The destination partition must be equal or larger than the source one." I think this means it would not work for me? –  Mala Dec 23 '09 at 22:03
    
no, this only refers to cloning, but not imaging. you can choose from the following compression options: Gzip, Bzip2, LZO. and when you restore the image, it will be a disk of the same size (equal), right? –  Molly7244 Dec 23 '09 at 22:18
    
yes, they're both 500gb drives from the same manufacturer. Do you know if Clonezilla can split its image file into pieces so that they'll fit on a FAT32 partition? –  Mala Dec 23 '09 at 22:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.