0

I have an embedded device and I'd like to backup the NAND flash. From the openwrt wiki I gathered that dd is not a suitable option for dumping. You can use dd, but the dump will be garbled. However, something like nanddump is not available on the device. I was wondering though if I can dump the NAND with dd and then on another system use nanddump on the raw dump to get the final filesystem. After editing the file-system I'd like to write it back in a similar manner. Will this work in practice or are there other ways?

The ECC logic required by NAND (discussed above) is the main reason you MUST use NAND-aware tools like nanddump and nandwrite instead of the more common dd tool to create or restore a backup of the flash partitions on NAND.

Nanddump reads the NAND with ECC logic, and stores only the actual data (correcting bitflips) in the backup you are creating. Likewise nandwrite writes the image also writing the appropriate parity data for the ECC logic to work when reading it.

The dd tool (or more advanced ones like pv is not aware of NAND ECC logic, so it will read all the NAND partition, both data AND parity and will generate a backup that is exactly the same as actually on flash, but is completely useless and unreadable as it will contain both data and hardware-specific parity information which cannot be restored on a different device. Likewise on writing, it will not write parity information for ECC logic to work, so whatever you write will be read as garbage.

Tools like dd and pv can only be used on block devices. SSDs, SDcards, Hard drives (yes also mechanical hard drives have ECC logic integrated), and so on where any ECC is done by the storage controller, not by the system, so whatever it reads is pure data, no metadata or parity for ECC logic.

  • Is the flash being presented raw, or is there an abstraction layer? (The flash in my USB-storage, is abstracted by a hardware controller, so I can ignore this advice, it just behaves like any other abstract storage device e.g. like an abstracted hard-disk. ( No not a real one, with its park heads, move head in 10 cylinders, CRCs, spin speeds, variable sectors per cylinder, … ) – ctrl-alt-delor Mar 17 at 16:17

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.