1e41f4b71Sopenharmony_ci# @ohos.file.volumeManager (Volume Management) (System API)
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciThe **volumeManager** module provides APIs for volume and disk management, including obtaining volume information, mounting or unmounting a volume, partitioning a disk, and formatting a volume.
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci> **NOTE**
6e41f4b71Sopenharmony_ci>
7e41f4b71Sopenharmony_ci> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
8e41f4b71Sopenharmony_ci> - The APIs provided by this module are system APIs.
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ci## Modules to Import
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ci```ts
13e41f4b71Sopenharmony_ciimport volumemanager from "@ohos.file.volumeManager";
14e41f4b71Sopenharmony_ci```
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ci## volumemanager.getAllVolumes
17e41f4b71Sopenharmony_ci
18e41f4b71Sopenharmony_cigetAllVolumes(): Promise<Array<Volume>>
19e41f4b71Sopenharmony_ci
20e41f4b71Sopenharmony_ciObtains information about all volumes of this external storage device. This API uses a promise to return the result.
21e41f4b71Sopenharmony_ci
22e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.STORAGE_MANAGER
23e41f4b71Sopenharmony_ci
24e41f4b71Sopenharmony_ci**System capability**: SystemCapability.FileManagement.StorageService.Volume
25e41f4b71Sopenharmony_ci
26e41f4b71Sopenharmony_ci**Return value**
27e41f4b71Sopenharmony_ci
28e41f4b71Sopenharmony_ci  | Type                              | Description                      |
29e41f4b71Sopenharmony_ci  | ---------------------------------- | -------------------------- |
30e41f4b71Sopenharmony_ci  | Promise<[Volume](#volume)[]> | Promise used to return information about all available volumes.|
31e41f4b71Sopenharmony_ci
32e41f4b71Sopenharmony_ci**Error codes**
33e41f4b71Sopenharmony_ci
34e41f4b71Sopenharmony_ciFor details about the error codes, see [File Management Error Codes](errorcode-filemanagement.md).
35e41f4b71Sopenharmony_ci
36e41f4b71Sopenharmony_ci| ID| Error Message|
37e41f4b71Sopenharmony_ci| -------- | -------- |
38e41f4b71Sopenharmony_ci| 201 | Permission verification failed. |
39e41f4b71Sopenharmony_ci| 202 | The caller is not a system application. |
40e41f4b71Sopenharmony_ci| 401 | The input parameter is invalid. Possible causes: Mandatory parameters are left unspecified. |
41e41f4b71Sopenharmony_ci| 13600001 | IPC error. |
42e41f4b71Sopenharmony_ci| 13900042 | Unknown error. |
43e41f4b71Sopenharmony_ci
44e41f4b71Sopenharmony_ci**Example**
45e41f4b71Sopenharmony_ci
46e41f4b71Sopenharmony_ci  ```ts
47e41f4b71Sopenharmony_ci  import { BusinessError } from '@ohos.base';
48e41f4b71Sopenharmony_ci  volumemanager.getAllVolumes().then((volumes: Array<volumemanager.Volume>) => {
49e41f4b71Sopenharmony_ci    // Do something with the volume array.
50e41f4b71Sopenharmony_ci  }).catch((error: BusinessError) => {
51e41f4b71Sopenharmony_ci    console.error("getAllVolumes failed");
52e41f4b71Sopenharmony_ci  });
53e41f4b71Sopenharmony_ci  ```
54e41f4b71Sopenharmony_ci
55e41f4b71Sopenharmony_ci## volumemanager.getAllVolumes
56e41f4b71Sopenharmony_ci
57e41f4b71Sopenharmony_cigetAllVolumes(callback: AsyncCallback&lt;Array&lt;Volume&gt;&gt;): void
58e41f4b71Sopenharmony_ci
59e41f4b71Sopenharmony_ciObtains information about all volumes of this external storage device. This API uses an asynchronous callback to return the result.
60e41f4b71Sopenharmony_ci
61e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.STORAGE_MANAGER
62e41f4b71Sopenharmony_ci
63e41f4b71Sopenharmony_ci**System capability**: SystemCapability.FileManagement.StorageService.Volume
64e41f4b71Sopenharmony_ci
65e41f4b71Sopenharmony_ci**Parameters**
66e41f4b71Sopenharmony_ci
67e41f4b71Sopenharmony_ci  | Name  | Type                                             | Mandatory| Description                                |
68e41f4b71Sopenharmony_ci  | -------- | ------------------------------------------------- | ---- | ------------------------------------ |
69e41f4b71Sopenharmony_ci  | callback | AsyncCallback&lt;[Volume](#volume)[]&gt; | Yes  | Callback used to return information about all available volumes.|
70e41f4b71Sopenharmony_ci
71e41f4b71Sopenharmony_ci**Error codes**
72e41f4b71Sopenharmony_ci
73e41f4b71Sopenharmony_ciFor details about the error codes, see [File Management Error Codes](errorcode-filemanagement.md).
74e41f4b71Sopenharmony_ci
75e41f4b71Sopenharmony_ci| ID| Error Message|
76e41f4b71Sopenharmony_ci| -------- | -------- |
77e41f4b71Sopenharmony_ci| 201 | Permission verification failed. |
78e41f4b71Sopenharmony_ci| 202 | The caller is not a system application. |
79e41f4b71Sopenharmony_ci| 401 | The input parameter is invalid. Possible causes: Mandatory parameters are left unspecified. |
80e41f4b71Sopenharmony_ci| 13600001 | IPC error. |
81e41f4b71Sopenharmony_ci| 13900042 | Unknown error. |
82e41f4b71Sopenharmony_ci
83e41f4b71Sopenharmony_ci**Example**
84e41f4b71Sopenharmony_ci
85e41f4b71Sopenharmony_ci  ```ts
86e41f4b71Sopenharmony_ci  import { BusinessError } from '@ohos.base';
87e41f4b71Sopenharmony_ci  volumemanager.getAllVolumes((error: BusinessError, volumes: Array<volumemanager.Volume>) => {
88e41f4b71Sopenharmony_ci    // Do something.
89e41f4b71Sopenharmony_ci  });
90e41f4b71Sopenharmony_ci  ```
91e41f4b71Sopenharmony_ci
92e41f4b71Sopenharmony_ci## volumemanager.mount
93e41f4b71Sopenharmony_ci
94e41f4b71Sopenharmony_cimount(volumeId: string): Promise&lt;void&gt;
95e41f4b71Sopenharmony_ci
96e41f4b71Sopenharmony_ciMounts a volume. This API uses a promise to return the result. Currently, only the File Allocation Table (FAT), Extensible FAT (exFAT), and New Technology File System (NTFS) file systems are supported.
97e41f4b71Sopenharmony_ci
98e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER
99e41f4b71Sopenharmony_ci
100e41f4b71Sopenharmony_ci**System capability**: SystemCapability.FileManagement.StorageService.Volume
101e41f4b71Sopenharmony_ci
102e41f4b71Sopenharmony_ci**Parameters**
103e41f4b71Sopenharmony_ci
104e41f4b71Sopenharmony_ci  | Name  | Type  | Mandatory| Description|
105e41f4b71Sopenharmony_ci  | -------- | ------ | ---- | ---- |
106e41f4b71Sopenharmony_ci  | volumeId | string | Yes  | Volume ID.|
107e41f4b71Sopenharmony_ci
108e41f4b71Sopenharmony_ci**Return value**
109e41f4b71Sopenharmony_ci
110e41f4b71Sopenharmony_ci  | Type                  | Description      |
111e41f4b71Sopenharmony_ci  | ---------------------- | ---------- |
112e41f4b71Sopenharmony_ci  | Promise&lt;void&gt; | Promise that returns no value.|
113e41f4b71Sopenharmony_ci
114e41f4b71Sopenharmony_ci**Error codes**
115e41f4b71Sopenharmony_ci
116e41f4b71Sopenharmony_ciFor details about the error codes, see [File Management Error Codes](errorcode-filemanagement.md).
117e41f4b71Sopenharmony_ci
118e41f4b71Sopenharmony_ci| ID| Error Message|
119e41f4b71Sopenharmony_ci| -------- | -------- |
120e41f4b71Sopenharmony_ci| 201 | Permission verification failed. |
121e41f4b71Sopenharmony_ci| 202 | The caller is not a system application. |
122e41f4b71Sopenharmony_ci| 401 | The input parameter is invalid. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
123e41f4b71Sopenharmony_ci| 13600001 | IPC error. |
124e41f4b71Sopenharmony_ci| 13600002 | Not supported filesystem. |
125e41f4b71Sopenharmony_ci| 13600003 | Failed to mount. |
126e41f4b71Sopenharmony_ci| 13600005 | Incorrect volume state. |
127e41f4b71Sopenharmony_ci| 13600008 | No such object. |
128e41f4b71Sopenharmony_ci| 13900042 | Unknown error. |
129e41f4b71Sopenharmony_ci
130e41f4b71Sopenharmony_ci**Example**
131e41f4b71Sopenharmony_ci
132e41f4b71Sopenharmony_ci  ```ts
133e41f4b71Sopenharmony_ci  import { BusinessError } from '@ohos.base';
134e41f4b71Sopenharmony_ci  let volumeId: string = "";
135e41f4b71Sopenharmony_ci  volumemanager.mount(volumeId).then(() => {
136e41f4b71Sopenharmony_ci    // Do something.
137e41f4b71Sopenharmony_ci  }).catch((error: BusinessError) => {
138e41f4b71Sopenharmony_ci    console.error("mount failed");
139e41f4b71Sopenharmony_ci  });
140e41f4b71Sopenharmony_ci  ```
141e41f4b71Sopenharmony_ci
142e41f4b71Sopenharmony_ci## volumemanager.mount
143e41f4b71Sopenharmony_ci
144e41f4b71Sopenharmony_cimount(volumeId: string, callback:AsyncCallback&lt;void&gt;):void
145e41f4b71Sopenharmony_ci
146e41f4b71Sopenharmony_ciMounts a volume. This API uses an asynchronous callback to return the result. Currently, only the FAT, exFAT, and NTFS file systems are supported.
147e41f4b71Sopenharmony_ci
148e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER
149e41f4b71Sopenharmony_ci
150e41f4b71Sopenharmony_ci**System capability**: SystemCapability.FileManagement.StorageService.Volume
151e41f4b71Sopenharmony_ci
152e41f4b71Sopenharmony_ci**Parameters**
153e41f4b71Sopenharmony_ci
154e41f4b71Sopenharmony_ci  | Name  | Type                                 | Mandatory| Description                |
155e41f4b71Sopenharmony_ci  | -------- | ------------------------------------- | ---- | -------------------- |
156e41f4b71Sopenharmony_ci  | volumeId | string                                | Yes  | Volume ID.                |
157e41f4b71Sopenharmony_ci  | callback | AsyncCallback&lt;void&gt; | Yes  | Callback that returns no value.|
158e41f4b71Sopenharmony_ci
159e41f4b71Sopenharmony_ci**Error codes**
160e41f4b71Sopenharmony_ci
161e41f4b71Sopenharmony_ciFor details about the error codes, see [File Management Error Codes](errorcode-filemanagement.md).
162e41f4b71Sopenharmony_ci
163e41f4b71Sopenharmony_ci| ID| Error Message|
164e41f4b71Sopenharmony_ci| -------- | -------- |
165e41f4b71Sopenharmony_ci| 201 | Permission verification failed. |
166e41f4b71Sopenharmony_ci| 202 | The caller is not a system application. |
167e41f4b71Sopenharmony_ci| 401 | The input parameter is invalid. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
168e41f4b71Sopenharmony_ci| 13600001 | IPC error. |
169e41f4b71Sopenharmony_ci| 13600002 | Not supported filesystem. |
170e41f4b71Sopenharmony_ci| 13600003 | Failed to mount. |
171e41f4b71Sopenharmony_ci| 13600005 | Incorrect volume state. |
172e41f4b71Sopenharmony_ci| 13600008 | No such object. |
173e41f4b71Sopenharmony_ci| 13900042 | Unknown error. |
174e41f4b71Sopenharmony_ci
175e41f4b71Sopenharmony_ci**Example**
176e41f4b71Sopenharmony_ci
177e41f4b71Sopenharmony_ci  ```ts
178e41f4b71Sopenharmony_ci  import { BusinessError } from '@ohos.base';
179e41f4b71Sopenharmony_ci  let volumeId: string = "";
180e41f4b71Sopenharmony_ci  volumemanager.mount(volumeId, (error: BusinessError) => {
181e41f4b71Sopenharmony_ci    // Do something.
182e41f4b71Sopenharmony_ci  });
183e41f4b71Sopenharmony_ci  ```
184e41f4b71Sopenharmony_ci
185e41f4b71Sopenharmony_ci## volumemanager.unmount
186e41f4b71Sopenharmony_ci
187e41f4b71Sopenharmony_ciunmount(volumeId: string): Promise&lt;void&gt;
188e41f4b71Sopenharmony_ci
189e41f4b71Sopenharmony_ciUnmounts a volume. This API uses a promise to return the result.
190e41f4b71Sopenharmony_ci
191e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER
192e41f4b71Sopenharmony_ci
193e41f4b71Sopenharmony_ci**System capability**: SystemCapability.FileManagement.StorageService.Volume
194e41f4b71Sopenharmony_ci
195e41f4b71Sopenharmony_ci**Parameters**
196e41f4b71Sopenharmony_ci
197e41f4b71Sopenharmony_ci  | Name  | Type  | Mandatory| Description|
198e41f4b71Sopenharmony_ci  | -------- | ------ | ---- | ---- |
199e41f4b71Sopenharmony_ci  | volumeId | string | Yes  | Volume ID.|
200e41f4b71Sopenharmony_ci
201e41f4b71Sopenharmony_ci**Return value**
202e41f4b71Sopenharmony_ci
203e41f4b71Sopenharmony_ci  | Type                  | Description      |
204e41f4b71Sopenharmony_ci  | ---------------------- | ---------- |
205e41f4b71Sopenharmony_ci  | Promise&lt;void&gt; | Promise that returns no value.|
206e41f4b71Sopenharmony_ci
207e41f4b71Sopenharmony_ci**Error codes**
208e41f4b71Sopenharmony_ci
209e41f4b71Sopenharmony_ciFor details about the error codes, see [File Management Error Codes](errorcode-filemanagement.md).
210e41f4b71Sopenharmony_ci
211e41f4b71Sopenharmony_ci| ID| Error Message|
212e41f4b71Sopenharmony_ci| -------- | -------- |
213e41f4b71Sopenharmony_ci| 201 | Permission verification failed. |
214e41f4b71Sopenharmony_ci| 202 | The caller is not a system application. |
215e41f4b71Sopenharmony_ci| 401 | The input parameter is invalid. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
216e41f4b71Sopenharmony_ci| 13600001 | IPC error. |
217e41f4b71Sopenharmony_ci| 13600002 | Not supported filesystem. |
218e41f4b71Sopenharmony_ci| 13600004 | Failed to unmount. |
219e41f4b71Sopenharmony_ci| 13600005 | Incorrect volume state. |
220e41f4b71Sopenharmony_ci| 13600008 | No such object. |
221e41f4b71Sopenharmony_ci| 13900042 | Unknown error. |
222e41f4b71Sopenharmony_ci
223e41f4b71Sopenharmony_ci**Example**
224e41f4b71Sopenharmony_ci
225e41f4b71Sopenharmony_ci  ```ts
226e41f4b71Sopenharmony_ci  import { BusinessError } from '@ohos.base';
227e41f4b71Sopenharmony_ci  let volumeId: string = "";
228e41f4b71Sopenharmony_ci  volumemanager.unmount(volumeId).then(() => {
229e41f4b71Sopenharmony_ci    // Do something.
230e41f4b71Sopenharmony_ci  }).catch((error: BusinessError) => {
231e41f4b71Sopenharmony_ci    console.error("mount failed");
232e41f4b71Sopenharmony_ci  });
233e41f4b71Sopenharmony_ci  ```
234e41f4b71Sopenharmony_ci
235e41f4b71Sopenharmony_ci## volumemanager.unmount
236e41f4b71Sopenharmony_ci
237e41f4b71Sopenharmony_ciunmount(volumeId: string, callback: AsyncCallback&lt;void&gt;): void
238e41f4b71Sopenharmony_ci
239e41f4b71Sopenharmony_ciUnmounts a volume. This API uses an asynchronous callback to return the result.
240e41f4b71Sopenharmony_ci
241e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER
242e41f4b71Sopenharmony_ci
243e41f4b71Sopenharmony_ci**System capability**: SystemCapability.FileManagement.StorageService.Volume
244e41f4b71Sopenharmony_ci
245e41f4b71Sopenharmony_ci**Parameters**
246e41f4b71Sopenharmony_ci
247e41f4b71Sopenharmony_ci  | Name  | Type                                 | Mandatory| Description                |
248e41f4b71Sopenharmony_ci  | -------- | ------------------------------------- | ---- | -------------------- |
249e41f4b71Sopenharmony_ci  | volumeId | string                                | Yes  | Volume ID.                |
250e41f4b71Sopenharmony_ci  | callback | AsyncCallback&lt;void&gt; | Yes  | Callback that returns no value.|
251e41f4b71Sopenharmony_ci
252e41f4b71Sopenharmony_ci**Error codes**
253e41f4b71Sopenharmony_ci
254e41f4b71Sopenharmony_ciFor details about the error codes, see [File Management Error Codes](errorcode-filemanagement.md).
255e41f4b71Sopenharmony_ci
256e41f4b71Sopenharmony_ci| ID| Error Message|
257e41f4b71Sopenharmony_ci| -------- | -------- |
258e41f4b71Sopenharmony_ci| 201 | Permission verification failed. |
259e41f4b71Sopenharmony_ci| 202 | The caller is not a system application. |
260e41f4b71Sopenharmony_ci| 401 | The input parameter is invalid. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
261e41f4b71Sopenharmony_ci| 13600001 | IPC error. |
262e41f4b71Sopenharmony_ci| 13600002 | Not supported filesystem. |
263e41f4b71Sopenharmony_ci| 13600004 | Failed to unmount. |
264e41f4b71Sopenharmony_ci| 13600005 | Incorrect volume state. |
265e41f4b71Sopenharmony_ci| 13600008 | No such object. |
266e41f4b71Sopenharmony_ci| 13900042 | Unknown error. |
267e41f4b71Sopenharmony_ci
268e41f4b71Sopenharmony_ci**Example**
269e41f4b71Sopenharmony_ci
270e41f4b71Sopenharmony_ci  ```ts
271e41f4b71Sopenharmony_ci  import { BusinessError } from '@ohos.base';
272e41f4b71Sopenharmony_ci  let volumeId: string = "";
273e41f4b71Sopenharmony_ci  volumemanager.unmount(volumeId, (error: BusinessError) => {
274e41f4b71Sopenharmony_ci    // Do something.
275e41f4b71Sopenharmony_ci  });
276e41f4b71Sopenharmony_ci  ```
277e41f4b71Sopenharmony_ci
278e41f4b71Sopenharmony_ci## volumemanager.getVolumeByUuid
279e41f4b71Sopenharmony_ci
280e41f4b71Sopenharmony_cigetVolumeByUuid(uuid: string): Promise&lt;Volume&gt;
281e41f4b71Sopenharmony_ci
282e41f4b71Sopenharmony_ciObtains information about a volume based on the universally unique identifier (UUID). This API uses a promise to return the result.
283e41f4b71Sopenharmony_ci
284e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.STORAGE_MANAGER
285e41f4b71Sopenharmony_ci
286e41f4b71Sopenharmony_ci**System capability**: SystemCapability.FileManagement.StorageService.Volume
287e41f4b71Sopenharmony_ci
288e41f4b71Sopenharmony_ci**Parameters**
289e41f4b71Sopenharmony_ci
290e41f4b71Sopenharmony_ci  | Name  | Type  | Mandatory| Description|
291e41f4b71Sopenharmony_ci  | -------- | ------ | ---- | ---- |
292e41f4b71Sopenharmony_ci  | uuid | string | Yes  | UUID of the volume.|
293e41f4b71Sopenharmony_ci
294e41f4b71Sopenharmony_ci**Return value**
295e41f4b71Sopenharmony_ci
296e41f4b71Sopenharmony_ci  | Type                              | Description                      |
297e41f4b71Sopenharmony_ci  | ---------------------------------- | -------------------------- |
298e41f4b71Sopenharmony_ci  | Promise&lt;[Volume](#volume)&gt; | Promise used to return the volume information obtained.|
299e41f4b71Sopenharmony_ci
300e41f4b71Sopenharmony_ci**Error codes**
301e41f4b71Sopenharmony_ci
302e41f4b71Sopenharmony_ciFor details about the error codes, see [File Management Error Codes](errorcode-filemanagement.md).
303e41f4b71Sopenharmony_ci
304e41f4b71Sopenharmony_ci| ID| Error Message|
305e41f4b71Sopenharmony_ci| -------- | -------- |
306e41f4b71Sopenharmony_ci| 201 | Permission verification failed. |
307e41f4b71Sopenharmony_ci| 202 | The caller is not a system application. |
308e41f4b71Sopenharmony_ci| 401 | The input parameter is invalid. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
309e41f4b71Sopenharmony_ci| 13600001 | IPC error. |
310e41f4b71Sopenharmony_ci| 13600008 | No such object. |
311e41f4b71Sopenharmony_ci| 13900042 | Unknown error. |
312e41f4b71Sopenharmony_ci
313e41f4b71Sopenharmony_ci**Example**
314e41f4b71Sopenharmony_ci
315e41f4b71Sopenharmony_ci  ```ts
316e41f4b71Sopenharmony_ci  import { BusinessError } from '@ohos.base';
317e41f4b71Sopenharmony_ci  let uuid: string = "";
318e41f4b71Sopenharmony_ci  volumemanager.getVolumeByUuid(uuid).then((volume: volumemanager.Volume) => {
319e41f4b71Sopenharmony_ci    console.info("getVolumeByUuid successfully:" + JSON.stringify(volume));
320e41f4b71Sopenharmony_ci  }).catch((error: BusinessError) => {
321e41f4b71Sopenharmony_ci    console.error("getVolumeByUuid failed with error:" + JSON.stringify(error));
322e41f4b71Sopenharmony_ci  });
323e41f4b71Sopenharmony_ci  ```
324e41f4b71Sopenharmony_ci
325e41f4b71Sopenharmony_ci## volumemanager.getVolumeByUuid
326e41f4b71Sopenharmony_ci
327e41f4b71Sopenharmony_cigetVolumeByUuid(uuid: string, callback: AsyncCallback&lt;Volume&gt;): void
328e41f4b71Sopenharmony_ci
329e41f4b71Sopenharmony_ciObtains information about a volume based on the UUID. This API uses an asynchronous callback to return the result.
330e41f4b71Sopenharmony_ci
331e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.STORAGE_MANAGER
332e41f4b71Sopenharmony_ci
333e41f4b71Sopenharmony_ci**System capability**: SystemCapability.FileManagement.StorageService.Volume
334e41f4b71Sopenharmony_ci
335e41f4b71Sopenharmony_ci**Parameters**
336e41f4b71Sopenharmony_ci
337e41f4b71Sopenharmony_ci  | Name   | Type                                                | Mandatory| Description                |
338e41f4b71Sopenharmony_ci  | -------- | ------------------------------------------------ | ---- | -------------------- |
339e41f4b71Sopenharmony_ci  | uuid | string                                                 | Yes  | UUID of the volume.                |
340e41f4b71Sopenharmony_ci  | callback | AsyncCallback&lt;[Volume](#volume)&gt;  | Yes  | Callback used to return the volume information obtained.|
341e41f4b71Sopenharmony_ci
342e41f4b71Sopenharmony_ci**Error codes**
343e41f4b71Sopenharmony_ci
344e41f4b71Sopenharmony_ciFor details about the error codes, see [File Management Error Codes](errorcode-filemanagement.md).
345e41f4b71Sopenharmony_ci
346e41f4b71Sopenharmony_ci| ID| Error Message|
347e41f4b71Sopenharmony_ci| -------- | -------- |
348e41f4b71Sopenharmony_ci| 201 | Permission verification failed. |
349e41f4b71Sopenharmony_ci| 202 | The caller is not a system application. |
350e41f4b71Sopenharmony_ci| 401 | The input parameter is invalid. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
351e41f4b71Sopenharmony_ci| 13600001 | IPC error. |
352e41f4b71Sopenharmony_ci| 13600008 | No such object. |
353e41f4b71Sopenharmony_ci| 13900042 | Unknown error. |
354e41f4b71Sopenharmony_ci
355e41f4b71Sopenharmony_ci**Example**
356e41f4b71Sopenharmony_ci
357e41f4b71Sopenharmony_ci  ```ts
358e41f4b71Sopenharmony_ci  import { BusinessError } from '@ohos.base';
359e41f4b71Sopenharmony_ci  let uuid: string = "";
360e41f4b71Sopenharmony_ci  volumemanager.getVolumeByUuid(uuid, (error: BusinessError, volume: volumemanager.Volume) => {
361e41f4b71Sopenharmony_ci    // Do something.   
362e41f4b71Sopenharmony_ci  });
363e41f4b71Sopenharmony_ci  ```
364e41f4b71Sopenharmony_ci
365e41f4b71Sopenharmony_ci## volumemanager.getVolumeById
366e41f4b71Sopenharmony_ci
367e41f4b71Sopenharmony_cigetVolumeById(volumeId: string): Promise&lt;Volume&gt;
368e41f4b71Sopenharmony_ci
369e41f4b71Sopenharmony_ciObtains information about a volume based on the volume ID. This API uses a promise to return the result.
370e41f4b71Sopenharmony_ci
371e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.STORAGE_MANAGER
372e41f4b71Sopenharmony_ci
373e41f4b71Sopenharmony_ci**System capability**: SystemCapability.FileManagement.StorageService.Volume
374e41f4b71Sopenharmony_ci
375e41f4b71Sopenharmony_ci**Parameters**
376e41f4b71Sopenharmony_ci
377e41f4b71Sopenharmony_ci  | Name   | Type   | Mandatory | Description|
378e41f4b71Sopenharmony_ci  | -------- | ------ | ---- | ---- |
379e41f4b71Sopenharmony_ci  | volumeId | string | Yes  | Volume ID.|
380e41f4b71Sopenharmony_ci
381e41f4b71Sopenharmony_ci**Return value**
382e41f4b71Sopenharmony_ci
383e41f4b71Sopenharmony_ci  | Type                              | Description                      |
384e41f4b71Sopenharmony_ci  | ---------------------------------- | -------------------------- |
385e41f4b71Sopenharmony_ci  | Promise&lt;[Volume](#volume)&gt; | Promise used to return the information about all available volume devices.|
386e41f4b71Sopenharmony_ci
387e41f4b71Sopenharmony_ci**Error codes**
388e41f4b71Sopenharmony_ci
389e41f4b71Sopenharmony_ciFor details about the error codes, see [File Management Error Codes](errorcode-filemanagement.md).
390e41f4b71Sopenharmony_ci
391e41f4b71Sopenharmony_ci| ID| Error Message|
392e41f4b71Sopenharmony_ci| -------- | -------- |
393e41f4b71Sopenharmony_ci| 201 | Permission verification failed. |
394e41f4b71Sopenharmony_ci| 202 | The caller is not a system application. |
395e41f4b71Sopenharmony_ci| 401 | The input parameter is invalid. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
396e41f4b71Sopenharmony_ci| 13600001 | IPC error. |
397e41f4b71Sopenharmony_ci| 13600008 | No such object. |
398e41f4b71Sopenharmony_ci| 13900042 | Unknown error. |
399e41f4b71Sopenharmony_ci
400e41f4b71Sopenharmony_ci**Example**
401e41f4b71Sopenharmony_ci
402e41f4b71Sopenharmony_ci  ```ts
403e41f4b71Sopenharmony_ci  import { BusinessError } from '@ohos.base';
404e41f4b71Sopenharmony_ci  let volumeId: string = "";
405e41f4b71Sopenharmony_ci  volumemanager.getVolumeById(volumeId).then((volume: volumemanager.Volume) => {
406e41f4b71Sopenharmony_ci    console.info("getVolumeById successfully:" + JSON.stringify(volume));
407e41f4b71Sopenharmony_ci  }).catch((error: BusinessError) => {
408e41f4b71Sopenharmony_ci    console.error("getVolumeById failed with error:" + JSON.stringify(error));
409e41f4b71Sopenharmony_ci  });
410e41f4b71Sopenharmony_ci  ```
411e41f4b71Sopenharmony_ci
412e41f4b71Sopenharmony_ci## volumemanager.getVolumeById
413e41f4b71Sopenharmony_ci
414e41f4b71Sopenharmony_cigetVolumeById(volumeId: string, callback: AsyncCallback&lt;Volume&gt;): void
415e41f4b71Sopenharmony_ci
416e41f4b71Sopenharmony_ciObtains information about a volume based on the volume ID. This API uses an asynchronous callback to return the result.
417e41f4b71Sopenharmony_ci
418e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.STORAGE_MANAGER
419e41f4b71Sopenharmony_ci
420e41f4b71Sopenharmony_ci**System capability**: SystemCapability.FileManagement.StorageService.Volume
421e41f4b71Sopenharmony_ci
422e41f4b71Sopenharmony_ci**Parameters**
423e41f4b71Sopenharmony_ci
424e41f4b71Sopenharmony_ci  | Name  | Type                     | Mandatory| Description                         |
425e41f4b71Sopenharmony_ci  | -------- | ------------------------- | ---- | ----------------------------- |
426e41f4b71Sopenharmony_ci  | volumeId | string                    | Yes  | Volume ID.               |
427e41f4b71Sopenharmony_ci  | callback | AsyncCallback&lt;[Volume](#volume)&gt; | Yes  | Callback used to return the volume information obtained. |
428e41f4b71Sopenharmony_ci
429e41f4b71Sopenharmony_ci**Error codes**
430e41f4b71Sopenharmony_ci
431e41f4b71Sopenharmony_ciFor details about the error codes, see [File Management Error Codes](errorcode-filemanagement.md).
432e41f4b71Sopenharmony_ci
433e41f4b71Sopenharmony_ci| ID| Error Message|
434e41f4b71Sopenharmony_ci| -------- | -------- |
435e41f4b71Sopenharmony_ci| 201 | Permission verification failed. |
436e41f4b71Sopenharmony_ci| 202 | The caller is not a system application. |
437e41f4b71Sopenharmony_ci| 401 | The input parameter is invalid. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
438e41f4b71Sopenharmony_ci| 13600001 | IPC error. |
439e41f4b71Sopenharmony_ci| 13600008 | No such object. |
440e41f4b71Sopenharmony_ci| 13900042 | Unknown error. |
441e41f4b71Sopenharmony_ci
442e41f4b71Sopenharmony_ci**Example**
443e41f4b71Sopenharmony_ci
444e41f4b71Sopenharmony_ci  ```ts
445e41f4b71Sopenharmony_ci  import { BusinessError } from '@ohos.base';
446e41f4b71Sopenharmony_ci  let volumeId: string = "";
447e41f4b71Sopenharmony_ci  volumemanager.getVolumeById(volumeId, (error: BusinessError, volume: volumemanager.Volume) => {
448e41f4b71Sopenharmony_ci    // Do something.   
449e41f4b71Sopenharmony_ci  });
450e41f4b71Sopenharmony_ci  ```
451e41f4b71Sopenharmony_ci
452e41f4b71Sopenharmony_ci## volumemanager.setVolumeDescription
453e41f4b71Sopenharmony_ci
454e41f4b71Sopenharmony_cisetVolumeDescription(uuid: string, description: string): Promise&lt;void&gt;
455e41f4b71Sopenharmony_ci
456e41f4b71Sopenharmony_ciSets volume description. This API uses a promise to return the result.
457e41f4b71Sopenharmony_ci
458e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER
459e41f4b71Sopenharmony_ci
460e41f4b71Sopenharmony_ci**System capability**: SystemCapability.FileManagement.StorageService.Volume
461e41f4b71Sopenharmony_ci
462e41f4b71Sopenharmony_ci**Parameters**
463e41f4b71Sopenharmony_ci
464e41f4b71Sopenharmony_ci  | Name    | Type  | Mandatory| Description|
465e41f4b71Sopenharmony_ci  | --------- | ------ | ---- | ---- |
466e41f4b71Sopenharmony_ci  | uuid      | string | Yes  | UUID of the volume.|
467e41f4b71Sopenharmony_ci  | description | string | Yes  | Volume description to set.|
468e41f4b71Sopenharmony_ci
469e41f4b71Sopenharmony_ci**Return value**
470e41f4b71Sopenharmony_ci
471e41f4b71Sopenharmony_ci  | Type                   | Description                      |
472e41f4b71Sopenharmony_ci  | ---------------------- | -------------------------- |
473e41f4b71Sopenharmony_ci  | Promise&lt;void&gt; | Promise that returns no value.                 |
474e41f4b71Sopenharmony_ci
475e41f4b71Sopenharmony_ci**Error codes**
476e41f4b71Sopenharmony_ci
477e41f4b71Sopenharmony_ciFor details about the error codes, see [File Management Error Codes](errorcode-filemanagement.md).
478e41f4b71Sopenharmony_ci
479e41f4b71Sopenharmony_ci| ID| Error Message|
480e41f4b71Sopenharmony_ci| -------- | -------- |
481e41f4b71Sopenharmony_ci| 201 | Permission verification failed. |
482e41f4b71Sopenharmony_ci| 202 | The caller is not a system application. |
483e41f4b71Sopenharmony_ci| 401 | The input parameter is invalid. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
484e41f4b71Sopenharmony_ci| 13600001 | IPC error. |
485e41f4b71Sopenharmony_ci| 13600002 | Not supported filesystem. |
486e41f4b71Sopenharmony_ci| 13600005 | Incorrect volume state. |
487e41f4b71Sopenharmony_ci| 13600008 | No such object. |
488e41f4b71Sopenharmony_ci| 13900042 | Unknown error. |
489e41f4b71Sopenharmony_ci
490e41f4b71Sopenharmony_ci**Example**
491e41f4b71Sopenharmony_ci
492e41f4b71Sopenharmony_ci  ```ts
493e41f4b71Sopenharmony_ci  import { BusinessError } from '@ohos.base';
494e41f4b71Sopenharmony_ci  let uuid: string = "";
495e41f4b71Sopenharmony_ci  let description: string = "";
496e41f4b71Sopenharmony_ci  volumemanager.setVolumeDescription(uuid, description).then(() => {
497e41f4b71Sopenharmony_ci    console.info("setVolumeDescription successfully");
498e41f4b71Sopenharmony_ci  }).catch((error: BusinessError) => {
499e41f4b71Sopenharmony_ci    console.error("setVolumeDescription failed with error:" + JSON.stringify(error));
500e41f4b71Sopenharmony_ci  });
501e41f4b71Sopenharmony_ci  ```
502e41f4b71Sopenharmony_ci
503e41f4b71Sopenharmony_ci## volumemanager.setVolumeDescription
504e41f4b71Sopenharmony_ci
505e41f4b71Sopenharmony_cisetVolumeDescription(uuid: string, description: string, callback: AsyncCallback&lt;void&gt;): void
506e41f4b71Sopenharmony_ci
507e41f4b71Sopenharmony_ciSets volume description. This API uses an asynchronous callback to return the result.
508e41f4b71Sopenharmony_ci
509e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER
510e41f4b71Sopenharmony_ci
511e41f4b71Sopenharmony_ci**System capability**: SystemCapability.FileManagement.StorageService.Volume
512e41f4b71Sopenharmony_ci
513e41f4b71Sopenharmony_ci**Parameters**
514e41f4b71Sopenharmony_ci
515e41f4b71Sopenharmony_ci  | Name     | Type                                    | Mandatory| Description             |
516e41f4b71Sopenharmony_ci  | ---------- | --------------------------------------- | ---- | ---------------- |
517e41f4b71Sopenharmony_ci  | uuid       | string                                  | Yes  | UUID of the volume.           |
518e41f4b71Sopenharmony_ci  | description | string                                 | Yes  | Volume description to set.           |
519e41f4b71Sopenharmony_ci  | callback   | AsyncCallback&lt;void&gt;   | Yes  | Callback that returns no value.|
520e41f4b71Sopenharmony_ci
521e41f4b71Sopenharmony_ci**Error codes**
522e41f4b71Sopenharmony_ci
523e41f4b71Sopenharmony_ciFor details about the error codes, see [File Management Error Codes](errorcode-filemanagement.md).
524e41f4b71Sopenharmony_ci
525e41f4b71Sopenharmony_ci| ID| Error Message|
526e41f4b71Sopenharmony_ci| -------- | -------- |
527e41f4b71Sopenharmony_ci| 201 | Permission verification failed. |
528e41f4b71Sopenharmony_ci| 202 | The caller is not a system application. |
529e41f4b71Sopenharmony_ci| 401 | The input parameter is invalid. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
530e41f4b71Sopenharmony_ci| 13600001 | IPC error. |
531e41f4b71Sopenharmony_ci| 13600002 | Not supported filesystem. |
532e41f4b71Sopenharmony_ci| 13600005 | Incorrect volume state. |
533e41f4b71Sopenharmony_ci| 13600008 | No such object. |
534e41f4b71Sopenharmony_ci| 13900042 | Unknown error. |
535e41f4b71Sopenharmony_ci
536e41f4b71Sopenharmony_ci**Example**
537e41f4b71Sopenharmony_ci
538e41f4b71Sopenharmony_ci  ```ts
539e41f4b71Sopenharmony_ci  import { BusinessError } from '@ohos.base';
540e41f4b71Sopenharmony_ci  let uuid: string = "";
541e41f4b71Sopenharmony_ci  let description: string = "";
542e41f4b71Sopenharmony_ci  volumemanager.setVolumeDescription(uuid, description, (error: BusinessError) => {
543e41f4b71Sopenharmony_ci    // Do something.   
544e41f4b71Sopenharmony_ci  });
545e41f4b71Sopenharmony_ci  ```
546e41f4b71Sopenharmony_ci
547e41f4b71Sopenharmony_ci## volumemanager.format
548e41f4b71Sopenharmony_ci
549e41f4b71Sopenharmony_ciformat(volumeId: string, fsType: string): Promise&lt;void&gt;
550e41f4b71Sopenharmony_ci
551e41f4b71Sopenharmony_ciFormats a volume. This API uses a promise to return the result. Currently, only the virtual file allocation table (VFAT) and exFAT file systems are supported. Only unmounted volumes can be formatted. After a volume is formatted, the UUID, mounting path, and description of the volume change.
552e41f4b71Sopenharmony_ci
553e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.MOUNT_FORMAT_MANAGER
554e41f4b71Sopenharmony_ci
555e41f4b71Sopenharmony_ci**System capability**: SystemCapability.FileManagement.StorageService.Volume
556e41f4b71Sopenharmony_ci
557e41f4b71Sopenharmony_ci**Parameters**
558e41f4b71Sopenharmony_ci
559e41f4b71Sopenharmony_ci  | Name      | Type  | Mandatory| Description|
560e41f4b71Sopenharmony_ci  | ----------- | ------ | ---- | ---- |
561e41f4b71Sopenharmony_ci  | volumeId    | string | Yes  | Volume ID.|
562e41f4b71Sopenharmony_ci  | fsType    | string | Yes  | File system type, which can be VFAT or exFAT.|
563e41f4b71Sopenharmony_ci
564e41f4b71Sopenharmony_ci**Return value**
565e41f4b71Sopenharmony_ci
566e41f4b71Sopenharmony_ci  | Type                  | Description      |
567e41f4b71Sopenharmony_ci  | ---------------------- | ---------- |
568e41f4b71Sopenharmony_ci  | Promise&lt;void&gt; | Promise that returns no value.|
569e41f4b71Sopenharmony_ci
570e41f4b71Sopenharmony_ci**Error codes**
571e41f4b71Sopenharmony_ci
572e41f4b71Sopenharmony_ciFor details about the error codes, see [File Management Error Codes](errorcode-filemanagement.md).
573e41f4b71Sopenharmony_ci
574e41f4b71Sopenharmony_ci| ID| Error Message|
575e41f4b71Sopenharmony_ci| -------- | -------- |
576e41f4b71Sopenharmony_ci| 201 | Permission verification failed. |
577e41f4b71Sopenharmony_ci| 202 | The caller is not a system application. |
578e41f4b71Sopenharmony_ci| 401 | The input parameter is invalid. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
579e41f4b71Sopenharmony_ci| 13600001 | IPC error. |
580e41f4b71Sopenharmony_ci| 13600002 | Not supported filesystem. |
581e41f4b71Sopenharmony_ci| 13600005 | Incorrect volume state. |
582e41f4b71Sopenharmony_ci| 13600008 | No such object. |
583e41f4b71Sopenharmony_ci| 13900042 | Unknown error. |
584e41f4b71Sopenharmony_ci
585e41f4b71Sopenharmony_ci**Example**
586e41f4b71Sopenharmony_ci
587e41f4b71Sopenharmony_ci  ```ts
588e41f4b71Sopenharmony_ci  import { BusinessError } from '@ohos.base';
589e41f4b71Sopenharmony_ci  let volumeId: string = "";
590e41f4b71Sopenharmony_ci  let fsType: string = "";
591e41f4b71Sopenharmony_ci  volumemanager.format(volumeId, fsType).then(() => {
592e41f4b71Sopenharmony_ci    console.info("format successfully");
593e41f4b71Sopenharmony_ci  }).catch((error: BusinessError) => {
594e41f4b71Sopenharmony_ci    console.error("format failed with error:" + JSON.stringify(error));
595e41f4b71Sopenharmony_ci  });
596e41f4b71Sopenharmony_ci  ```
597e41f4b71Sopenharmony_ci
598e41f4b71Sopenharmony_ci## volumemanager.format
599e41f4b71Sopenharmony_ci
600e41f4b71Sopenharmony_ciformat(volumeId: string, fsType: string, callback: AsyncCallback&lt;void&gt;): void
601e41f4b71Sopenharmony_ci
602e41f4b71Sopenharmony_ciFormats a volume. This API uses an asynchronous callback to return the result. Currently, only the VFAT and exFAT file systems are supported. Only unmounted volumes can be formatted. After a volume is formatted, the UUID, mounting path, and description of the volume change.
603e41f4b71Sopenharmony_ci
604e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.MOUNT_FORMAT_MANAGER
605e41f4b71Sopenharmony_ci
606e41f4b71Sopenharmony_ci**System capability**: SystemCapability.FileManagement.StorageService.Volume
607e41f4b71Sopenharmony_ci
608e41f4b71Sopenharmony_ci**Parameters**
609e41f4b71Sopenharmony_ci
610e41f4b71Sopenharmony_ci  | Name  | Type                     | Mandatory| Description                         |
611e41f4b71Sopenharmony_ci  | -------- | ------------------------- | ---- | ----------------------------- |
612e41f4b71Sopenharmony_ci  | volumeId | string                    | Yes  | Volume ID.               |
613e41f4b71Sopenharmony_ci  | fsType    | string | Yes  | File system type, which can be VFAT or exFAT.|
614e41f4b71Sopenharmony_ci  | callback | AsyncCallback&lt;void&gt;  | Yes  | Callback that returns no value. |
615e41f4b71Sopenharmony_ci
616e41f4b71Sopenharmony_ci**Error codes**
617e41f4b71Sopenharmony_ci
618e41f4b71Sopenharmony_ciFor details about the error codes, see [File Management Error Codes](errorcode-filemanagement.md).
619e41f4b71Sopenharmony_ci
620e41f4b71Sopenharmony_ci| ID| Error Message|
621e41f4b71Sopenharmony_ci| -------- | -------- |
622e41f4b71Sopenharmony_ci| 201 | Permission verification failed. |
623e41f4b71Sopenharmony_ci| 202 | The caller is not a system application. |
624e41f4b71Sopenharmony_ci| 401 | The input parameter is invalid. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
625e41f4b71Sopenharmony_ci| 13600001 | IPC error. |
626e41f4b71Sopenharmony_ci| 13600002 | Not supported filesystem. |
627e41f4b71Sopenharmony_ci| 13600005 | Incorrect volume state. |
628e41f4b71Sopenharmony_ci| 13600008 | No such object. |
629e41f4b71Sopenharmony_ci| 13900042 | Unknown error. |
630e41f4b71Sopenharmony_ci
631e41f4b71Sopenharmony_ci**Example**
632e41f4b71Sopenharmony_ci
633e41f4b71Sopenharmony_ci  ```ts
634e41f4b71Sopenharmony_ci  import { BusinessError } from '@ohos.base';
635e41f4b71Sopenharmony_ci  let volumeId: string = "";
636e41f4b71Sopenharmony_ci  let fsType: string = "";
637e41f4b71Sopenharmony_ci  volumemanager.format(volumeId, fsType, (error: BusinessError) => {
638e41f4b71Sopenharmony_ci    // Do something.   
639e41f4b71Sopenharmony_ci  });
640e41f4b71Sopenharmony_ci  ```
641e41f4b71Sopenharmony_ci
642e41f4b71Sopenharmony_ci## volumemanager.partition
643e41f4b71Sopenharmony_ci
644e41f4b71Sopenharmony_cipartition(diskId: string, type: number): Promise&lt;void&gt;
645e41f4b71Sopenharmony_ci
646e41f4b71Sopenharmony_ciPartitions a disk. This API uses a promise to return the result. The system supports access to multi-partition disks. Currently, this API can partition a disk into only one partition.
647e41f4b71Sopenharmony_ci
648e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.MOUNT_FORMAT_MANAGER
649e41f4b71Sopenharmony_ci
650e41f4b71Sopenharmony_ci**System capability**: SystemCapability.FileManagement.StorageService.Volume
651e41f4b71Sopenharmony_ci
652e41f4b71Sopenharmony_ci**Parameters**
653e41f4b71Sopenharmony_ci
654e41f4b71Sopenharmony_ci  | Name      | Type  | Mandatory| Description|
655e41f4b71Sopenharmony_ci  | ----------- | ------ | ---- | ---- |
656e41f4b71Sopenharmony_ci  | diskId    | string | Yes  | ID of the disk to partition.|
657e41f4b71Sopenharmony_ci  | type      | number | Yes  | Partition type.   |
658e41f4b71Sopenharmony_ci
659e41f4b71Sopenharmony_ci**Return value**
660e41f4b71Sopenharmony_ci
661e41f4b71Sopenharmony_ci  | Type                     | Description                      |
662e41f4b71Sopenharmony_ci   | --------------------- | ----------------------- |
663e41f4b71Sopenharmony_ci  | Promise&lt;void&gt;   | Promise that returns no value.             |
664e41f4b71Sopenharmony_ci
665e41f4b71Sopenharmony_ci**Error codes**
666e41f4b71Sopenharmony_ci
667e41f4b71Sopenharmony_ciFor details about the error codes, see [File Management Error Codes](errorcode-filemanagement.md).
668e41f4b71Sopenharmony_ci
669e41f4b71Sopenharmony_ci| ID| Error Message|
670e41f4b71Sopenharmony_ci| -------- | -------- |
671e41f4b71Sopenharmony_ci| 201 | Permission verification failed. |
672e41f4b71Sopenharmony_ci| 202 | The caller is not a system application. |
673e41f4b71Sopenharmony_ci| 401 | The input parameter is invalid. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
674e41f4b71Sopenharmony_ci| 13600001 | IPC error. |
675e41f4b71Sopenharmony_ci| 13600008 | No such object. |
676e41f4b71Sopenharmony_ci| 13900042 | Unknown error. |
677e41f4b71Sopenharmony_ci
678e41f4b71Sopenharmony_ci**Example**
679e41f4b71Sopenharmony_ci
680e41f4b71Sopenharmony_ci  ```ts
681e41f4b71Sopenharmony_ci  import { BusinessError } from '@ohos.base';
682e41f4b71Sopenharmony_ci  let diskId: string = "";
683e41f4b71Sopenharmony_ci  let type: number = 0;
684e41f4b71Sopenharmony_ci  volumemanager.partition(diskId, type).then(() => {
685e41f4b71Sopenharmony_ci    console.info("partition successfully");
686e41f4b71Sopenharmony_ci  }).catch((error: BusinessError) => {
687e41f4b71Sopenharmony_ci    console.error("partition failed with error:" + JSON.stringify(error));
688e41f4b71Sopenharmony_ci  });
689e41f4b71Sopenharmony_ci  ```
690e41f4b71Sopenharmony_ci
691e41f4b71Sopenharmony_ci## volumemanager.partition
692e41f4b71Sopenharmony_ci
693e41f4b71Sopenharmony_cipartition(diskId: string, type: number, callback: AsyncCallback&lt;void&gt;): void
694e41f4b71Sopenharmony_ci
695e41f4b71Sopenharmony_ciPartitions a disk. This API uses a callback to return the result. The system supports access to multi-partition disks. Currently, this API can partition a disk into only one partition.
696e41f4b71Sopenharmony_ci
697e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.MOUNT_FORMAT_MANAGER
698e41f4b71Sopenharmony_ci
699e41f4b71Sopenharmony_ci**System capability**: SystemCapability.FileManagement.StorageService.Volume
700e41f4b71Sopenharmony_ci
701e41f4b71Sopenharmony_ci**Parameters**
702e41f4b71Sopenharmony_ci
703e41f4b71Sopenharmony_ci  | Name     | Type                                  | Mandatory| Description             |
704e41f4b71Sopenharmony_ci  | -------- | --------------------------------------- | ---- | ---------------- |
705e41f4b71Sopenharmony_ci  | diskId   | string                                  | Yes  | ID of the disk to partition.     |
706e41f4b71Sopenharmony_ci  | type     | number                                  | Yes  | Partition type.          |
707e41f4b71Sopenharmony_ci  | callback | AsyncCallback&lt;void&gt;   | Yes  | Callback that returns no value.     |
708e41f4b71Sopenharmony_ci
709e41f4b71Sopenharmony_ci**Error codes**
710e41f4b71Sopenharmony_ci
711e41f4b71Sopenharmony_ciFor details about the error codes, see [File Management Error Codes](errorcode-filemanagement.md).
712e41f4b71Sopenharmony_ci
713e41f4b71Sopenharmony_ci| ID| Error Message|
714e41f4b71Sopenharmony_ci| -------- | -------- |
715e41f4b71Sopenharmony_ci| 201 | Permission verification failed. |
716e41f4b71Sopenharmony_ci| 202 | The caller is not a system application. |
717e41f4b71Sopenharmony_ci| 401 | The input parameter is invalid. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
718e41f4b71Sopenharmony_ci| 13600001 | IPC error. |
719e41f4b71Sopenharmony_ci| 13600008 | No such object. |
720e41f4b71Sopenharmony_ci| 13900042 | Unknown error. |
721e41f4b71Sopenharmony_ci
722e41f4b71Sopenharmony_ci**Example**
723e41f4b71Sopenharmony_ci
724e41f4b71Sopenharmony_ci  ```ts
725e41f4b71Sopenharmony_ci  import { BusinessError } from '@ohos.base';
726e41f4b71Sopenharmony_ci  let diskId: string = "";
727e41f4b71Sopenharmony_ci  let type: number = 0;
728e41f4b71Sopenharmony_ci  volumemanager.partition(diskId, type, (error: BusinessError) => {
729e41f4b71Sopenharmony_ci    // Do something.   
730e41f4b71Sopenharmony_ci  });
731e41f4b71Sopenharmony_ci  ```
732e41f4b71Sopenharmony_ci
733e41f4b71Sopenharmony_ci## Volume
734e41f4b71Sopenharmony_ci
735e41f4b71Sopenharmony_ci**System capability**: SystemCapability.FileManagement.StorageService.Volume
736e41f4b71Sopenharmony_ci
737e41f4b71Sopenharmony_ci### Properties
738e41f4b71Sopenharmony_ci
739e41f4b71Sopenharmony_ci| Name        | Type   | Read-Only  | Writable  | Description                |
740e41f4b71Sopenharmony_ci| ----------- | ------- | ------- | ----- | -------------------- |
741e41f4b71Sopenharmony_ci| id          | string  | Yes| No| Volume ID, in the vol-{Primary device ID}-{Secondary device ID} format. The primary device IDs identify devices of different types. The secondary device IDs identify different devices of the same type. The volume IDs vary depending on the card insertion sequence.                |
742e41f4b71Sopenharmony_ci| uuid        | string  | Yes| No| Volume UUID, which uniquely identifies a volume irrespective of the card insertion sequence. However, the UUID of a volume will change after the volume is formatted.              |
743e41f4b71Sopenharmony_ci| diskId      | string  | Yes| No| ID of the disk to which the volume belongs. A disk can have one or more volumes. The disk ID is in the disk-{Primary device ID}-{Secondary device ID} format, which is similar to the volume ID.       |
744e41f4b71Sopenharmony_ci| description | string  | Yes| No| Description of the volume.          |
745e41f4b71Sopenharmony_ci| removable   | boolean | Yes| No| Whether the volume can be removed. Currently, only removable storage devices are supported. The value **true** means the device can be removed; the value **false** means the opposite.|
746e41f4b71Sopenharmony_ci| state       | number  | Yes| No| Volume status.<br>**0**: The volume is unmounted.<br> **1**: The volume is being checked.<br> **2**: The volume is mounted.<br> **3**: The volume is being ejected.         |
747e41f4b71Sopenharmony_ci| path        | string  | Yes| No| Path of the volume mounted. Generally, the path is **/mnt/data/external/{uuid}**.        |
748e41f4b71Sopenharmony_ci| fsType<sup>12+</sup>        | string  | Yes| No| File system type. Common file systems are **ext2**, **vfat**, and **NTFS**.      |
749