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