User Tools

Site Tools


system:filesystem:lvm

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

  1. Optionally add a physical volume: vgextend <vgname> <pvpath>
  2. Move extends away from a physical volume: pvmove <pvpath>
  3. 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.

  1. Merge dstvg into srcvg: vgmerge <srcvg> <dstvg>
  2. Move a volume to a physical volume on dstvg: pvmove -n <lvname> <srcpv> <dstpv>
  3. Optionally repeat last step with all other volumes to move
  4. Unmount all moved volumes
  5. Make moved volumes inactive: lvchange -an <lvpath>
  6. Split off dstpv from srcvg: vgsplit <srcvg> <dstvg> <dstpv>
  7. Make moved volumes active again: vgchange -ay <dstvg>
  8. 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