Home > Storage > PowerFlex > White Papers > Dell APEX Block Storage for Azure: PostgreSQL Deployment and Performance on Kubernetes > Appendix A: Extend the Linux file system by adding a new disk
Follow the below steps to extend the ‘root’ file system partition in Linux OS:
1. Use the ‘df’ command to check the size of the file system partition. The below output shows the ‘root’ (‘/’) file system size is 2 GB.
[root@sp-lvm-extend ~]# df -lh
Filesystem Size Used Avail Use% Mounted on
devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs 7.8G 8.6M 7.8G 1% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/mapper/rootvg-rootlv 2.0G 73M 2.0G 4% /
/dev/mapper/rootvg-usrlv 10G 1.7G 8.4G 17% /usr
/dev/mapper/rootvg-tmplv 2.0G 47M 2.0G 3% /tmp
/dev/sda1 496M 106M 390M 22% /boot
/dev/mapper/rootvg-homelv 1014M 40M 975M 4% /home
/dev/mapper/rootvg-varlv 8.0G 328M 7.7G 5% /var
/dev/sda15 495M 5.9M 489M 2% /boot/efi
tmpfs 1.6G 0 1.6G 0% /run/user/1000
[root@sp-lvm-extend ~]#
2. Add a new disk to a Linux VM either using Azure CLI or Azure portal. The below output shows a new disk ‘sdc’ of size 24 GB added to the Azure Linux VM.
[root@sp-lvm-extend ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 64G 0 disk
├─sda1 8:1 0 500M 0 part /boot
├─sda2 8:2 0 63G 0 part
│ ├─rootvg-tmplv 253:0 0 2G 0 lvm /tmp
│ ├─rootvg-usrlv 253:1 0 10G 0 lvm /usr
│ ├─rootvg-homelv 253:2 0 1G 0 lvm /home
│ ├─rootvg-varlv 253:3 0 8G 0 lvm /var
│ └─rootvg-rootlv 253:4 0 2G 0 lvm /
├─sda14 8:14 0 4M 0 part
└─sda15 8:15 0 495M 0 part /boot/efi
sdb 8:16 0 32G 0 disk
└─sdb1 8:17 0 32G 0 part
sdc 8:32 0 24G 0 disk
sr0 11:0 1 628K 0 rom
[root@sp-lvm-extend ~]#
3. Add the new disk 'sdc' to the physical volume.
[root@sp-lvm-extend ~]# pvcreate /dev/sdc
Physical volume "/dev/sdc" successfully created.
[root@sp-lvm-extend ~]#
4. Verify that a physical volume was created successfully using "lvmdiskscan" command:
[root@sp-lvm-extend ~]# lvmdiskscan -l
WARNING: only considering LVM devices
/dev/sda2 [ 63.02 GiB] LVM physical volume
/dev/sdc [ 24.00 GiB] LVM physical volume
1 LVM physical volume whole disk
1 LVM physical volume
[root@sp-lvm-extend ~]#
5. The 'pvdisplay' out shows that the new disk is a candidate for extension.
[root@sp-lvm-extend ~]# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name rootvg
PV Size 63.02 GiB / not usable 2.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 16133
Free PE 10245
Allocated PE 5888
PV UUID OfzECY-Ub0e-VPRp-XrII-7OFs-OOh3-UIO5v3
"/dev/sdc" is a new physical volume of "24.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdc
VG Name
PV Size 24.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID YJosg8-qN1j-pGHH-iAQs-PuBn-KvWK-WLZvkp
[root@sp-lvm-extend ~]#
6. Get the volume group name
[root@sp-lvm-extend ~]# vgdisplay | grep Name
VG Name rootvg
[root@sp-lvm-extend ~]#
7. Extend the volume group.
[root@sp-lvm-extend ~]# vgextend rootvg /dev/sdc
Volume group "rootvg" successfully extended
[root@sp-lvm-extend ~]#
8. Verify the volume group information.
[root@sp-lvm-extend ~]# vgs
VG #PV #LV #SN Attr VSize VFree
rootvg 2 5 0 wz--n- <87.02g <64.02g
[root@sp-lvm-extend ~]#
9. Get the volume group path for extension 'root' (‘/’) file system partition.
[root@sp-lvm-extend ~]# lvdisplay | grep Path
LV Path /dev/rootvg/tmplv
LV Path /dev/rootvg/usrlv
LV Path /dev/rootvg/homelv
LV Path /dev/rootvg/varlv
LV Path /dev/rootvg/rootlv
[root@sp-lvm-extend ~]#
[root@sp-lvm-extend ~]# lvextend -l +100%FREE /dev/rootvg/rootlv
Size of logical volume rootvg/rootlv changed from 2.00 GiB (512 extents) to <66.02 GiB (16900 extents).
Logical volume rootvg/rootlv successfully resized.
[root@sp-lvm-extend ~]#
[root@sp-lvm-extend ~]# xfs_growfs /dev/rootvg/rootlv
meta-data=/dev/mapper/rootvg-rootlv isize=512 agcount=4, agsize=131072 blks
= sectsz=4096 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=0
= reflink=1 bigtime=0 inobtcount=0
data = bsize=4096 blocks=524288, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=4096 sunit=1 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 524288 to 17305600
[root@sp-lvm-extend ~]#
[root@sp-lvm-extend ~]# df -lh
Filesystem Size Used Avail Use% Mounted on
devtmpfs 7.8G 0 7.8G 0% /dev
tmpfs 7.8G 0 7.8G 0% /dev/shm
tmpfs 7.8G 8.6M 7.8G 1% /run
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/mapper/rootvg-rootlv 67G 545M 66G 1% /
/dev/mapper/rootvg-usrlv 10G 1.7G 8.4G 17% /usr
/dev/mapper/rootvg-tmplv 2.0G 47M 2.0G 3% /tmp
/dev/sda1 496M 106M 390M 22% /boot
/dev/mapper/rootvg-homelv 1014M 40M 975M 4% /home
/dev/mapper/rootvg-varlv 8.0G 860M 7.2G 11% /var
/dev/sda15 495M 5.9M 489M 2% /boot/efi
tmpfs 1.6G 0 1.6G 0% /run/user/1000
[root@sp-lvm-extend ~]#