etfsctl
Control an embedded transaction filesystem
Syntax:
etfsctl [-cDeFfipSs] [-d device] [-l len] [-o offset] [-R file]
[-r file] [-W file] [-w file]
Runs on:
QNX Neutrino
Options:
- -c
- Make the filesystem on the device continue or resume operations.
- -D
- Request a defragmentation operation on the .filetable for the ETFS filesystem. The ETFS filesystem does its own defragmenting, as needed, in the background. This option lets you force it to happen on demand.
- -d device
- Connect to the specified device:
- /dev/etfs1
- The raw partition for user extensions (such as boot images).
- /dev/etfs2
- The filesystem partition for etfs files.
- -e
- Erase the device. For NAND flash,
factory-marked bad blocks aren't erased.
Blocks that become bad during normal use
(worn-out blocks) are also skipped during the erasing.
If you wish, you can use the -l and -o options to specify the length and offset for the erasure. If used, these options must preceed the -e option.
- -F
- Flush the following files to the device:
- .badblks — a list of the bad blocks.
- .counts — an array of the blocks showing the read and erase counts, used in wear leveling.
- -f
- Erase as in -e, then format an empty filesystem. Don't use this option with -w, since -w assumes an erased partition with no filesystem.
- -i
- Print info about the filesystem. See the
Description
below. - -l len
- (
el
) The length for the subsequent -e, -R, or -r option. The len is in bytes, but you can add a suffix ofK,M, orG. - -o offset
- The starting offset for the subsequent -e,
-R, -r, -W, or -w option.
The offset is in bytes, but you can add a suffix of
K,M, orG. - -p
- Operate in software-update mode.
- -R file
- Read all data from the device, including blank or erased blocks, and save it in the specified file. This is the raw version of -r option.
- -r file
- Read all data from the device and save it in the specified file.
The data is saved as a series of transactions.
This data can be written to another flash part as long
as that part has the same:
- cluster size
- block size (number of clusters in a block)
The data format is endian-neutral and free of any device-specific characteristics such as how it stores CRCs or ECCs. You can now read and write filesystems across different classes of devices, for example for NAND and RAM.
If you wish, you can use the -l and -o options to specify the length and offset for which to read. If used, these options must preceed the -r or -R option. If you specify the -l option, etfsctl doesn't read past this length.
- -S
- Similar to -s, but wait for the filesystem to stop before returning.
- -s
- Stop the filesystem on the device.
- -W file
- Write transactions from the specified file to the device and copy any blank or erased blocks. This is a raw version of the -w option.
- -w file
- Write transactions from the specified file to the device.
This transaction file can be created by reading it from this or
another device via the -r option of
etfsctl or by the mketfs utility.
The transactions are block-location-independent on the device.
This allows bulk programming of devices with bad blocks in any location.
The only requirement is that enough good blocks should be available to hold all transactions.
If you wish, you can use the -o option to specify the offset at which to write. If used, this option must preceed the -w or -W option.
Description:
The etfsctl utility is used to manage an embedded transaction filesystem (ETFS). The utility interacts with the running filesystem using devctl() messages. Using etfsctl, you can erase and format a partition, read or write an entire transaction log (and thus its entire filesystem) from or to the device, stop the filesystem, make it continue or get statistical information.
Options are processed from left to right in order. The first option must be a -d device where:
- /dev/etfs1
- The raw partition for user extensions (such as boot images).
- /dev/etfs2
- The filesystem partition for etfs files.
The raw partition is used for user extensions, such as boot images, and is always at the start of the device. It may be zero bytes long if you don't need it.
The filesystem partition consists of a series of transactions that together form a filesystem. You can use the -r option to read the transactions from the device and save them to a regular file, typically on another filesystem. You can then use the -w option to write this transaction log to another ETFS filesystem.
The -w option is most often used to write transaction logs created by the mketfs utility.
You can request the filesystem to stop accepting new open requests by using the -s or -S option. Once the last file currently open by any application is closed, the filesystem enters the stopped state. A filesystem partition must be stopped in order for you to write a transaction log to it. You can start the filesystem again using the -c option.
The -i option provides useful statistical information about a running filesystem. This option is so common that it assumes /dev/etfs2, thus saving you from having to enter the -d option before it. The information is displayed in several groups: Device, Pools, Counts, and Errors. The output includes:
- Device:
- Name
- The name of the device. The name usually encodes a part number or size.
- Blocks
- The number of blocks on the device.
- Clusters/Block
- The number of clusters to a block on the device.
- Clustersize
- The size of a cluster. Typically 1 KB or 2 KB.
- Totalsize
- The total size of the device, in bytes.
- Pools:
- Clean
- The number of erased blocks immediately ready for writing.
- Spare
- The number of spare blocks.
- Filthy
- The number of free blocks that are waiting to be erased and made clean.
- Inactive
- The number of clusters not being used but trapped.
- Xpool
- The number of cache buffers.
- Cache
- The number of cluster cache buffers.
- Counts:
- Erase
- The number of erases on the part (while running).
- Avg
- Average erase count per block.
- Read
- The number of cluster reads from the device.
- Cache
- The number of cluster reads from cache.
- Write
- The number of cluster writes to the device.
- Mine
- The number of mining operations to recover dead space in a block. This is how inactive clusters create filthy blocks, which become clean after being erased.
- Copy
- The number of block-copy operations.
Copies occur two ways:
- The first way is a read in a block that has a soft ECC error, which is an indication that the block is getting weak. The block is copied to a new fresh block and the block with the ECC error is erased.
- In the second way, a block with a low erase count is forced into service by copying its data to a new block and erasing and putting this block into service.
- Defrag
- The number of files defragmented.
- BadBlks
- The number of blocks marked as bad and taken out of service
- Errors:
- Ecc
- The number of CRC data errors that are corrected by ECC.
- Chksum
- The number of CRC data errors.
- Device
- The number of hard device errors. This is bad and usually indicates a hardware problem.
Note:The error statistics currently aren't collected, so these values are always 0.
Examples:
Print information about a filesystem. If you omit the -d option, etfsctl assumes /dev/etfs2.
etfsctl -i
etfsctl -d /dev/etfs2 -i
Format an empty filesystem:
etfsctl -d /dev/etfs2 -S -f -c
Write a filesystem built by mketfs:
etfsctl -d /dev/etfs2 -S -e -w fsys.etfs -c
Save the entire filesystem. Erase the part, and restore the filesystem:
etfsctl -d /dev/etfs2 -r debug.etfs
etfsctl -d /dev/etfs2 -S -e -w debug.etfs -c
Erase part of a raw ETFS partition, without erasing the boot monitor:
etfsctl -d /dev/etfs1 -o 3M -l 6M -e
Read part of a raw partition:
etfsctl -d /dev/etfs1 -o 3m -l 2k -R /temp/raw.stuff
