I recently wanted to move a system over to a faster, larger SSD. I didn’t want to have to re-install an OS, figure out which old files to transfer over, and then re-configure everything. That’s not a fun time in my book.
Here’s what I did (on a live system, yeah!) to clone my disk. Note that this may cause data loss, don’t blame me, keep backups, blah blah…
First, use a partition tool like
GNU parted to create a nice big partition on the new drive and mark it as bootable. Leave some space for other partitions or swap space. If you use a separate /boot partition, then I think that needs the bootable flag instead. I’m only using a single root partition and swap. For the purposes of this tutorial, I’ll call my new root partition /dev/sdb1. YMMV.
sudo su -
mount /dev/sdb1 d
rsync -avhPWHAXx / d/
Wait a while.
Take note of the UUID listed for /dev/sdb.
Or use whatever editor you like and put the UUID for /dev/sdb in place of the existing UUID for /.
mount --bind /dev d/dev
mount --bind /sys d/sys
mount --bind /proc d/proc
Now you should just need to swap out the drives.