Difference between revisions of "Adding and extending disks/volumes in LVM"

From Tech-Wiki
Jump to: navigation, search
(Created page with "Category:Linux In order to use LVM, the partition must be '''type 8e''' instead of 83 when created by fdisk. Create new PV (Physical Volume) using following command: #...")
 
Line 24: Line 24:
 
Increase the size of this logical volume using:
 
Increase the size of this logical volume using:
 
(if the volume has already grown using all the space in the new disk, this is not required)
 
(if the volume has already grown using all the space in the new disk, this is not required)
  # lvextend -l +100G /dev/vg_root/vol1
+
  # lvextend -L +100G /dev/vg_root/vol1
  
 
In addition, it's required to increase the file system in this logical volume as well:
 
In addition, it's required to increase the file system in this logical volume as well:

Revision as of 17:58, 15 August 2017


In order to use LVM, the partition must be type 8e instead of 83 when created by fdisk.

Create new PV (Physical Volume) using following command:

# pvcreate /dev/sdb1

Verify the volume:

# pvs
# vgdisplay

Extend the volume group in a new disk:

# vgextend vg_root /dev/sdb1

This can be used to span this volume across a second disk

Check the new size:

# vgs
# pvscan

Get the current available size using:

# lvdisplay
# vgdisplay

Increase the size of this logical volume using: (if the volume has already grown using all the space in the new disk, this is not required)

# lvextend -L +100G /dev/vg_root/vol1

In addition, it's required to increase the file system in this logical volume as well:

# resize2fs /dev/vg_root/vol1

Get the current available again size using:

# lvdisplay
# vgdisplay