• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# format
2
3
4## Command Function
5
6This command is used for disk formatting.
7
8
9## Syntax
10
11format <*dev*inodename_> <*sectors*> <*option*> [_label_]
12
13
14## Parameters
15
16**Table 1** Parameter description
17
18| Parameter| Description|
19| -------- | -------- |
20| dev_inodename | Specifies the device name. |
21| 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. |
22| 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.|
23| 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. |
24
25
26## Usage Guidelines
27
28- 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.
29
30- The **format** command can be used to format the USB flash drive, SD card, and MMC, but not the NAND flash or NOR flash.
31
32- An invalid **sectors** value may cause exceptions.
33
34
35## Example
36
37Run **format /dev/mmcblk0 128 2**.
38
39
40## Output
41
42Format an MMC.
43
44```
45OHOS # format /dev/mmcblk1 128 2
46Format to FAT32, 128 sectors per cluster.
47format /dev/mmcblk1 Success
48```
49