[[lvm]]
 

LVM2

FDISK

if you are not doing a raid:

create partition with type 8e

Create a volume group

vgscan
vgchange -a y
pvcreate /dev/md1
vgcreate vx /dev/md1

Unmount a volume group

vgchange -a n vx

Display volume group

vgdisplay vx

Display Logical Volume

lvdisplay /dev/vx/samba

Create new virtual

lvcreate -L20G  -nusr            vx
lvcreate -L10G  -nvar            vx
lvcreate -L5G   -nopt            vx
lvcreate -L20G  -nhome           vx
lvcreate -L5G   -ntmp            vx
lvcreate -L10G  -nwww            vx
lvcreate -L20G  -nmail           vx
lvcreate -L5G   -nportage        vx
lvcreate -L10G  -ndistfiles      vx
lvcreate -L20G  -ndistfilescache vx
lvcreate -L50G  -nsamba          vx
lvcreate -L10G  -nsrc            vx
lvcreate -L50G  -nbackup         vx
lvcreate -L50G  -ntrash          vx
lvcreate -L100G -nvmware         vx
lvcreate -L300G -nvideo          vx
lvcreate -L50G  -ntorrent        vx

mkfs.ext4 /dev/vx/trash

Rename virtual

lvrename vx src dst

Resize virtual

lvextend -L +xxG /dev/vx/samba
resize_reiserfs -f /dev/vx/samba

Resize virtual - ext4

umount /dev/vg/somename
e2fsck -f /dev/vg/somename
resize2fs /dev/vg/somename 29G  (Just less than the actual size)
e2fsck -f /dev/vg/somename
lvextend -L +50G /dev/vg/somename  
resize2fs /dev/vg/somename
fsck -n /dev/vg/somename
e2fsck -f /dev/vg/somename

Ext3 Resize

umount /dev/vx/home
"not needed now" tune2fs -O ^has_journal /dev/vx/home
e2fsck -f /dev/vx/home
resize2fs /dev/vx/home 49G
lvresize -L 50G /dev/vx/home
resize2fs /dev/vx/home
fsck -n /dev/vx/home
"not needed now" tune2fs -j /dev/vx/home

Remove a virtual

lvremove /dev/vx/samba

Force a cache rebuild if not all of the vg groups appear

pvscan –cache

lvm.txt · Last modified: 2020/03/08 22:59 by paulsmith
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 4.0 International
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki