LVM

From Segfault
Jump to: navigation, search

Introduction

Quoting from the LVM2 Resource Page:

LVM2 refers to a new userspace toolset that provide logical volume management facilities
on linux. It is reasonably backwards-compatible with the original LVM toolset.

To use LVM2 you need 3 things: device-mapper in your kernel, the userspace device-mapper
support library (libdevmapper) and the userspace LVM2 tools.

The following tries to describe LVM, roughly:

     [sda]---[sdb]
       [sdc]---[sdd]               ← LVM physical volume (pv)
             |
        -----|-----
        |         |
    ---[vg]    --[vg]---....          ← LVM volume group
    |    |     |    |     |
    [lv] [lv]  [lv] [lv]  [lv]        ← LVM logical volume

Troubleshooting

Volumes are not activated

If logical volumes (and/or volume groups and/or physical volumes) are not visible via lvs, vgs, pvs, chances are that the logical volumes are in place, but inactive and not present in /dev/mapper. To activate all volumes, try this:

 for v in `lvs -o vg_name,name --noheadings --separator /`; do
   echo "V: $v"
   lvchange -ay /dev/"$v"
 done

Now the volumes should show up in /dev/mapper.

Links