Progress view with pv
There is a general problem with your concept because USB sticks have slightly different sizes even when the nominal size is the same, and that will affect the md5sum of the whole device.
- If you check the md5sum of each partition, you can check that the original one and the cloned copy are the same.
- An alternative is to store an image file and use the md5sum and the size of the image to apply on the sticks (checking with dd exactly the same number of bytes as in the image file).
Instead of a spinner you can use pv
, progress view, for example
$ sudo pv /dev/sdc | md5sum
29,8GiB 0:13:46 [37,0MiB/s] [================================================>] 100%
2372da0e77d754a912078af8e47b36c9 -
$
It can be better to check only the relevant partition(s),
$ lsblk -f /dev/sdc
NAME FSTYPE LABEL UUID MOUNTPOINT
sdc
├─sdc1
├─sdc2 vfat 34D9-D113
├─sdc3 ext4 3c66d05d-bc02-4a1e-baca-e227a161e345
└─sdc4 crypto_LUKS 371f0cbc-3f6f-49dd-9fc4-4cdf91cb15c9
in this case partition #4,
$ sudo pv /dev/sdc4 | md5sum
1,66GiB 0:00:46 [36,2MiB/s] [================================================>] 100%
35d33ae006c90b47b2e7b9aacb7f9bd7 -
Please remember to unmount the partitions on the USB stick before checking the md5sum.
Cloning a drive with a safety belt
You can clone from one USB stick to another stick (or card or SSD, any mass storage device) with mkusb-dus which also uses pv
if installed and watch-flush
to monitor the progress of the cloning operation. Assuming the source drive is sdx
, run
dus /dev/sdx
It will help you identify the correct target drive (help you avoid overwriting the wrong drive), so you do not specify the target on the command line.