Linux/LVM how to increase file system size by adding physical volume: Difference between revisions

From voipsupport
Jump to navigation Jump to search
(Created page with "1. Scan for devices that can be used as physical volumes <pre>lvmdiskscan</pre> 2. Create physical volume <pre>pvcreate /dev/sdd1</pre> 3. Display physical volume <pre>pv...")
 
No edit summary
Line 29: Line 29:
<pre>lvextend -L+1G /dev/myvg/homevol</pre>
<pre>lvextend -L+1G /dev/myvg/homevol</pre>


# %item value=9% Extend logical volume to a set amount (e.g. 12GB)
9. Extend logical volume to a set amount (e.g. 12GB)
%commandbox% [@lvextend -L12G /dev/myvg/homevol@]


# %item value=10% Extend logical volume to fill all free space on logical volume group
<pre>lvextend -L12G /dev/myvg/homevol</pre>
%commandbox% [@lvextend -l +100%FREE /dev/myvg/testlv@]


# %item value=11% Resize the underlying ext4 file system to the maximum of the new logical volume. Get the device name from df command
10. Extend logical volume to fill all free space on logical volume group
%commandbox% [@resize2fs /dev/mapper/VolGroup-lv_root@]
 
<pre>lvextend -l +100%FREE /dev/myvg/testlv</pre>
 
11. Resize the underlying ext4 file system to the maximum of the new logical volume. Get the device name from df command
 
<pre>resize2fs /dev/mapper/VolGroup-lv_root</pre>

Revision as of 00:26, 14 June 2016

1. Scan for devices that can be used as physical volumes

lvmdiskscan

2. Create physical volume

pvcreate /dev/sdd1

3. Display physical volume

pvdisplay

4. Display logical volume group

vgdisplay

5. Add a physical volume to a logical volume group

vgextend vg1 /dev/sdf1

6. Display all logical volumes

lvdisplay

7. Display a specific logical volum

lvdisplay -v /dev/myvg/homevol<pre>

8. Extend logical volume by a set amount (e.g. 1GB)
<pre>lvextend -L+1G /dev/myvg/homevol

9. Extend logical volume to a set amount (e.g. 12GB)

lvextend -L12G /dev/myvg/homevol

10. Extend logical volume to fill all free space on logical volume group

lvextend -l +100%FREE /dev/myvg/testlv

11. Resize the underlying ext4 file system to the maximum of the new logical volume. Get the device name from df command

resize2fs /dev/mapper/VolGroup-lv_root