Ubuntu – Can I make image of ‘extended’ partition using dd

dddisk-image

I have extended partition that contains three another partition. All I want to do is make copied image of that 'extended' partition. I followed steps shown in here, and ran this

sudo dd if=/dev/sdc3 conv=sync,noerror bs=64K | gzip -c > TOSHIBA_ExtPart.img.gz

then I got the error : No such device or address.

*I want to make perfect copy of partition, because there are deleted files I want to recover in the future in partition so imaged file should contain them.

Is there any mistake I made?
Or is there any better method to do it?

(OS : Ubuntu 16.04 LTS)

Best Answer

I agree with @ravery, that you should check that you are really trying to read from the correct device.

But there is another problem too. I tested your command in a test environment, and dd read only one kibibyte (1024 bytes) when I wanted it to make an image of an extended partition.

An obvious work-around is to make an image of the whole drive /dev/sdX, where X is the drive letter (for example a or b or c). But it means more work.

Another alternative is to look for the start and the size of the extended partition with the help of parted.

sudo parted /dev/sdX u MiB print

u MiB means that the unit is mibibytes. Use that block size also in dd and then use seek and count in dd to select the correct data to copy into the image.

seek= and count= are used like bs=. It is described in man dd. You can use bs=1M and then use the output from the parted command line for the values for seek and count.

sudo dd if=/dev/sdX bs=1M seek=Start count=Size | gzip -c > TOSHIBA_ExtPart.img.gz
Related Question