Managing Logical Volumes
Imagine to manage SDB
Show status of LVM devices / volumes / ...
pvs
vgs
lvs
Create an LVM-ready partition /dev/sdb1
Not strictly necessary, if not needed skip this step and use directly sdb device, instead of a partition
fdisk /dev/sdb
n p 1 t 8e p w
Add LVM Magic
( pvcreate /dev/sdb )
vgcreate vg00 /dev/sdb
lvcreate -L 150G -n mysql vg00 # defined size
lvcreate -l95%VG -n mysql vg00 # 95% of the size of the VG
lvcreate -l90%FREE -n mysql vg00 # 90% of the remaining free space in the Volume Group
mkfs -t ext4 /dev/vg00/mysql
UUID=$( blkid /dev/vg00/mysql | awk '{ print $2 }') echo "$UUID /mnt/mysql ext4 defaults,noatime,nodiratime 0 0" >> /etc/fstab
mkdir -p /mnt/mysql
mount -a
mkdir /mnt/mysql/{binlog,data}
Extend existing volume
add 10G
lvextend --size +10G --resizefs /dev/mapper/vg01-backup
add all remaining size on the volume
lvextend -l +100%FREE --resizefs /dev/vg00/docker
Label a volume
Ext4
e2label /dev/vg00/mysql mysql
XFS
xfs_admin -u /dev/vg01/mongodb