Thursday, May 2, 2024
10
rated 0 times [  10] [ 0]  / answers: 1 / hits: 15936  / 2 Years ago, sun, january 2, 2022, 1:52:49

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.


More From » partitioning

 Answers
0

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


[#39430] Sunday, January 2, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kneducator

Total Points: 226
Total Questions: 111
Total Answers: 108

Location: Mexico
Member since Sun, Jul 25, 2021
3 Years ago
kneducator questions
Tue, Dec 6, 22, 09:22, 1 Year ago
Sun, Apr 30, 23, 23:26, 1 Year ago
Tue, Jun 8, 21, 01:25, 3 Years ago
Sun, Mar 12, 23, 10:51, 1 Year ago
;