LVM: Difference between revisions
(Created page with "== Unmount the Volume == Good idea to look first and see who is using the volume and then manually stop those services <pre>sudo lsof | grep '/var'</pre> If that doesn't w...") |
|||
Line 10: | Line 10: | ||
== Expanding a Volume == | == Expanding a Volume == | ||
LVM consists of physical volumes, volume groups, and logical volumes. A volume group maps multiple physical volumes to a volume group. | |||
* Create Volume * | |||
Run parted on the correct device: | |||
<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. | |||
<pre>print free</pre> | |||
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: | |||
<pre>mkpart primary ext4 32.2GB 107GB</pre> | |||
Do another '''print''' and you should see the new volume. Now do a | |||
<pre>vgs</pre> | |||
To list the volume groups (generally just one). We want to add the new physical volume to the volume group: | |||
<pre>vgextend vg00 /dev/sda3</pre> (assuming the new partition was 3) | |||
Finally, add some space to the correct logical volume and resize: | |||
<pre>lvextend -L50GB /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. |
Revision as of 05:01, 7 March 2024
Unmount the 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 a Volume
LVM consists of physical volumes, volume groups, and logical volumes. A volume group maps multiple physical volumes to a volume group.
- Create Volume *
Run parted on the correct device:
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. <pre>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
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.