I want to share the following procedure that we did on lab (RHEL 7.2 machine) in order to increase The root file system (XFS filesystem) from 130G
to 150G
Details from VM RHEL 7.2 machine are
df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolumeG_lab-lv-ROOT 130G 18G 113G 14% /
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 250G 0 disk
├─sda1 8:1 0 500M 0 part /boot
├─sda2 8:2 0 229.5G 0 part
│ ├─VolumeG_lab-lv-ROOT 253:0 0 130G 0 lvm /
│ ├─VolumeG_lab-lv_swap 253:1 0 7.7G 0 lvm
│ ├─VolumeG_lab-lv-VAR 253:2 0 100.9G 0 lvm /var
│ └─VolumeG_lab-lv_docker 253:3 0 10G 0 lvm /var/lib/docker
├─sda3 8:3 0 10G 0 part
│ └─VolumeG_lab-lv-ROOT 253:0 0 130G 0 lvm /
└─sda4 8:4 0 10G 0 part
└─VolumeG_lab-lv-ROOT 253:0 0 130G 0 lvm /
pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 VolumeG_lab lvm2 a-- 229.51g 0
/dev/sda3 VolumeG_lab lvm2 a-- 10.00g 0
/dev/sda4 VolumeG_lab lvm2 a-- 10.00g 936.00m
Based on above details we did the following:
a) we increase the OS disk from 250G
to 270G
from vSphere client (VIA edit settings)
b) rescan the OS disk as
echo 1 > /sys/block/sda/device/rescan
c) we use the parted
command to resize the partition sda4
to the full extent (100%):
parted /dev/sda
GNU Parted 3.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) resizepart
Partition number? 4
End? [376GB]? 100%
(parted) quit
Information: You may need to update /etc/fstab.
d) sda4
is used as a Physical Volume (PV) for LVM. In this case use pvresize followed by the path
pvresize /dev/sda4
e) extend & grow the root file system as:
lvextend -L+20G /dev/mapper/VolumeG_lab-lv-ROOT
xfs_growfs /dev/mapper/VolumeG_lab-lv-ROOT
Based on above procedure, now we want to do the same on production/s
machine
Since we are using parted command, I want to understand if the procedure is safety
Appreciate to get any notes / feedbacks?