User Tools

Site Tools



As the Gentoo Wiki suggests, this guide will focus on using Webmin to set up and manage logical volumes in LVM.

Installation and Setup

sudo dpkg –i webmin_1.400_all.deb :It will probably report that some packages are missing, so use sudo apt-get install <…> :to install the missing packages. apt-get should then automatically install Webmin once the pre-requisites are installed.

  • The Webmin installer should tell you the URL at which Webmin can be accessed - e.g. https://hostname:10000/. Visit this URL and log in as any user in the sudoers file (i.e. any user that can execute commands using sudo).
  • Go to the Logical Volume Management page under the Hardware section on the left.
  • Click the “Add a new volume group” link to create a new Volume Group.
  • Give the group a name, e.g. “Storage Pool”, and select the first physical device (a disk or partition) that you want to be in the pool. As the warning states, the device will be formatted so any data on it will be lost. What the page doesn't tell you, however, is that the device must not be mounted, so go and unmount it first if it already is mounted (find out where it's mounted by examining /etc/fstab, then use

sudo umount <device> :to unmount it.

  • Since LVM only really makes sense if you have multiple physical volumes in the Volume Group, select the Physical Volumes tab of Webmin, and then click the link to “Add a physical volume to Storage Pool”. As before, select the device you want to add to the Volume Group, and as before it will be formatted and must not be mounted. Repeat until all of the devices you want to be in the Group have been added.
  • To create a logical volume that can actually be used to store files on, select the Logical Volumes tab in Webmin, and click the link to “Create a logical volume in Storage Pool”. Give your new volume a name, e.g. “Music”, and select a size in kilobytes. You can also select if you want the volume to be read/write or read-only, if you want the allocation method to be “contiguous” or “non-contiguous”, and if you want to stripe the data across multiple physical disks or not. Repeat for each logical volume you wish to create.
  • Again, from the Logical Volumes tab, click each logical volume in turn, then:
    • Select a filesystem from the drop-down list, then click the “Create filesystem of type:“ button to create a filesystem of that type on the logical volume. Change any necessary options if you wish, or just click the “Create” button.
    • Re-enter the details of that same volume, then type a mount point (e.g. /share/Music) and click the “Mount LV on:“ button.
    • From here you can choose various options, but again, all of the options have sensible defaults and can often be left as they are, so just click the “Create” button unless you want to change anything first.
    • After creating the mount, you will be taken to the Disk and Network Filesystems page, so you’ll have to go back to the LVM page, then the Logical Volumes tab if you have any more logical volumes to set up.


Note: At least three physical disks need to be added to the Volume Group before 2-disk (i.e. -m1) mirroring can be enabled, as LVM needs to store a log of the mirroring state on a disk that isn't involved in the mirroring itself. For a 3-disk (-m2) mirror, four physical disks need to be in the VG, etc.

To convert a logical volume so that it is mirrored onto another physical disk, use, e.g.: lvconvert -m1 Pool/Music

The status of mirrored logical volumes, including the state of copying, can be accessed with: lvs -a -o +devices

To convert a mirrored logical volume to a linear (non-mirrored) logical volume, use: lvconvert -m0 Pool/Music

If a physical disk fails, any mirrored volumes stored on it (either wholly or partially) will be automatically converted to linear volumes. To restore the redundancy, replace the failed disk, then convert the volume back to a mirrored volume as detailed above. Any non-mirrored volumes that are stored on the failed disk will be either entirely broken, or will at least have a lot of data missing; therefore, mirror any volumes containing data you care about.

Unfortunately mirrored logical volumes cannot (yet) be resized while active, so to resize a mirrored volume, use, e.g.: lvconvert -m0 Pool/Music lvresize -L 10G Pool/Music lvconvert -m1 Pool/Music


dm-crypt can be used to encrypt a partition. This is only useful while the disk is unmounted, as while it is mounted the keys are in memory and the disk can be read.

 # To create
 cryptsetup -y create encrypted-volume /dev/mapper/pool-volume
 mkreiserfs /dev/mapper/encrypted-volume
 # To mount
 mount /dev/mapper/encrypted-volume /mnt/volume
 # To unmount
 umount /dev/mapper/encrypted-volume
 cryptsetup remove encrypted-volume


LVM logical volumes can be resized easily, with extra blocks of storage being used wherever they can be found. If you use ReiserFS you can even grow (but not shrink) a logical volume without unmounting it first, otherwise you'll have to unmount it while you perform the resize.


  • Grow the underlying logical volume (by 1GB in this example):

lvextend -L+1G Pool/Music


  • Resize the ReiserFS filesystem to fill the new volume:

resize_reiserfs /dev/mapper/Pool-Music


  • Resize the XFS filesystem to fill the new volume:

xfs_growfs /mnt/Pool/Music

To Do


LVM provides the ability to create snapshots of volumes, and while Webmin can create them, ideally it should be an automated process that's combined with Samba to allow Windows 2000/2003/2008/XP/Vista clients to access the snapshots as “previous versions”.

logical_volume_manager.txt · Last modified: 2014/11/24 02:15 by ben