Create and manage Linux volumes (LVM)

Create the physical volume:

pvcreate /dev/sdb

Create the Volume Group:

vgcreate vg_backuppc_storage /dev/sdb

Create the logical volume:

lvcreate -l +100%FREE vg_backuppc_storage

Create a filesystem on the logical volume:

mkfs.ext4 /dev/vg_backuppc_storage/lvol0

Resize the physical volume: (need to unmount the LV before doing this)

pvresize /dev/sdb

Extend the volume:

lvextend -l +100%FREE -r /dev/vg_backuppc_storage/lvol0

Mount your new volume:

mount /dev/mapper/vg_backuppc_storage-lvol0 /mnt/

Depending on the size of your volume, the extend process can take a minute or so.
It (lvextend) begins with this message:


lvextend -l +100%FREE -r /dev/vg_backuppc_storage/lvol0
fsck from util-linux 2.20.1

And when complete you should see this:

lvextend -l +100%FREE -r /dev/vg_backuppc_storage/lvol0
fsck from util-linux 2.20.1
/dev/mapper/vg_backuppc_storage-lvol0: 2319610/268435456 files (0.2% non-contiguous), 64542817/1073740800 blocks
Extending logical volume lvol0 to 6.00 TiB
Logical volume lvol0 successfully resized
resize2fs 1.42.5 (29-Jul-2012)
Resizing the filesystem on /dev/mapper/vg_backuppc_storage-lvol0 to 1610611712 (4k) blocks.

Viewing physical and logical volume status:
You can view the volume status using ‘vgdisplay’

#vgdisplay
--- Volume group ---
VG Name vg_backuppc_storage
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size 6.00 TiB
PE Size 4.00 MiB
Total PE 1572863
Alloc PE / Size 1572863 / 6.00 TiB
Free PE / Size 0 / 0
VG UUID dsxTN6-xiNr-ZOBp-wezG-1h4K-D0E6-1zrSxo

Logical volume status

--- Logical volume ---
LV Path /dev/vg_backuppc_storage/lvol0
LV Name lvol0
VG Name vg_backuppc_storage
LV UUID bGLTfT-hlF9-3WLw-wT8O-BhHV-pVVi-WudMvK
LV Write Access read/write
LV Creation host, time backuppc, 2014-11-14 14:57:31 +0000
LV Status available
# open 1
LV Size 6.00 TiB
Current LE 1572863
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 254:3

admin has written 88 articles