This is an old revision of the document!
First you need to create a partition on a disk with type LVM
List the partitions
cat /proc/partitons major minor #blocks name 11 0 1048575 sr0 8 0 31457280 sda 8 1 194560 sda1 8 2 31260672 sda2 8 16 209715200 sdbIn this example the right one is “sdb”
fdisk /dev/sdb n p enter enter t 1 8e wn = new partition, p = primary partition, enter to select default or select own range, t = change partition system id, 1 = id 1 but it might be another on your system, 8e = type LVM, w = write changes to disk
pvcreate /dev/sdb1 vgcreate data /dev/sdb1 lvcreate -l 100%FREE -n backup data mkfs.ext3 -Ldata /dev/data/backup #mkfs.xfs -Ldata /dev/data/backup vi /etc/fstab /dev/mapper/data-backup /data ext3 defaults 0 0
Create a new partition for free space (example above)
Then extend the LV
pvcreate /dev/sdb1 vgextend data /dev/sdb1 lvextend -l +100%FREE /dev/data/backup resize2fs /dev/data/backup
lvremove /dev/data/backup vgremove data pvremove /dev/sdb1
Command | Function |
---|---|
pvscan | |
vgscan | |
lvscan | |
pvdisplay | show all PVs |
vgdisplay | show all VGs |
lvdisplay | show all LVs |
vgchange -ay <VGNAME> | activate LV |
lvextend -L+5G /dev/data/backup | extend by 5GB |
Mounting the device leads to the following error
mount: special device /dev/mapper/VG01-LVbackup does not exist
Checking the lv via “lvdisplay” shows that its unavailable
LV Status NOT available
Its deactivated
Run the following command to activate it
vgchange -ay <VGNAME>
and remount
mount <PATH>
Discussion