We are using Toradex colibri VF50 module with latest kernel v2.6.1beta. It has
SLC NAND Flash with 100k write cycles. It uses ubifs. It has 4 MTD partitions
out of which one is for ubi. On this partition, we are using ubifs. The ubifs
has 3 logical volumes - kernel, dtb and rootfs. We have our applications and
configuration files on rootfs.
The problem with NAND flash is that when we write a file to it and close the
file, and if the power is cut while the application is still running, it
doesn’t synchronize the file and the entire content of the file gets deleted
when checked on restarting the system. We have already tried using fsync()
after writing to file so that it synchronizes the file as soon as something
is written to it but still there is no surety that on sudden power cuts,
file system will not get corrupted. To solve this problem, we have planned
to do partitioning of file system so that the important system related
content remains in read-only partition and nothing happens to it even when
the file system on some other partition gets corrupted.
We want to partition the flash as follows:
1. One partition for system files mounted as read only
2. One partition for configuration files which need to be read/written at
runtime, mounted initially as read only. For this partition, we are
planning to mount it as read-write during run time when we need to write
to configuration files, and immediately after writing, we will re-mount
it as read only.
3. One partition /sys/log mounted as read-write to write my log files.
So kindly guide us how to go about making these partitions(ubi volumes) providing us some useful links to refer to or some other better option than partitioning to solve the above issue.