can you clone a par...
 
Notifications
Clear all

can you clone a partition

5 Posts
4 Users
0 Likes
553 Views
(@weresmytriple)
Posts: 8
Active Member
Topic starter
 

hi all

I know its possible to image a partition but is it possible to clone just a single partition of a drive?

thanks

Michael

 
Posted : 13/02/2017 9:30 pm
JaredDM
(@jareddm)
Posts: 118
Estimable Member
 

Yes, it is certainly possible to do. For example if you're using ddrescue to clone a drive you'd use a command like

ddrescue /dev/sda /dev/sdb log.log

To clone a partition to another pre-created partition you'd use

ddrescue /dev/sda1 /dev/sdb1 log.log

Of course this would completely overwrite anything you have on that partition including the file tables, etc.

Or you can just clone a partition to an image file too. Data is data, it's just moving contents of sectors to other sectors.

 
Posted : 13/02/2017 10:46 pm
(@weresmytriple)
Posts: 8
Active Member
Topic starter
 

but to my understanding a clone would result in another drive being an exact copy of the first drive (bit for bit copy) so you would end up with the final media as a drive not a file

where when imaging a partition you would end up with a file as the final media

 
Posted : 14/02/2017 11:18 am
minime2k9
(@minime2k9)
Posts: 481
Honorable Member
 

but to my understanding a clone would result in another drive being an exact copy of the first drive (bit for bit copy) so you would end up with the final media as a drive not a file

Not if you set the output of the command shown above to a file

ddrescue /dev/sda1 /home/user/imagefile.dd log.log

Obviously you would need to make sure you had enough space on the internal disk or mount an external disk and image to that.

Other tools such as X-Ways provide a method of imaging a partition to EWF format. Simply open the disk in X-ways and then select the partition you want and click "Create Disk Image" from the file menu.

 
Posted : 14/02/2017 12:06 pm
jaclaz
(@jaclaz)
Posts: 5133
Illustrious Member
 

Maybe there is still some confusion is which is which, i.e. some mixing up of terminology (as it often happens=).

A clone of a disk (disk drive, the whole thing) doesn't really exist.

What you have is a copy of an extent (a given number of contiguous sectors, starting from the very first sector and up to the very last sector of the original) which is saved as an extent (the same sectors) starting from the very first sector of the target or "clone" device.

An image of a disk (disk drive, the whole thing) is a copy of an extent (a given number of contiguous sectors, starting from the very first sector and up to the very last sector of the original) which is instead saved as an extent (the same sectors) into a file indexed in the filesystem in partition of a target device.

A difference may be that the "clone" by definition is a contiguous extent, whilst an image file (which is all the same representing a contiguous extent) may be fragmented (i.e. non contiguous) in the filesystem on which it is hosted.

Both are sector-by-sector copies, they are identical between them (think of a binary compare), only they are saved differently.

A partition is a subset of the above and while still a contiguous extent on the original, it doesn't start on the very first sector of the original device (nor usually ends on the very last one).

When you copy it to an image it is (partially) self-standing, the only thing that is not "right" is the "Sectors Before" or "Hidden sectors" in the BPB, i.e. the offset at which the partition starts in the original, which is only needed for booting from it), and since the image is indexed in the filesystem, you can access it easily.

If you "clone" a partition by making a copy of it and saving it at the same offset of the original on the "target" device you do have something that you can call a "partition clone" but you cannot normally access it because that extent is nowhere indexed/mapped, you need to add a partition entry on the target MBR (or GPT table) with the addresses of the extent.

jaclaz

 
Posted : 14/02/2017 1:16 pm
Share: