LVM: Difference between revisions
From DWIKI
m (→FAQ) |
|||
Line 60: | Line 60: | ||
lvscan | lvscan | ||
==Add disk to pg== | |||
pvcreate /dev/sdc | |||
vgextend MYVG /dev/sdc | |||
lvextend /dev/NYVG/mylv /dev/sdc | |||
And then grow fs | |||
==lvremove: Logical volume vg-kvm/vps-snapshot is used by another device.== | ==lvremove: Logical volume vg-kvm/vps-snapshot is used by another device.== |
Revision as of 13:16, 1 June 2018
Logical Volume Management on Linux
Link
- How do you clone an lvm partition?
- HOWTO
- Beginner's guide to LVM
- Resizing LVM + DRBD
- http://wiki.tldp.org/LVM-on-RAID
- LVM nesting
- http://blog.gadi.cc/better-lvm-for-kvm/
NOTE: remember to add snapshot support when calling lvcreate
Related commands
lvdisplay
lsblk
partprobe
lvchange
vgchange
dmsetup
vgs
create physical volume
pvcreate /dev/sda3
lvcreate
lvcreate -L12G -nmyvol myvolumegroup lvcreate -l 100%FREE -nmyvol myvolumegroup
lvresize
lvresize --resizefs -L-2G /dev/vg/foo
FAQ
Access logical volumes within logical volume
partprobe /dev/mapper/vg-mydata lsblk
This will show the (sub) partitions/volumes, then edit /etc/lvm/lvm.conf
filter = [ "a|.*/|", "a|mydata|","r|.*|" ]
Then run:
vgscan lvscan vgs
Now you should see the names of the volumes you're looking for, so now:
vgchange -a y guestsname_mydata-home
and then you should be able to
mount /dev/mapper/guestsname_mydata-home
When done, remember to change back the filter in lvm.conf, default is
filter = [ "a|.*/|" ]
and of course then once again
vgscan lvscan
Add disk to pg
pvcreate /dev/sdc vgextend MYVG /dev/sdc lvextend /dev/NYVG/mylv /dev/sdc
And then grow fs
lvremove: Logical volume vg-kvm/vps-snapshot is used by another device.
???
some say lvchange -an the snapshot first, but that disables the lv it's connected to as well
Grow physical volume
Assuming your LVM partition is the last one, use fdisk to delete and recreate it, remember to set type to LVM again and reboot. Then use pvresize /dev/sdaX
Remove physical drive from a volume group
Make sure the data fits on remaining drive, then
pvmove /dev/sdbX vgreduce /dev/sdbX