Clone Linux Hard Drive

5:39 am Uncategorized

So the other day I wanted to swap out the hard drives in my laptop. I had a sata hard drive that had slightly better performance and I wanted to trade to use the slower hard drive in another project. I figured it would be an easy fix since I pretty much have a good understanding of Linux now. However, I was wrong. My first attempt was booting a live cd, using gparted to create my partitions, then using rsync to clone the hard drive. I attempted 3 times and each time it rebooted I got an error about X being in safemode. All my files were there, I had fixed the boot sector but it still failed. I ended up using DD to copy the partitions and fschk to fix the filesystem size on the new partition. I’ll have to wait until my next need to try out these commands but I wanted to document them.

From a live CD and after clicking on each partition in nautilus to mount them: (found these switches online, untested)


To reinstall grub:

install-grub --boot-directory /media/BLKIDOFNEWHDD /dev/sdx

You need to update the /etc/fstab on your new hard drive. You will need to know the BLKID of your newly created partitions. At the command prompt you need to run:

sudo gedit /media/BLKIDOFNEWHDD/etc/fstab

That should be it. The new hard drive should boot. If nothing else at least some of my commands are documented here for myself and I can test out that rsync command later.

Leave a Comment

Your comment

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.