Score:0

linux + extend (grow) root file systems without downtime on RHEL production machines

gb flag

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?

John Mahowald avatar
cn flag
What was the history of PVs sda3 and sd4? At 10 GB each, can you confirm they are size extensions of a simple linear volume? Could be the opportunity to consolidate with pvmove and simplify the number of partitions.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.