今天在网上查找分区方法,发现都是用的fdisk,但自己使用总是出错,后来请求大神帮忙,发现了一个好用的工具,这里把具体的使用过程记录下来。
[root@pc160 ~]# parted /dev/sda
GNU Parted 3.1
使用 /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
错误: The backup GPT table is corrupt, but the primary appears OK, so that will be used.
确认/OK/放弃/Cancel? ok
警告: Not all of the space available to /dev/sda appears to be used, you can fix the GPT to use all of the space (an extra 1828479744 blocks) or continue with the current setting?
修正/Fix/忽略/Ignore? fix
Model: ATA ST1000DM010-2EP1 (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name 标志
1 1049kB 211MB 210MB fat16 EFI System Partition 启动
2 211MB 735MB 524MB xfs
3 735MB 64.0GB 63.3GB lvm
(parted) p
Model: ATA ST1000DM010-2EP1 (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name 标志
1 1049kB 211MB 210MB fat16 EFI System Partition 启动
2 211MB 735MB 524MB xfs
3 735MB 64.0GB 63.3GB lvm
(parted) n
分区编号? 4
错误: 分区不存在。
(parted) help
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
(parted) mkpart
分区名称? []?
文件系统类型? [ext2]?
起始点?
起始点?
起始点?
起始点? oo
错误: Invalid number.
(parted) free
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
(parted) print free
Model: ATA ST1000DM010-2EP1 (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name 标志
17.4kB 1049kB 1031kB Free Space
1 1049kB 211MB 210MB fat16 EFI System Partition 启动
2 211MB 735MB 524MB xfs
3 735MB 64.0GB 63.3GB lvm
64.0GB 1000GB 936GB Free Space
(parted) mkpart
分区名称? []?
文件系统类型? [ext2]?
起始点? 64GB
结束点? 1000GB
(parted) p
Model: ATA ST1000DM010-2EP1 (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name 标志
1 1049kB 211MB 210MB fat16 EFI System Partition 启动
2 211MB 735MB 524MB xfs
3 735MB 64.0GB 63.3GB lvm
4 64.0GB 1000GB 936GB
(parted) help
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
(parted)
(parted) quit
信息: You may need to update /etc/fstab.
[root@pc160 ~]# part
parted partprobe partx
[root@pc160 ~]# partprobe
[root@pc160 ~]# fdisk -l
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
磁盘 /dev/sda:1000.2 GB, 1000204886016 字节,1953525168 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 4096 字节
I/O 大小(最小/最佳):4096 字节 / 4096 字节
磁盘标签类型:gpt
# Start End Size Type Name
1 2048 411647 200M EFI System EFI System Partition
2 411648 1435647 500M Microsoft basic
3 1435648 125044735 59G Linux LVM
4 125044736 1953523711 871.9G Microsoft basic
磁盘 /dev/mapper/rhel-root:38.2 GB, 38176555008 字节,74563584 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 4096 字节
I/O 大小(最小/最佳):4096 字节 / 4096 字节
磁盘 /dev/mapper/rhel-swap:6404 MB, 6404702208 字节,12509184 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 4096 字节
I/O 大小(最小/最佳):4096 字节 / 4096 字节
磁盘 /dev/mapper/rhel-home:18.6 GB, 18639486976 字节,36405248 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 4096 字节
I/O 大小(最小/最佳):4096 字节 / 4096 字节
[root@pc160 ~]#