Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to create a dd image which contains two partition. The first is a ext3,(19MB) the 2nd is fat32.(16MB)

I use one 512M usb stick to create image. And use

dd if=/dev/sdc of=image.dd bs=1M count=35  # 35=19+16

I tried to put it on another 2G usb stick by

dd if=image.dd of=/dev/sdb bs=1M

Then I try to use gparted to view the partition on /dev/sdb. The ext3 partition is OK. But the fat32 partition failed. I've compared the MBR between sda & sdb they are same.

dd if=/dev/sdb of=image2.dd bs=1M

diff image.dd image2.dd Binary files sdb.dd and sdc.dd differ

It is very strange, even when I just read the written image, it is different.

dd if=image.dd of=/dev/sdb bs=1M count=35
dd of=image2.dd if=/dev/sdb bs=1M count=35
diff image.dd image2.dd 
differ
share|improve this question
add comment

2 Answers

I think the problem resides in not thinking about the space the MBR needs: The MBR consists of 512 or more bytes located in the first sector of the drive.

Since dd is using the exact size of the partitions, but you're not adding the MBR size, you're ending with a partially complete image. Add 1 more to the count to be able to save all the information.

dd if=/dev/sdc of=image.dd bs=1M count=36

If you want to narrow the size more, you could play with bs/count values by lowering the block size and finding the right block count.

share|improve this answer
add comment

Add an option oflag=direct on dd. It works now.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.