Manage a flash filesystem
flashctl [-eFfimruvxz] [-A] [-a flags] [-b align] [-c flag] [-L] [-l limit] [-n path] [-o offset] -p path [-s num] [-U] [-u] [-v...]
The options are processed in the order given, and apply to the last partition specified by a -p option, letting you control multiple partitions with one command.
|Use this option only with a “raw” device (e.g. /dev/fs0); don't use it with a mounted partition. You can't use the -l and -o options with the -A option.|
If you start the devf-* driver with the -D (automatic detection of error-correcting code mode) or -x (enable software ECC mode) option, you need to specify the alignment. If you're using 64-byte alignment ECC, specify 6. For example:
devf-generic -x1 -s0x20000000,16M flashctl -p /dev/fs0 -o1M -ev flashctl -p /dev/fs0p0 -o1M -f -b6
If you're using 32-byte alignment ECC, specify 5 for align. For example:
devf-generic -x2 -s0x20000000,16M flashctl -p /dev/fs0 -o1M -ev flashctl -p /dev/fs0p0 -o1M -fv -b5
If you specify the -v option for verbose output, flashctl outputs a period (.) for every partition unit that it erases. On RAM disk, the unit size is 64K; on other devices, it varies. This output is reassuring because it can take several minutes to erase slow flash devices.
|The -L option fails if the partition
You can use /dev/fs0 to bypass the mounted filesystem check, but we don't recommend that you do so, because the /dev/fs0 path bypasses all protection mechanisms. If you use it, the flash driver doesn't know what filesystem or partition the locking affects. The filesystem might think the flash is writable and suddenly it isn't. The filesystem will get very confused, and write operations will start to fail. Worse yet, if you lock a single block in a filesystem via /dev/fs0, most of your writes will fail and suddenly stop working.
This option overrides any mountpoint specified with the mount attribute of the mkefs command.
|The -U option fails if the partition
You can use /dev/fs0 to bypass the mounted filesystem check, but we don't recommend that you do so.
The flashctl utility is used to manage a flash filesystem. The utility interacts with the flash filesystem driver using devctl() messages. Using flashctl, you can erase and format a raw partition, force a reclaim operation, and get information about flash filesystem partitions.
The flashctl utility rounds the values of the -o and -l (“el”) options down to the nearest block bound. If the range specified exceeds the partition size, it's rounded down to fit. If you use the -v option, flashctl displays what the values have been rounded to.
If you use the -i option, flashctl displays information about the partition that you chose with the -p option; the amount of information depends on what you chose (the raw socket, raw partition, or formatted mounted filesystem):
Here's an example of the output:
Array Info Total : 0x00800000 100% Chip Size : 0x00800000 100% Unit Size : 0x00020000 1% Part Info Total : 0x00800000 100% Spare : 0x00020000 1% Headers : 0x00001A34 0% Padding : 0x00000000 0% Overhead : 0x00021A34 1% Free : 0x007DE5AC 98% Stale : 0x00000000 0% Avail. : 0x007DE5AC 98% Reserved : 0x00000020 0% Unit Info Erase Stats Average : 0 Minimum : 0 Maximum : 0 Total : 0
Here's how to interpret the output:
Create a flash filesystem between 1 MB and 3 MB in a 4 MB raw partition:
flashctl -p /dev/fs0p0 -o 1M -l 2M -e -f
|This command line results in this organization:
Erase, format, and then mount (as /fs0p0) the flash filesystem partition /dev/fs0p0:
flashctl -p /dev/fs0p0 -e -f -m
Mount the given flash filesystem partition as /flash:
flashctl -p /dev/fs0p0 -n /flash -m
Use the following command to format the range from 3 to 6 MB, if the layout is unknown:
flashctl -p /dev/fs0p0 -F -o 3m -l 6m -f
|For devf-ram partitions only, you must format and erase a partition before you can mount the flash filesystem. Otherwise, you may get an error message flashctl: mounting partition failed.|
The mount facility (with the -m and -u options) doesn't provide complete mount functionality, such as read-only (mount -r) and special options (mount -o).
devf-generic, devf-ram, mkefs
“FFS3 filesystem” in the Filesystems chapter of the System Architecture.