1
# lsblk -f /dev/sda
NAME FSTYPE   FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINT
sda  squashfs 4.0
# mount -v /dev/sda /mnt
mount: /dev/sda mounted on /mnt.
$ df -B1
Filesystem   1B-blocks        Used Available Use% Mounted on
/dev/sda   20329529344 20329529344         0 100% /mnt
# umount -v /dev/sda
umount: /mnt (/dev/sda) unmounted

, 20329529344 bytes (α).

# unsquashfs -stat /dev/sda | grep size
Filesystem size 20329464124 bytes (19852992.31 Kbytes / 19387.69 Mbytes)
Block size 131072

, 20329464124 bytes (β) (β<α).

# dd if=/dev/sda status=progress | head -c 20329464124 | md5sum | tee -a md5sum.txt
20291548160 bytes (20 GB, 19 GiB) copied, 214 s, 94.8 MB/s8a88b45cd9968045f11f0b164be62fb5  -

, another different size.

# dd if=/dev/sda status=progress | head -c 20329464124 | sha1sum | tee -a sha1sum.txt
20282106880 bytes (20 GB, 19 GiB) copied, 214 s, 94.8 MB/s53de77e6f63123c0379d1e1279c14957eb4cc455  -

, yet another different size.


Question:

  1. Which size is correct? (α) or (β)?

  2. Is this going to work? (30~40MB/s)

head /dev/sda -c xxx | pv -pr -s xxx | md5sum
  1. If not, how to perform the checksum
    • appropriately
    • at an acceptable speed
    • without dumping it to an image file

dd if=/dev/sda bs=1 size=xxx status=progress | md5sum may work but 400~600KB/s is too slow.

Darren Ng
  • 369
  • 1
  • 3
  • 14

0 Answers0