site  contact  subhomenews

EasyDD now verifies write

August 27, 2019 — BarryK

Myself and a couple of other people have had issues with faulty USB Flash drives. This is an insidious problem, failing bits may go unnoticed, just causing damage. Or it could be noticed, even causing failure to boot.

I have proposed two ways to tackling this. Firstly, EasyDD can be enhanced to verify a write. Secondly, some checksums can be performed at bootup.

I have implemented the first one. EasyDD is a utility in EasyOS, CLI or GUI, for writing an image file to a drive. An explanation of EasyDD is here:

https://easyos.org/install/how-to-write-easyos-to-a-flash-drive.html

Verification is implemented in two steps. Firstly, the image file is written to the Flash drive with all bits flipped (inverted). It is then read back to verify.

Then, the normal image file is written to the drive, and read back to verify.

This verifies that the bits are functioning, able to flip to 1 or 0, as well as verifies that the image file has been written successfully.

Inverting the image file is an interesting exercise. It has to be done in a pipeline, between uncompressing of the image file, and writing to the drive. There is a method using the 'tr' utility, as described here:

https://unix.stackexchange.com/questions/151003/how-could-i-flip-content-of-a-binary-file-with-bash-commands

...which is very slow. A C utility to do it is here:

https://unix.stackexchange.com/questions/104585/bit-wise-complement-with-dd

I have named this utility 'bitflip' and it will be in the next release of EasyOS. The 'easydd' utility checks for existence of 'bitlfip' and if not existing, uses 'tr'. 

I have uploaded the latest easydd here:

http://bkhome.org/files/easydd.gz

...it lives at /usr/sbin, and will need to have it's executable permissions set after uncompressing.  You will find it to be a bit slow without the 'bitflip' utility. 

Tags: easy