(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Unmount the Volume  ==
LVM consists of physical volumes, volume groups, and logical volumes. A volume group maps multiple physical volumes to a volume group. A logical volume is a virtual, block storage device that a file system, database, or application can use.
 
== Unmount a Volume  ==


Good idea to look first and see who is using the volume and then manually stop those services
Good idea to look first and see who is using the volume and then manually stop those services
Line 9: Line 11:
<pre>sudo umount -l /var</pre>
<pre>sudo umount -l /var</pre>


LVM consists of physical volumes, volume groups, and logical volumes. A volume group maps multiple physical volumes to a volume group.
== Expanding Volumes ==


* Create Volume *
To create new space in a volume group (and logical volume), you either need to install a new device, to resize an existing device, or to expand the size of the underlying device in vmware.


Run parted on the correct device:
Run parted on the correct device:
<pre>parted /dev/sda<pre>
<pre>parted /dev/sda</pre>


Get the amount of free space. In the case of a vmware partition, this should represent the size or increased size of the volume.
Get the amount of free space. In the case of a vmware partition, this should represent the size or increased size of the volume.
Line 34: Line 36:
Finally, add some space to the correct logical volume and resize:
Finally, add some space to the correct logical volume and resize:


<pre>lvextend -L50GB /dev/mapper/vg00-var</pre>
<pre>lvextend -L50GB /dev/mapper/vg00-var
resize2fs /dev/mapper/vg00-var
</pre>


This new size obviously needs to be more more than the old logical volume size and there needs to be enough space in the volume group to support it.
This new size obviously needs to be more more than the old logical volume size and there needs to be enough space in the volume group to support it. Now do a :


<pre>lvs</pre>


<pre>lvs</pre>
To see the changes.

Latest revision as of 05:07, 7 March 2024

LVM consists of physical volumes, volume groups, and logical volumes. A volume group maps multiple physical volumes to a volume group. A logical volume is a virtual, block storage device that a file system, database, or application can use.

Unmount a Volume

Good idea to look first and see who is using the volume and then manually stop those services

sudo lsof | grep '/var'

If that doesn't work or you are feelign froggy, you can force it with

sudo umount -l /var

Expanding Volumes

To create new space in a volume group (and logical volume), you either need to install a new device, to resize an existing device, or to expand the size of the underlying device in vmware.

Run parted on the correct device:

parted /dev/sda

Get the amount of free space. In the case of a vmware partition, this should represent the size or increased size of the volume.

print free

The relevant information is the size of the volume, and the start and end location of each partition. For example, if it's a 107GB disk, and the end says 32.2GB, you have 74.8GB free and your mpart would look like:

mkpart primary ext4 32.2GB 107GB

Do another print and you should see the new volume. Now do a

vgs

To list the volume groups (generally just one). We want to add the new physical volume to the volume group:

vgextend vg00 /dev/sda3

(assuming the new partition was 3)

Finally, add some space to the correct logical volume and resize:

lvextend -L50GB /dev/mapper/vg00-var
resize2fs /dev/mapper/vg00-var

This new size obviously needs to be more more than the old logical volume size and there needs to be enough space in the volume group to support it. Now do a :

lvs

To see the changes.