How to copy a bootable NTFS partition from one physical hard drive to another with Ubuntu?
Solution 1:
(No extra software required, use the tools you have)
dd if=/dev/sda2 of=foo_file.img
will create an exact replica of sda to a .img file that you specify.
Save it to an external device and restore it with dd if=foo_file.img of=/dev/sday
.
Step by step
-
Boot from the Ubuntu LiveCD and open the disk management tool (or use
sudo fdisk -l
from the terminal) to find out which disk you will be copying. -
Mount the external device you will save the .img file to, do not mount the disk you want to make the image from!
-
Use
dd if=/dev/sda2 of=foo_file.img
, replace /dev/sda2 with the actual partition you want to copy and foo_image.img with a file located on the external disk you previously mounted. -
Reboot your PC removing the disk you made the image from and install the new disk in your PC. Boot the computer with the Ubuntu LiveCD.
-
Mount the external disk that contains the .img file and open the disk tool to make sure about the device where we are going to write it to. (Probably will be using the same device path as the one you just removed). Don't even try to mount the new disk, there should be nothing to mount anyways!
-
Use
dd if=foo_file.img of=/dev/sdax
to write the image you created and stored on to the external device to the new disk you just installed. Change sdax for the correct partition. -
Run
gparted
and resize your newly created partitions to accommodate the extra space in your new disk. -
Reboot and boot using your new disk.
After this is done you can keep the .img file as a backup till you make sure that everything is running.
I have used this method oh so many times now and not an issue, but you never know. Keep a backup around for some time.