Flash Sub-Partitions

The flash memory on your controller is divided into a number of partitions. These partitions may be seen in DataID 123 "Flash partition size, Kbytes." The standard partitions are:

Files containing system configuration, user programs, and user data are all stored in partition 4, the "User flash disk" partition. By default, this entire partition is accessed by the device "/flash".

Flash Corruption

One characteristic of the flash device on Precise controllers is that sectors must be erased before they are written. An entire 128 Kbyte sector must be erased and re-written, even if only a small part of the data is changed. During this erase-write operation, if a power failure occurs or controller power is turned off, large amounts of data may be lost, including the area of the flash that keeps track of files within the partition.

Once the flash partition is corrupted, there is no alternative but to reinitialize (format) the affected partition and restore the data from backup.

For this reason, we do not recommend writing to files on the flash if there is any danger of power interruption.

Sub-Partitions

When corruption occurs, it is limited to the single partition that is being written. This is why corrupting the User flash area does not affect the GPL system or FPGA firmware.

To limit the area of possible corruption, the single Flash disk partition may be divided into multiple independent partitions. Static program and configuration data may be kept in one partition that is never written during runtime. Less critical dynamic data may be written to a different partition. If that partition is corrupted due to power interruption, only that data is lost and only the corrupted partition needs to be reformatted.

The sub-partitions names are "/flash2", "/flash3", … "/flash8". These names only appear if that sub-partition has been configured for your flash disk. These names may be used anywhere that the main flash disk name "/flash" is valid.

If a controller with sub-partitions is downgraded to an older version of GPL that does not support sub-partitions, only the main "/flash" partition is accessible and its size will be smaller than usual due to the presence of the sub-partitions. If you issue a "format" command on that old GPL system, the main partition size is restored and all sub-partitions are lost.

Creating Sub-Partitions

Sub-partitions are created by setting non-zero values into the DataID 137 "User flash sub-partitions, Kbytes" array. Each element of this array specifies the size of a sub-partition, in K bytes. This array is stored internally on the flash device and does not appear in any configuration .pac files. The sub-partitions "/flash2", "/flash3", … "/flash8" sizes correspond to the values of DataID 137 array elements. If a partition size is 0, that name does not appear.

The size of the main partition "/flash" is decreased to reflect the space used by the sub-partitions. You must leave at least 128Kbytes for the main partition after all sub-partitions are allocated.

All sub-partition sizes must be 0 or multiples of 128. To create sub-partitions, follow this procedure:

Step Action

1.  

Backup any data on the main flash disk "/flash" or any sub-partitions that currently exist. All this data will be lost during this process.

2.  

Using the web interface, set DataID 137 values to the partition sizes you want. All sizes must be a multiple of 128. There must be at least 128 left over that will be assigned to the main "/flash" partition.

3.  

Reboot. You will get numerous error messages at startup regarding /flash, fsmount, and missing parameter DB files.

4.  

If at this point, you decide you wanted to keep your old partitions, do not continue with the next step. Instead, restore DataID 137 to its original values and reboot.

5.  

Issue the format command for each sub-partition using the serial console, GDE console, Telnet, or the web interface System Console. Enter the command "format -ERASE /flashn" where n is empty for the main partition and 2 through 8 for additional partitions.

6.  

Verify the sizes of the sub-partitions by entering the command "dir -stat /flashn" where n is empty for the main partition and 2 through 8 for additional partitions.

7.  

Restore your data to the various partitions. Be sure to restore the "config" folder to the main /flash device.

8.  

Reboot. You should not get any error messages.