lvm

Move Elasticsearch data to dedicated LV

# create lvm
pvcreate /dev/disk/by-id/ata-INTEL_SSDSC2KB076T8_*
vgcreate data /dev/disk/by-id/ata-INTEL_SSDSC2KB076T8_*
lvcreate --name elasticsearch --size 2T data
mkfs.ext4 /dev/data/elasticsearch
 
# pre-sync data
mount /dev/data/elasticsearch /mnt/
rsync -aHAXx --numeric-ids /var/lib/docker/volumes/elasticsearch/ /mnt/
 
# sync data
docker stop elasticsearch
rsync --delete -aHAXxv --numeric-ids /var/lib/docker/volumes/elasticsearch/ /mnt/
rsync --delete -aHAXxv --numeric-ids /var/lib/docker/volumes/elasticsearch/ /mnt/
umount /mnt
 
# mount new LV

Resize filesystem on LVM

extend
lvresize -L +128G /dev/vg01/mx-home
#lvresize -l +100%FREE /dev/vg1/trusty-disk
e2fsck -f /dev/vg01/mx-home
resize2fs -p /dev/vg01/mx-home
e2fsck -f /dev/vg01/mx-home

reduce / shrink
e2fsck -f /dev/vg01/video-media
# start screen, resize2fs can take a long
resize2fs /dev/vg01/video-media 1T
lvreduce -L 1T /dev/vg01/video-media

LVM

vgs - Display information about volume groups (free space etc.)
lvs - Display information about logical volumes
lvdisplay - display attributes of a logical volume
lvremove - remove a logical volume

install
apt-get intall -y lvm2

create volume group
pvcreate /dev/md1
vgcreate vg2 /dev/md1
pvdisplay

create lvm volume
lvcreate --name VOLUME_NAME --size 4G vg2
# lvcreate -n NAME -l 100%FREE vg0
mkfs.ext3 /dev/vg2/VOLUME_NAME

renamee lvm
lvrename /dev/vg01/mx-swap /dev/vg01/mx-swap.org