Linux version, ARM Linux Kernel on embedded device, NAND-based device. I'm at Busybox rescue shell (ash), with restricted command set. How to manually mount the virtual file systems, to copy the MTD flash partitions into /tmp? I need backup the flash partitions use nanddump.

# cat /proc/mtd 
dev:    size   erasesize  name
mtd0: 00004000 00004000 "NAND BootAgent"
mtd1: 000fc000 00004000 "Linux Kernel"
mtd2: 00d00000 00004000 "Root"
mtd3: 00100000 00004000 "Config"
mtd4: 00100000 00004000 "Debug"
mtd5: 00000000 00004000 "Data"

nanddump -f /tmp/mtd0.bin /dev/mtd0

What virtual file systems I should mount for this? Something like this

# mount -t proc proc /proc
# mount -t sysfs sysfs /sys
# mount -t tmpfs tmpfs /tmp
# mount -t tmpfs none /dev
# mknod -m 666 /dev/zero c 1 5
# mknod -m 666 /dev/null c 1 3
# mkdir /dev/pts
# mount -t devpts none /dev/pts

or I need use commands like this

mount -t proc proc /proc
mount -t sysfs sysfs /sys
mount -t tmpfs -o size=20M,mode=0755 tmpfs /dev
mdev -s

cd /dev
nanddump -f /tmp/mtd0.bin /dev/mtd0

Typically, there will also be a /dev/mtdblockN device, one for each MTD partition. These are block devices you can use with nanddump, dd, mount, etc.

You need to create a mount point directory some place (mkdir -p /media/mnt) for example. Then it depends on what file system your NAND partition is using. For example, I have two UBIFS NAND partitions and would use commands like:

/usr/bin/ubiattach /dev/ubi_ctrl -m <MTD_partition> -O <block_size>
/bin/mount -t ubifs ubi1:rootfs0 /media/mnt

If the partition has no file system (like a kernel image) then nanddump would work.

nanddump -f /tmp/mtd0.bin /dev/mtdblock0

If the partition is a data (NOR) flash then dd will work.

dd if=/dev/mtdblock1 of=/tmp/mtd1.bin
  • So, I need to mount every partition in order to dump it? I mean like this, for example, for nvram file: # mknod -m 644 /dev/mtd9 c 90 9 # mknod -m 644 /dev/mtdblock9 b 31 9 # mount -t jffs2 /dev/mtdblock9 /mnt – fxgreen Apr 19 at 22:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.