format
Command Function
This command is used to format a disk.
Syntax
format <dev_inodename> <sectors> <option> [label]
Parameter Description
Table 1 Parameters
Parameter
|
Description
|
dev_inodename
|
Indicates the device name.
|
sectors
|
Indicates the size of the allocated memory unit or sector. The value 0 indicates that the parameter is null. (The value must be 0 or a power of 2. For FAT32, the maximum value is 128. If the parameter is set to 0, a proper cluster size is automatically selected. The available cluster size range varies depending on the partition size. If the cluster size is incorrectly specified, the formatting may fail.)
|
option
|
Indicates the formatting option for selecting the file system type. The options are as follows:
-
0x01: FMT_FAT
-
0x02: FMT_FAT32
-
0x07: FMT_ANY
-
0x08: FMT_ERASE (not supported by the USB flash drive)
Other values are invalid. The system will automatically select the formatting mode. If the low-level formatting bit is 1 during the formatting of a USB flash drive, an error message is printed.
|
label
|
Indicates the volume label name. This parameter is optional, and the value is a string. If null is specified for this parameter, the previously set volume label name is cleared.
|
Usage
- The format command is used to format a disk. You can find the device name in the dev directory. A storage card must be installed before the formatting.
- This command can be used to format only the USB flash drive, SD card, and MMC, but not the NAND flash and NOR flash.
- The sectors parameter must be set to a valid value. An invalid value may cause exceptions.
Example
Enter format /dev/mmcblk0 128 2.
Output
Formatting result