2

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)

1 Answers1

1

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
sudodus
  • 46,324
  • 5
  • 88
  • 152
  • Sorry for bothering, but I'm quite new to Ubuntu and can't understand the last sentence. Can you tell me how to do it more specifically, especially with dd? – YM.Ubuntu.16.04.LTS Oct 04 '17 at 08:18
  • seek= and count= are used like bs=. It is described in man dd. What I mean is that you can use bs=1M and then use the output from the parted command line for the values for seek and count. If you feel uneasy with it, please make an image of the whole drive. It is straightforward, and you have better chances to succeed. – sudodus Oct 04 '17 at 08:23
  • Main reason I want to copy extended partition is that I don't have much space for external HDD. I just copied partition separately. Anyway, thanks for the answer, it really helps understanding about dd. – YM.Ubuntu.16.04.LTS Oct 04 '17 at 08:44
  • I see why you want to copy only the extended partition. I think you will succeed with seek and count. You can check that dd writes the correct number of blocks. If you want to be sure, you should extract the image from the compressed file and check if it can be used. Good luck :-) – sudodus Oct 04 '17 at 08:51
  • 1
    Do you mean that you copied the logical partition(s) in the extended partition? If {this partition/these partitions} fill the extended partition (and there is no unallocated space), you will copy all drive space wheree there are deleted files you want to recover. So it will work too. - But if there is unallocated drive space in the extended partition, you need the method with seek and count. – sudodus Oct 04 '17 at 09:02