Sunday, November 28, 2010

Logical Volume Groups

To create a backup of the main data on my raid system for removal offsite, I'm using 2 2tb drives.  I attach them to a utility system and create a Logical Volume group which fills both.  the current set I'm using was created by installing a system and allowing it to create the LVM spanning both drives.  As such one of the drives has a few gb of space at the front with a root boot partition, which is a primary partition not in the LVM.  On the original system once booted, the LVM had the root, home and another boot partiton inside the LVM.

In order to mount this one needs to install some tools on the system.  I found a page advising to install two gui's which are quite useful.

One is a KDE utility KVPM.  It or the other utility drags in the lvm tools.  Another one is system-config-lvm.

http://ossnotebook.blogspot.com/2009/02/lvm-tools-in-ubuntu-jaunty.html

The command line tools allow installation of the lvm.  The lvm scans all disks for logical volume groups.  These are marked with unique ID's from when they are created.  All are shown via the commands in the lvm command.

vgdisplay shows information on the volume group:
  --- Volume group ---
  VG Name               vg_apex2
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               1
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               3.64 TiB
  PE Size               32.00 MiB
  Total PE              119216
  Alloc PE / Size       119216 / 3.64 TiB
  Free  PE / Size       0 / 0
  VG UUID               ISZMQ4-BNdD-J9Cf-f72S-GgiI-TslM-w8sSqm


pvs shows the physical information
lvm> pvs
  PV         VG       Fmt  Attr PSize PFree
  /dev/sdb2  vg_apex2 lvm2 a-   1.82t    0
  /dev/sdc1  vg_apex2 lvm2 a-   1.82t    0


pvdisplay shows more information on the volumes

lvm> pvdisplay
  --- Physical volume ---
  PV Name               /dev/sdb2
  VG Name               vg_apex2
  PV Size               1.82 TiB / not usable 28.00 MiB
  Allocatable           yes (but full)
  PE Size               32.00 MiB
  Total PE              59600
  Free PE               0
  Allocated PE          59600
  PV UUID               cdqH1r-Z873-mmC4-XZpY-Vsrc-YXd1-PwF8VS

  --- Physical volume ---
  PV Name               /dev/sdc1
  VG Name               vg_apex2
  PV Size               1.82 TiB / not usable 16.00 MiB
  Allocatable           yes (but full)
  PE Size               32.00 MiB
  Total PE              59616
  Free PE               0
  Allocated PE          59616
  PV UUID               hJyfL3-RbkR-SxbM-ffHk-q70G-1iu9-6r58yx


The next thing that has to be performed is to make the volume group visible to the system.  The vgchange -ay makes the volume group active.  Once it is active /dev/vg* will be visible and the members of each vg directory are the file systems.  After the vgchange is performed, all the need be done is to mount the volume group, such as;

mount /dev/vg_apex2/lv_home /apex2

No comments:

Post a Comment