1e41f4b71Sopenharmony_ci# format
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci
4e41f4b71Sopenharmony_ci## Command Function
5e41f4b71Sopenharmony_ci
6e41f4b71Sopenharmony_ciThis command is used for disk formatting.
7e41f4b71Sopenharmony_ci
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci## Syntax
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ciformat <*dev*inodename_> <*sectors*> <*option*> [_label_]
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ci## Parameters
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ci**Table 1** Parameter description
17e41f4b71Sopenharmony_ci
18e41f4b71Sopenharmony_ci| Parameter| Description|
19e41f4b71Sopenharmony_ci| -------- | -------- |
20e41f4b71Sopenharmony_ci| dev_inodename | Specifies the device name. |
21e41f4b71Sopenharmony_ci| sectors | Specifies the size of the allocated memory unit or sector. <br/>The value must be **0** or a power of **2**.<br/>The value **0** means to leave this parameter blank. <br/>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. |
22e41f4b71Sopenharmony_ci| option | Specifies the file system type. The options are as follows:<br>- **0x01**: FMT_FAT<br>- **0x02**: FMT_FAT32<br>- **0x07**: FMT_ANY<br>- **0x08**: FMT_ERASE (USB does not support this option.)<br>If an invalid value is specified, the system automatically selects the formatting mode. If the low-level formatting bit is **1** during the formatting of a USB flash drive, an error message is printed.|
23e41f4b71Sopenharmony_ci| label | Specifies the volume label name. This parameter is optional, and the value is a string. <br/>If **null** is specified for this parameter, the previously set volume label name is cleared. |
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ci
26e41f4b71Sopenharmony_ci## Usage Guidelines
27e41f4b71Sopenharmony_ci
28e41f4b71Sopenharmony_ci- The **format** command is used for disk formatting. You can find the device name in the **dev** directory. A storage card must be installed before the formatting.
29e41f4b71Sopenharmony_ci
30e41f4b71Sopenharmony_ci- The **format** command can be used to format the USB flash drive, SD card, and MMC, but not the NAND flash or NOR flash.
31e41f4b71Sopenharmony_ci
32e41f4b71Sopenharmony_ci- An invalid **sectors** value may cause exceptions.
33e41f4b71Sopenharmony_ci
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ci## Example
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ciRun **format /dev/mmcblk0 128 2**.
38e41f4b71Sopenharmony_ci
39e41f4b71Sopenharmony_ci
40e41f4b71Sopenharmony_ci## Output
41e41f4b71Sopenharmony_ci
42e41f4b71Sopenharmony_ciFormat an MMC.
43e41f4b71Sopenharmony_ci
44e41f4b71Sopenharmony_ci```
45e41f4b71Sopenharmony_ciOHOS # format /dev/mmcblk1 128 2
46e41f4b71Sopenharmony_ciFormat to FAT32, 128 sectors per cluster.
47e41f4b71Sopenharmony_ciformat /dev/mmcblk1 Success 
48e41f4b71Sopenharmony_ci```
49