How to copy a bootable NTFS partition from one physical hard drive to another with Ubuntu?
(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.
Related videos on Youtube
Nathan Osman
Email: [email protected] I am both an Ubuntu user and Ubuntu member. By profession, I am a software developer and I work with C++, Python, and (more recently) Go. I enjoy tinkering with different things like motion tracking in Blender, creating an Android app for time-lapse photography, or writing Linux kernel modules. - 2buntu - community blog that I sometimes contribute to - NitroShare - a cross-platform network file transfer utility - REST Easy - Firefox add-on for analyzing HTTP responses
Updated on September 18, 2022Comments
-
Nathan Osman over 1 year
I have a USB flash drive with Ubuntu 11.10 installed that I would like to use for the following task:
I have a hard drive with 4 partitions. The second one is formatted with NTFS and contains a fully functional Windows installation. I would like to copy that second partition to another physical hard drive (which is empty).
There's a catch however - I cannot have both hard drives physically connected to the computer at the same time. I have a third external hard drive however that will remain connected throughout the entire operation and has more than double the space of both of the other hard drives.
I realize there are a lot of things to consider here:
The process will obviously involve making some sort of "image" of the second partition, storing it on the external drive, and then copying the image to the new drive.
The partition that I am copying is bootable and should also be bootable when copied to the new drive. I can probably fix the MBR on the partition afterward if need be.
The old and new drives are not identical in make, model, or size. However, there is ample room for the second partition on the new drive.
Any advice on how to proceed or warnings for possible pitfalls would be greatly appreciated. Also, if I missed an important detail, please don't hesitate to ask for it.
-
Nathan Osman about 12 yearsBut how do I use Clonezilla to accomplish the above goals? Also, Clonezilla doesn't appear to be included in the archive, so installation instructions would be helpful too :)
-
Nathan Osman about 12 yearsYeah, I can always revert to the original drive if something goes wrong.
-
Bruno Pereira about 12 yearsThat also, I'm just a freak when handling data. Ignore anything that you do find absolutely necessary ;)
-
Tobias J almost 7 yearsIf you're using a recent version of
dd
, be sure to includestatus=progress
... the disk copy will take a long time! -
Zauber Paracelsus over 6 yearsThis method won't work if you don't have any unused space or external storage big enough for the disk image.
-
Martin Modrák almost 6 yearsThe example might be a bit misleading, I think you want to use
/dev/sda
(without any numbers) to copy the whole disk (at least that is what worked for me, while copying only a single partition didn't work).