Re:Mistakes to Avoid When Buying a MicroSD Card (2018)
by jolmg on Monday August 19, 2019 @01:16PM
(#20739621)
Or instead of files just write to the block device with one big random file with the supposed byte-accurate size of the device, then read it back and compare. Something like:
Using cmp instead of something like md5sum is better since it would stop on the first differing byte, instead of reading the whole thing for both.
EDIT: I'm not sure if my use of dd's bs and count is a good idea, though. It might be better to do:
head -c "$(blockdev --getsize64 "$device")" /dev/urandom > random-file
to get more reasonable buffer sizes. Documentation on head says -c works on bytes, not characters, so that's good.
For that second line, I often prefer to do:
pv random-file > "$device"
to get a neat progress bar.
EDIT 2: As discussed in other threads, one should make sure to invalidate the kernel's cache of the device between steps 2 and 3. My safest bet on how to do that is to reboot the computer.
EDIT: I'm not sure if my use of dd's bs and count is a good idea, though. It might be better to do:
to get more reasonable buffer sizes. Documentation on head says -c works on bytes, not characters, so that's good.For that second line, I often prefer to do:
to get a neat progress bar.EDIT 2: As discussed in other threads, one should make sure to invalidate the kernel's cache of the device between steps 2 and 3. My safest bet on how to do that is to reboot the computer.