1.3 KiB
1.3 KiB
lvm.
Glossary:
- pv: physical device (e.g.
/dev/md0
or/dev/sda1
) - vg: volume group (consists of 1 or more pvs, contains lvs); has a name (e.g.
lvm
) - lv: logical volume (has a name which defines its path, e.g.
/dev/lvm/root
which equalsdev/mapper/lvm-root
)
command | description |
---|---|
pvcreate /dev/md0 |
initializes /dev/md0 as phys device for a volume group |
vgcreate lvm /dev/md0 |
create volume group lvm with phys device /dev/md0 |
lvcreate -L30G -nroot lvm ; mkfs.ext4 /dev/lvm/root |
create logical volume root , sized 30G in volume group lvm ; format with ext4 |
lvextend -L60G -nroot lvm ; resize2fs /dev/lvm/root |
extend /dev/lvm/root to 60G; also resize file system to new size |
pvs , vgs , lvs |
show short info about pv, vg and lv |
pvdisplay , vgdisplay , lvdisplay |
show long info |
pvscan /dev/md0 |
scan disks for physical volumes (e.g. when running live system) |
vgextend lvm /dev/md1 |
add phys device /dev/md1 to volume group lvm (need pvcreate first!) |
pvmove /dev/md0 ; vgreduce lvm /dev/md0 |
move all logical volumes from /dev/md0 and remove phys device from volume group |
cache volume.
TODO: copy from: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/logical_volume_manager_administration/lvm_cache_volume_creation