9

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.

1
  • Added some sort of guide bellow, let me know if I read your requests wrong ;) gl Apr 7, 2012 at 19:57

2 Answers 2

10

(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

  1. 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.

  2. Mount the external device you will save the .img file to, do not mount the disk you want to make the image from!

  3. 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.

  4. 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.

  5. 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!

  6. 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.

  7. Run gparted and resize your newly created partitions to accommodate the extra space in your new disk.

  8. 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.

5
  • Yeah, I can always revert to the original drive if something goes wrong. Apr 7, 2012 at 20:46
  • That also, I'm just a freak when handling data. Ignore anything that you do find absolutely necessary ;) Apr 7, 2012 at 20:51
  • 1
    If you're using a recent version of dd, be sure to include status=progress... the disk copy will take a long time!
    – Tobias J
    Jun 23, 2017 at 21:22
  • This method won't work if you don't have any unused space or external storage big enough for the disk image. Jan 13, 2018 at 15:07
  • 1
    The 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). Jul 9, 2018 at 19:10
-1

Clonezilla - clonezilla.org

A free software disaster recovery, disk cloning and deployment solution. Allows a user to clone an individual machine or many computers ...

1
  • 2
    But 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 :) Apr 7, 2012 at 19:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .