Mac OS X 分区相关操作

1.diskutil list查看硬盘分区;

xiaqiangdeMacBook-Pro:~ xiaqiang$ diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *121.3 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:          Apple_CoreStorage Macintosh HD            60.4 GB    disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
   4:         Microsoft Reserved                         16.8 MB    disk0s4
   5:                  Apple_HFS BOOTCAMP                60.0 GB    disk0s5
/dev/disk1 (internal, virtual):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                  Apple_HFS Macintosh HD           +60.0 GB    disk1
                                 Logical Volume on disk0s2
                                 3802161B-56DA-42B2-BAC3-4269F1E91DF6
                                 Unencrypted

2.diskutil eraseVolume JHFS+ BOOT disk0s5 格式化磁盘分区,BOOT是卷的名称,这个随便命名,disk0s5是你要删除的分区的编号;

xiaqiangdeMacBook-Pro:~ xiaqiang$ diskutil eraseVolume JHFS+ BOOT disk0s5
Started erase on disk0s5 BOOTCAMP
Unmounting disk
Erasing
Initialized /dev/rdisk0s5 as a 56 GB case-insensitive HFS Plus volume with a 8192k journal
Mounting disk
Finished erase on disk0s5 BOOT

3.diskutil mergePartitions HFS+ Macintosh HD disk1 disk0s5 合并两个分区,后面disk0s5这个是你要删除的分区,前面那个是要把删除分区合并到的分区;

//合并分区的命令是正确的,在这里这个结果是提示这个磁盘没有提供改变大小的功能;eg:如果disk1原来的大小为40GB,disk0s5原来大小为620MB,那执行完这条命令语句后就是删除了disk0s5的分区,将disk0s5的大小合并到disk1分区上面,此时合并后disk1的大小就为40.5GB;

xiaqiangdeMacBook-Pro:~ xiaqiang$ diskutil mergePartitions JHFS+ Macintosh disk0s2 disk0s5
The chosen disk does not support resizing.
Do you wish to format instead? (y/N) y
Merging partitions into a new partition
     Start partition: disk0s2
     Finish partition: disk0s5 BOOT

Merging partitions encountered error "Invalid request (-69886)".
The erase will not occur.

你可能感兴趣的:(Mac,OS,X)