Dump and write back mtd

Hello,
I have the /proc/mtd like this on my router:
mtd0: 0f2c0000 00020000 "rootfs"

mtd1: 0f2c0000 00020000 "rootfs_update"

mtd2: 00400000 00020000 "data"

mtd3: 00020000 00020000 "nvram"

mtd4: 0f6e0000 00020000 "image"

mtd5: 0f6e0000 00020000 "image_update"

mtd6: 00420000 00020000 "bootfs"

mtd7: 00420000 00020000 "bootfs_update"

mtd8: 00400000 00020000 "misc3"

mtd9: 00100000 00020000 "misc2"

mtd10: 00800000 00020000 "misc1"

mtd11: 0e842000 0001f000 "rootfs_ubifs"

mtd12: 00100000 00020000 "STNVRAM"

mtd13: 00040000 00020000 "STENVRAM"

mtd14: 00100000 00020000 "STNVRAMBKP"

mtd15: 00040000 00020000 "STENVRAMBKP"

I would like to dump the UBIFS filesystem doing this:
dd if=/dev/mtd11 of=rootfs_ubifs bs=2048

and then flashing back with this command:
dd if=rootfs_ubifs of=/dev/mtd11 bs=2048

The dump command works for sure because I'm able to mount on a unix machine, I would like to have an advice on the second one because I cannot test it because if something goes wrong I could brick my router. I cannot use the mtd command because I don't have it on my router.

Thank you for any advice.

NAND memory? nanddump should be used, not dd, as NAND flash works very differently from NOR flash.

See this

1 Like

Got it so I should do:
nanddump --file /tmp/mtd11.dmp /dev/mtd11

and then to write it back:
flash_erase /dev/mtd11 0 0
nandwrite -p /dev/mtd11 /tmp/mtd11.dmp

Didn't got if the flash_erase is useful or managed anyway with the nandwrite command.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.