[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-ddrescue] How to restore just a single partition of a multi-par

From: Shahrukh Merchant
Subject: Re: [Bug-ddrescue] How to restore just a single partition of a multi-partition image file?
Date: Thu, 24 Jan 2019 18:55:20 -0300
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

Thanks to all who responded: Robert Trevellyan, Robert Backhaus, Timothy Beryl Grahek, Joe Kickman (forwarded by Antonio Diaz Diaz with minor correction by Scott Dwyer)! Hope I didn't leave anyone out.

Sorry for the delay in my acknowledgement, but my computer (and hence email) was out for about 2 days while I was doing and then cleaning up the restore (successfully!) so I was in "mode=RO" with email on my phone. :-)

The solutions fell into one of two categories:
(1) Use Unix utilities to determine the starting position and size of the partition you want to copy and use one of ddrescue's methods for limiting the copy domain to the desired portion. (2) Attach the image file as a device node (loop device) and then it looks like an actual device to the OS and hence to ddrescue, and you can then recover the partition in question by specifying it directly as the input parameter to ddrescue.

I will post a summary of the responses (including a hitch I ran into and resolved), but I had a question on Timothy's response (quoted below), where he has a step by step description of Method (2).

My question to Timothy: Why are the mkntfs and ntfsfix commands needed or included in your flow? The partition I'm moving happens to be NTFS, but it seems the tools in question are all working at the partition level and should not care about the filesystem contained within it, n'est-ce pas?


On 2019-01-22 12:02 PM, Timothy Beryl Grahek wrote:
Hi Shahrukh,

Allow me to please ask for some clarification.

Fulldrive.img contains the C partition that you want?

If that is the case, what I would personally do is use a boot disk (e.g.
Arch; Ubuntu) and follow this procedure:

1. lsblk to find out what your 2 TB drive is.
2. Check to see if ddrescue is installed; if not, install it.
3. losetup -Pf fulldrive.img
4. Check the sizes of loop0 and sda using parted with the print command,
then use resizepart 1 <insert size> for sda to match the size of the C
partition on fulldrive.img which is represented by loop0. Please note that
the units must match and the resize amount is the size of the partition
plus the starting position it is at on the disk.
4. mkntfs -f /dev/sda1
5. Since sda1 is now the same size as the C partition on fulldrive.img,
loop0p1 (assuming this is the C partition of fulldrive.img) should be able
to be simply copied to sda1 using ddrescue now with this:
ddrescue -f /dev/loop0p1 /dev/sda1 map1
6. ntfsfix /dev/sda1 after copy operation is done.
7. losetup -D to remove fulldrive.img loop device.

Please let me know what you think and please let me know if you have any
questions or need clarification.

Best regards,

Timothy Beryl Grahek
Bug-ddrescue mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]