Mountando particao LVM

Ate’ hoje nunca precisei montar uma particao LVM, mas finalmente este dia chegou. Apesar de ser algo simples a primeira vez e’ um pouco chato, ate’ voce entender bem como as coisas funcionam.

Felizmente achei uma dica muito util:

http://www.brandonhutchinson.com/Mounting_a_Linux_LVM_volume.html

You do not mount a partition of type “Linux LVM” the same way you mount a partition using a standard Linux file system (e.g. ext2, ext3).

# fdisk -l /dev/hda

Disk /dev/hda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1          13      104391   83  Linux
/dev/hda2 14       19457   156183930   8e  Linux LVM

# mount /dev/hda2 /tmp/mnt
mount: /dev/hda2 already mounted or /tmp/mnt busy

First, let’s determine the volume group containing the physical volume /dev/hda2.

# pvs
PV         VG         Fmt  Attr PSize   PFree
/dev/hda2 VolGroup01 lvm2 a-   148.94G 32.00M
/dev/hdb2  VolGroup00 lvm2 a-   114.94G 96.00M

Next, let’s list the logical volumes in VolGroup01.

# lvdisplay /dev/VolGroup01
— Logical volume —
LV Name                /dev/VolGroup01/LogVol00
VG Name                VolGroup01
LV UUID                zOQogm-G8I7-a4WC-T7KI-AhWe-Ex3Y-JVzFcR
LV Write Access        read/write
LV Status              available
# open                 0
LV Size                146.97 GB
Current LE             4703
Segments               1
Allocation             inherit
Read ahead sectors     0
Block device           253:2

— Logical volume —
LV Name                /dev/VolGroup01/LogVol01
VG Name                VolGroup01
LV UUID                araUBI-4eer-uh5L-Dvnr-3bI6-4gYg-APgYy2
LV Write Access        read/write
LV Status              available
# open                 0
LV Size                1.94 GB
Current LE             62
Segments               1
Allocation             inherit
Read ahead sectors     0
Block device           253:3

The logical volume I would like to “mount” (in purely the computing-related sense) is /dev/VolGroup01/LogVol00. The other logical volume is a swap partition.

# mount /dev/VolGroup01/LogVol00 /tmp/mnt

Apos seguir esta dica (tive que dar um “apt-get install lvm2” antes) recebo a mensagem de erro:

mount: special device /dev/VolGroup00/LogVol00 does not exist

Encontro em outro site a dica para resolver este problema:

# vgchange -a y /dev/VolGroup00/LogVol00

Porem isto nao funcionou, tentei ativar todas removendo da linha acima o nome do volume, mas o mesmo erro:

# vgchange -a y
/proc/misc: No entry for device-mapper found
Is device-mapper driver missing from kernel?
Failure to communicate with kernel device-mapper driver.
/proc/misc: No entry for device-mapper found
Is device-mapper driver missing from kernel?
Failure to communicate with kernel device-mapper driver.
Incompatible libdevmapper 1.02.20 (2007-06-15)(compat) and kernel driver
0 logical volume(s) in volume group “VolGroup00” now active

Quando ja’ estava me estressando com isto encontro o deus-ex nos comentarios deste site:
http://linuxwave.blogspot.com/2007/11/mounting-lvm-disk-using-ubuntu-livecd.html

A solucao era apenas carregar o modulo antes:

# modprobe dm-mod

\o/

Leave a comment