Filesystem/Partition expansion using parted
Before expansion FS details
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 450G 0 disk
├─sda1 8:1 0 1G 0 part /boot
├─sda2 8:2 0 500M 0 part /boot/efi
└─sda3 8:3 0 440.9G 0 part
├─vg_root-lv_lv1 254:0 0 16G 0 lvm [SWAP]
├─vg_root-lv_lv2 254:1 0 40G 0 lvm /
├─vg_root-lv_lv3 254:2 0 15G 0 lvm /lv3
├─vg_root-lv_lv4 254:3 0 317G 0 lvm /lv4
└─vg_root-lv_lv5 254:4 0 50G 0 lvm /lv5
sr0 11:0 1 1024M 0 rom
After expanding disk from VM , run below command to expand in OS
# echo + >> /sys/block/sda/device/rescan
After expansion FS details
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 700G 0 disk
├─sda1 8:1 0 1G 0 part /boot
├─sda2 8:2 0 500M 0 part /boot/efi
└─sda3 8:3 0 440.9G 0 part
├─vg_root-lv_lv1 254:0 0 16G 0 lvm [SWAP]
├─vg_root-lv_lv2 254:1 0 40G 0 lvm /
├─vg_root-lv_lv3 254:2 0 15G 0 lvm /lv3
├─vg_root-lv_lv4 254:3 0 317G 0 lvm /lv4
└─vg_root-lv_lv5 254:4 0 50G 0 lvm /lv5
sr0 11:0 1 1024M 0 rom
Stesp to expand FS using parted
# parted /dev/sda
GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) resizepart
Warning: 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 524288000 blocks) or continue with the
current setting?
Fix/Ignore? Fix
Partition number? 3
End? [475GB]? 700000 --- size in MB
(parted) print
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 752GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 1075MB 1074MB xfs
2 1075MB 1599MB 524MB fat16 msftdata
3 1599MB 700GB 698GB lvm
(parted) q
Information: You may need to update /etc/fstab.
PV resize to add free space to VG
# pvresize /dev/sda3
Physical volume "/dev/sda3" changed
1 physical volume(s) resized or updated / 0 physical volume(s) not resized
# vgs
VG #PV #LV #SN Attr VSize VFree
vg_root 1 5 0 wz--n- 650.43g 212.43g
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 700G 0 disk
├─sda1 8:1 0 1G 0 part /boot
├─sda2 8:2 0 500M 0 part /boot/efi
└─sda3 8:3 0 650.4G 0 part
├─vg_root-lv_lv1 254:0 0 16G 0 lvm [SWAP]
├─vg_root-lv_lv2 254:1 0 40G 0 lvm /
├─vg_root-lv_lv3 254:2 0 15G 0 lvm /lv3
├─vg_root-lv_lv4 254:3 0 317G 0 lvm /lv4
└─vg_root-lv_lv5 254:4 0 50G 0 lvm /lv5
sr0 11:0 1 1024M 0 rom
LV expansion:
# lvextend -L +150G /dev/mapper/vg_root-lv_lv5
Size of logical volume vg_root/lv_lv5 changed from 317.00 GiB (81152 extents) to 467.00 GiB (119552 extents).
Logical volume vg_root/lv_lv5 successfully resized.
# xfs_growfs /dev/mapper/vg_root-lv_lv5
meta-data=/dev/mapper/vg_root-lv_lv5 isize=512 agcount=6, agsize=16384000 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=0
= reflink=0 bigtime=0 inobtcount=0
data = bsize=4096 blocks=83099648, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=32000, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 83099648 to 122421248
After expansion FS details
# df -hT /lv5
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/vg_root-lv_lv5 xfs 467G 311G 157G 67% /lv5