parted分区

clipboard.png

[root@localhost ~]# parted
GNU Parted 3.1
使用 /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) hel
align-check TYPE N                        check partition N for TYPE(min|opt) alignment
help [COMMAND]                           print general help, or help on COMMAND
mklabel,mktable LABEL-TYPE               create a new disklabel (partition table)
mkpart PART-TYPE [FS-TYPE] START END     make a partition
name NUMBER NAME                         name partition NUMBER as NAME
print [devices|free|list,all|NUMBER]     display the partition table, available devices, free space, all found partitions, or a particular partition
quit                                     exit program
rescue START END                         rescue a lost partition near START and END
rm NUMBER                                delete partition NUMBER
select DEVICE                            choose the device to edit
disk_set FLAG STATE                      change the FLAG on selected device
disk_toggle [FLAG]                       toggle the state of FLAG on selected device
set NUMBER FLAG STATE                    change the FLAG on partition NUMBER
toggle [NUMBER [FLAG]]                   toggle the state of FLAG on partition NUMBER
unit UNIT                                set the default unit to UNIT
version                                  display the version number and copyright information of GNU
(parted) select /dev/sdc
使用 /dev/sdc
(parted) mklabel gpt
(parted) mkpart
分区名称?  []? afc
文件系统类型?  [ext2]?
起始点? 1
结束点? 2000
(parted) print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name  标志
1      1049kB  2000MB  1999MB               afc

(parted) mkpart ars 2000 3000
(parted) print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name  标志
1      1049kB  2000MB  1999MB               afc
2      2000MB  3000MB  1000MB               ars

(parted) mkpart jsfc 3000 4000
(parted) mkpart jiang 4000 5000
(parted) mkpart su 5000 6000
(parted) print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name   标志
1      1049kB  2000MB  1999MB               afc
2      2000MB  3000MB  1000MB               ars
3      3000MB  4000MB  1000MB               jsfc
4      4000MB  5000MB  999MB                jiang
5      5000MB  6000MB  1000MB               su

(parted) rm 1
(parted) rm 2
(parted) rm 3
(parted) rm 4
(parted) rm 5
(parted) print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start  End  Size  File system  Name  标志

(parted) mklabel msdos                    ## mbr格式
警告: The existing disk label on /dev/sdc will be destroyed and all data on this disk will be lost. Do you want to continue?
是/Yes/否/No? yes
(parted) print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start  End  Size  Type  File system  标志

(parted) mkpart
分区类型?  primary/主分区/extended/扩展分区? p
文件系统类型?  [ext2]?
起始点?
起始点? 0
结束点? 2000
警告: The resulting partition is not properly aligned for best performance.
忽略/Ignore/放弃/Cancel? cancel                            ##起始点不能为0
(parted) mkpart
分区类型?  primary/主分区/extended/扩展分区? p
文件系统类型?  [ext2]?
起始点? 1
结束点? 2000                                        ##分区不能用命令行模式
分区类型?  primary/主分区/extended/扩展分区? p
文件系统类型?  [ext2]?
起始点? 2000
结束点? 3000
(parted) mkpart
分区类型?  primary/主分区/extended/扩展分区?
文件系统类型?  [ext2]?
起始点? 3000
结束点? 4000
(parted) mkpart
分区类型?  primary/主分区/extended/扩展分区? e
起始点? 4000
结束点? 10000
(parted) print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type      File system  标志
1      1049kB  2000MB  1999MB  primary
2      2000MB  3000MB  1000MB  primary
3      3000MB  4000MB  1000MB  primary
4      4000MB  10.0GB  6000MB  extended               lba

(parted) mkpart
分区类型?  logical/逻辑分区? l
文件系统类型?  [ext2]?
起始点? 4000
结束点? 6000
警告: The resulting partition is not properly aligned for best performance.
忽略/Ignore/放弃/Cancel? cancel                           ##起始位置不能为4000
(parted) mkpart
分区类型?  logical/逻辑分区? l
文件系统类型?  [ext2]?
起始点? 4001
结束点? 6000
(parted) mkpart
分区类型?  logical/逻辑分区? l
文件系统类型?  [ext2]?
起始点? 6001
结束点? 10000
(parted) print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdc: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type      File system  标志
1      1049kB  2000MB  1999MB  primary
2      2000MB  3000MB  1000MB  primary
3      3000MB  4000MB  1000MB  primary
4      4000MB  10.0GB  6000MB  extended               lba
5      4001MB  6000MB  1999MB  logical
6      6001MB  10.0GB  3999MB  logical

(parted) quit##parted分区无需保存分区,退出时会自动保存
信息: You may need to update /etc/fstab.

[root@localhost ~]# fdisk -l /dev/sdc

磁盘 /dev/sdc:10.7 GB, 10737418240 字节,20971520 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x0002d0d6

设备 Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048     3905535     1951744   83  Linux
/dev/sdc2         3905536     5859327      976896   83  Linux
/dev/sdc3         5859328     7813119      976896   83  Linux
/dev/sdc4         7813120    19531775     5859328    f  W95 Ext'd (LBA)
/dev/sdc5         7815168    11718655     1951744   83  Linux
/dev/sdc6        11720704    19531775     3905536   83  Linux


猜你喜欢

转载自blog.51cto.com/11530642/2113267