How to Allocate More Space to a Filesystem Mounted on /

fdiskfilesystems

I am new to Linux so please forgive the incorrect use of vocabulary.

My company has a private cloud that provisions VM's in a KVM. I received a RHEL 6.4. When I provisioned it, I asked for 50GB of additional storage.

Here is the results of df -h:

enter image description here

The filesystem /dev/mapper/VolGroup-lv_root mounted on / is full. After consulting my companies FAQ, I found one called "Where is my extra storage that I ordered with my VM?" and was directed to a PDF that showed me how to create a new filesystem mounted on a new directory called /data. I was unable to determine how to simply extend the fileysystem mounted on /. I did that on a different VM as a test.

On the VM which I wish to extend the filesystem mounted on /, here are the results of fdisk -l:

enter image description here

Here are the results for pvdisplay:

enter image description here

On a test VM I issued the following commands as specified by my companies FAQ:

pvcreate /dev/vdb
vgcreate DATAVG /dev/sdb
lvcreate -L 10G -n lvdata1 DATAVG
mkfs -t ext4 /dev/DATAVG/lvdata1
tune2fs -c0 -i0 /dev/DATAAVG/lvdata1

I appended the following to /etc/fstab

/dev/DATAVG/lvdata1    /data    ext4    defaults    1 2

and then mounted /data:

mount /data

After this, a df -h results in:

enter image description here

This shows that I can successfully add storage, but I wish to add the storage to the filesystem mounted on / instead.

Best Answer

At first you need to unmount the second device again, before you proceed with the following steps:

You will have to add the device /dev/vdb into your logical volume group VolGroup, you can do this using vgextend.

vgextend VolGroup /dev/vdb

After this you can first grow the logical volume lv_root to the size of the group, using lvextend.

lvextend /dev/mapper/VolGroup-lv_root -L+49G

Then you need to grow the file system on the logical volume with fsadm.

fsadm resize /dev/mapper/VolGroup-lv_root

Here are more details about resizing the file system: grow file system

Related Question