TS-7670 NAND Backup
Filesystem
Making a UBIFS Debian image from existing filesystem is the best way to make a custom image for production devices. Technologic Systems strongly recommends to do all development on an SD card and later create a UBIFS image from that Debian filesystem. Copying the large amount of small files Debian has to or from the NAND is very time consuming.
Making the UBIFS image from a host PC. Note that mtd-utils will need to be installed, please see your distribution's documentation for instructions on installation
#/mnt/source_fs_root is the mounted Debian filesystem on an SD; /mnt/usb is a USB drive to store the image for later use
mkfs.ubifs -m4096 -e516096 -c4011 -r /mnt/source_fs_root/ /mnt/usb/nandimg.ubifs
Formatting an existing filesystem to get ready for new image
#Unmount any mounted ubifs filesystems
#Detach the MTD device
ubidetach -m 1
#Format the device, mindful of UBI erase counts and bad blocks
ubiformat /dev/mtd1
#Attach newly formatted deivce
ubiattach -m 1
#Create one single volume for whole device, "linux_root" can be any name
ubimkvol /dev/ubi0 -Nlinux_root -s 1974MiB
#Update volume with image made above
ubiupdatevol /dev/ubi0_0 /mnt/host/nandimg.ubifs #this will take roughly 5min
Note: | Do not use any of the standard tools like `flash_erase` in place of `ubiformat` as this will completely erase the UBI erase count values. |
The steps above to write an image to NAND can all be scripted on a USB device. See the section on our USB update mechanism for more information
There are a number of configurations and setups when using UBI and UBIFS, see UBI and UBIFS for more information about the capabilities of the subsystem.