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 list,看到结束分区为35.6G,使用命令mkpart extended ,输入起始分区36G,输入结束分区107G,使用partprobe /dev/sda更新分区表
使用命令cat /proc/partitions查看是否新增扩展分区/dev/sda3
使用fdisk /dev/sda进行分区,新增30G空间进来/dev/sda5
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 411647 204800 83 Linux
/dev/sda2 411648 63916031 31752192 8e Linux LVM
/dev/sda3 70311936 209715199 69701632 f W95 Ext‘d (LBA)
/dev/sda4 64530432 68724735 2097152 8e Linux LVM
/dev/sda5 70313984 133228543 31457280 83 Linux
接下来使用pvcreate /dev/sda5新增pv
使用vgextend rhel /dev/sda5扩展vg
vgextend rhel /dev/sda5
使用lvextend扩展根分区大小,从/dev/sda5中划分空间
lvextend -L +10G /dev/rhel/root /dev/sda5
使用系统自带的xfs_info查看扇区信息,可以看到每个块为4KB,将10G换算成块为2621440,加上原有的就是5181440
xfs_growfs -D 5242880 /dev/mapper/rhel-root
再使用命令df -h查看挂载情况
[root@server ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel-root 20G 631M 20G 4% /
devtmpfs 912M 0 912M 0% /dev
tmpfs 921M 164K 921M 1% /dev/shm
tmpfs 921M 9.0M 912M 1% /run
tmpfs 921M 0 921M 0% /sys/fs/cgroup
/dev/mapper/rhel-usr 5.0G 4.2G 834M 84% /usr
/dev/mapper/rhel-home 4.9G 115M 4.8G 3% /home
/dev/mapper/rhel-var 9.8G 515M 9.3G 6% /var
/dev/sda1 197M 89M 109M 45% /boot
根目录已经扩展到20G,后续如果新增可以从扩展分区中新增分区,再按此操作方法增回。
如果fdisk命令无法使用RedHat的所有分区,那么对RedHat进行重新分区就失去了意义,使用上面的方法就可以让fdisk命令使用全部的四个分区。
……