How to increase Linux partition

Publish : 2022 Aug 05 1217 view Cat : AVANETCO + Linux + VMware
increase Linux partition
5/5 - (3 votes)
If you are an system admin you know that the scenario where you have to increase Linux partition happens more than often as data grows you may need to extend a partition or a disk so in this post in the series of Avanetco linux guides we’ll cover that.

when you present a new LUN or extend a virtual disk in Vmware you need to run some commands in order to increase Linux partition.

in this scenario we are adding a LVM partition to cover the complex scenario but you can use these steps for any other file systems. let’s skip the part where you have added or extended capacity you wanted by presenting a new LUN or extending your VM disk add etc.

first of all check a list of your partitions and their mount point by fdisk -l

increase linux partition

now enter fdisk interactive menu by specifying your desired hard disk like sda3

How to increase Linux partition

after creating the partition you should specify its type and by pressing L you can see the code list of available partiotions:

How to increase Linux partition

we want LVM so type 8e

learn to increase Linux partition

press w to save all settings and run the following commands

partprobe –s / reboot
pvcreate /dev/sdaXXX
vgdisplay

vgdisplay shows details of your LVM partition copy its name and then go to next step

increase hard disk in linux

in last step to increase linux partition type the commands below and replace all X with your parameters. also note that these lines are for LVM so if you are using other fs you do not need to use these and should change xfs to your preffered type of fs

vgextend vg-nameXX /dev/sdaX
pvscan
lvextend /dev/mapper/vg-nameXX /dev/sdaX
xfs_growfs /dev/vg-nameXX /root

and last but not least  you’ve mastered How to increase Linux partition just remember to check if all your configurations are ok by df -h