system:filesystem:lvm
Table of Contents
Linux Volume Management
LVM is a highly flexible abstraction layer for hard disks, or the like. It sits somewhere in between the physical storage device and the filesystem, but other layers like e.g. dm-raid or loop-devices may exist below or above it.
Moving a Volume Group between Physical Volumes
- Optionally add a physical volume:
vgextend <vgname> <pvpath>
- Move extends away from a physical volume:
pvmove <pvpath>
- Remove physical volume from volume group:
vgreduce <vgname> <pvpath>
Moving Logical Volumes between Volume Groups
This works by merging the two volume groups temporarily, so the destination volume group must be unused during the process.
Since the meaning of source
and target
differs in the commands
involved, the later assumes srcvg
being the volume group containing
volumes to move away and dstvg
being the volume group to move to.
- Merge
dstvg
intosrcvg
:vgmerge <srcvg> <dstvg>
- Move a volume to a physical volume on
dstvg
:pvmove -n <lvname> <srcpv> <dstpv>
- Optionally repeat last step with all other volumes to move
- Unmount all moved volumes
- Make moved volumes inactive:
lvchange -an <lvpath>
- Split off
dstpv
fromsrcvg
:vgsplit <srcvg> <dstvg> <dstpv>
- Make moved volumes active again:
vgchange -ay <dstvg>
- Change mount paths in
/etc/fstab
and finally mount them again
Show on which Physical Volumes a Logical Volume resides
Just use the -m
flag to lvdisplay
.
system/filesystem/lvm.txt · Last modified: 2013/06/16 01:27 by 127.0.0.1