flashctl

Manage a flash filesystem

Syntax:

flashctl [-eFfimruvxz] [-A] [-a flags] [-b align]
         [-c flag] [-L] [-l limit] [-n path] [-o offset]
         -p path [-s num] [-U] [-u] [-v...]

Runs on:

Neutrino

Options:

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.

-A
Unlock the entire flash array specified by the preceding -p option.

Note: 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.

-a flags
The mount-attribute flags (the default is 0).
-b align
Set the alignment to 2align (default 2).
-c flag
Set the compression flag (default 1).
-e
Erase the raw partition specified by the preceding -p option from the offset specified by the -o option through to limit specified by the -l option.

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.

-f
Format the raw partition specified by the preceding -p option from the offset specified by the -o option through to limit specified by the -l option.
-F
Force the driver to use the given offset and length parameters, even if the offset and length parameters don't fall within the bounds of the partition specified by the preceding -p option. The range provided by the -o and -l arguments must fit in a single partition, and can't cross partition boundaries.
-i
Print filesystem information for the partition specified by the preceding -p option.
-L
Lock the raw partition specified by the preceding -p option from the offset specified by the -o option through to limit specified by the -1 option.

Note: The -L option fails if the partition (e.g. /dev/fs0p0) is mounted.

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.


-l limit
Specify a size limit in bytes (default 2G) for the partition specified by the preceding -p option. The limit can include a suffix of k, K, m, M, g, or G.
-m
Mount the filesystem partition specified by the preceding -p option. The -m option doesn't work when you use the -o offset option. You must restart the driver for the partition to be recognized.
-n path
Specify the filesystem mountpoint for the partition specified by the preceding -p option.

This option overrides any mountpoint specified with the mount attribute of the mkefs command.

-o offset
Specify the offset in bytes (default 0 bytes). The offset can include a suffix of k, K, m, M, g, or G.
-p path
Specify the raw mountpoint for the partition.
-r
Reclaim deleted blocks on the partition specified by the preceding -p option, up to the limit specified by the -l option.
-s num
Specify the number of spare blocks (default 1) on the partition specified by the preceding -p option.
-U
Unlock the raw partition specified by the preceding -p option from the offset specified by the -o option through to limit specified by -l option.

Note: The -U option fails if the partition (e.g. /dev/fs0p0) is mounted.

You can use /dev/fs0 to bypass the mounted filesystem check, but we don't recommend that you do so.


-u
Unmount the filesystem partition specified by the preceding -p option.
-v...
Be verbose; more v characters cause more verbosity.
-x
Exit the driver.
-z
Query for the compression flag.

Description:

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.


Note:
  • The options are processed in the order entered. For example, you must erase (-e), format (-f), and mount (-m) a partition in this order.
  • For now, use flashctl instead of mount and umount to mount and unmount flash 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.

Examples:

Create a flash filesystem between 1M and 3M in a 4M raw partition:

flashctl -p /dev/fs0p0 -o 1M -l 2M -e -f

Note: This command line results in this organization:
/dev/fs0p0
A raw partition at 0-1 MB
/dev/fs0p1
A flash filesystem partition at 1-3 MB (mounted as /fs0p1)
/dev/fs0p2
A raw partition at 3-4 MB

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

Note: 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.

Caveats:

The mount facility (with the -m and -u options) don't provide complete mount functionality, such as read-only (mount -r) and special options (mount -o).

See also:

devf-800fads, devf-generic, devf-i365sl, devf-mtx600-w8, devf-p5064, devf-ppaq, devf-ram, devf-rpx-lite, devf-sc400, devf-vr41xx, mkefs

"FFS3 filesystem" in the Filesystems chapter of the System Architecture.