I booted Ubuntu on a live USB and ran:

dd if=/dev/sda1 of=/mnt/usb/backup.img bs=30M oflag=sync

I then performed a comparison (using 'md5sum') of the above input partition and output img, but they did not match. Delving further, I found the img was shorter by 1 byte hence the mismatch! 'cmp' of the two returns "EOF on image".

HDD image file checksum does not match with device checksum mentions that dd stopped at EOF and this is normal behaviour, but I am still unclear on the entire situation...

My questions are:

1- What does EOF means in the context of a partition? I think I understand EOF in the context of a file but this is different as I would expect to find EOF at the end of the partition only.
2- Is restoring the dd img (dd if=/mnt/usb/backup.img if=/dev/sda1) safe?
3- What is in that last byte?


  • shorter by 1 byte? how did you determine that? commands and outputs? - linked question is about the other direction, not your issue. – frostschutz Jan 24 at 21:56
  • "blockdev --getsize64 /mnt/usb/backup.img" reported one less byte than "blockdev --getsize64 /dev/sda1" – dumb0 Jan 24 at 22:02
  • The linked question seems very different. In that case the partition contains stuff beyond the end of the image. But in your case if you did partition → image, then I would expect them to match. – ctrl-alt-delor Jan 24 at 22:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.