The question is quite simple. I have search for an answer for a while but not sure I got the correct answer. Since mistakes could easily destroy my drive and data, I really want things to be clear.
I am running Ubuntu on a 250GB ssd (/dev/sda) which has two partitions, each is about 125GB big. The sda1 is mounted to /
and sda2 is mounted to /home
. Now I want to move everything into a new 1TB ssd (let's say it is /dev/sdc) and expand each drive into 500GB. After some research, I proposed two approaches:
1)do dd if=/dev/sda of=/dev/sdc
to clone the whole disk. After this I should get a bootable disk with two 125 GB partions and some unallocated space. Right? Then I need resize the sdc1 and sdc1 into 500GB with something like gparted. The resizing might take long, right?
2) The second approach is format the new drive first, make two 500GB partitions. do dd if=/dev/sda1 of=/dev/sdc1
and dd if=/dev/sda2 of=/dev/sdc2
to clone both partitions. At this point, this disk should be unbootable, right? In order to make it bootable, I need copy the bootloader into the new one. All I need is the first 446 bytes. So I can
dd if=/dev/sda of=/tmp/mbrsda.bak bs=512 count=1
then dd if=/tmp/mbrsda.bak of=/dev/sdc bs=446 count=1
. By doing this I made it bootable and also preserved the partition table for 500GB+500GB. This approach will save me from resizing the disk.
And for both approaches, I need change the UUID in the /etc/fstab file. This can be done by first mount the new drive after cloning: sudo mount /dev/sdc1 /mnt/
, then edit the /mnt/etc/fstab
file.
Am I right about all of this? Any potential risk of messing up my old drive here? Thanks a lot!