The on-board flash on the LinkIt Smart 7688 development board is a raw flash. It offers limited write cycles (about 100,000) and doesn't provide a wear leveling mechanism and atomic write operation. Therefore, writing user data to the on-board flash frequently isn't recommended.
In addition, the flash storage is 32MB, this space might not be sufficient for storing user data and software packages. As a result, mounting the root FS on an SD card is recommended. Not only does this provide more storage, it's more reliable too.
The procedure provided here assumes there is only one partition on the SD card. If there are multiple partitions on the SD card, you can use Partitioning with fdisk to manage the partition settings.
All data on the SD card will be erased as a result of the following steps.
The steps to mounting the root FS are provided below. For more details, please refer to Rootfs on External Storage (extroot) in OpenWrt.
- Insert a micro-SD card into the LinkIt Smart 7688 device.
- Make sure the device is in Station mode and can access the internet.
- Open the LinkIt Smart 7688 board's system console.
- Enter the following commands to install the required packages:
# opkg update # opkg install block-mount kmod-fs-ext4 kmod-usb-storage-extras e2fsprogs fdisk
- Format the SD card. ext4 file system is used in this example:
# mkfs.ext4 /dev/mmcblk0p1
During the formatting, you'll be prompted to confirm: Proceed anyway? (y,n). Press "
y" to continue.
- Duplicate the current root FS and move it to the SD card by typing the following commands:
# mount /dev/mmcblk0p1 /mnt # tar -C /overlay -cvf - . | tar -C /mnt -xf - # umount /mnt
Create a fstab template, for example:
# block detect > /etc/config/fstab
- Open the fstab configuration (
viis used as an editor in this example):
# vi /etc/config/fstab
- In the 'mount' config section, change the following: (In
vi, press the "i" key to start editing)
targetoption to '/overlay'.
enabledoption to '1'.
Then, the configuration file will look like this:
config 'mount' option target '/overlay' ... option enabled '1'
- Save and exit the configuration file (press Esc key and type :x. Then press Enter in
vito save the file).
- Reboot the platform to complete the setup.
Verify the setup
df -h" command to check if the root FS is mounted successfully.
When the root FS is on the on-board flash, you'll see rootfs only has 11MB storage space left:
root@mylinkit:/# df -h Filesystem Size Used Available Use% Mounted on rootfs 11.0M 1.2M 9.8M 11% / /dev/root 19.8M 19.8M 0 100% /rom
After mounting the root FS on the SD card, you'll see the spare space in rootfs has increased:
root@mylinkit:~# df -h Filesystem Size Used Available Use% Mounted on rootfs 7.2G 24.6M 6.7G 0% / /dev/root 19.8M 19.8M 0 100% /rom
In this example, an 8GB SD card is used and the rootfs size is 7.2GB.