linux tips

Tips and ticks for linux

&
 
  • Cool sites



Jan 11 2009

Mounting a Linux LVM volume

Published by dipinkrishna at 2:01 am under Uncategorized Edit This

Linux LVM partitions do not mount the same way as the ext2 and ext3 partitions that you may be used to. Consider the following example from a dual boot (Windows XP + CentOS) machine:

# fdisk -l /dev/sda

Disk /dev/sda: 750.1 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 1 6 48163+ de Dell Utility
/dev/sda2 * 7 4510 36178380 7 HPFS/NTFS
/dev/sda3 4511 4771 2096482+ 83 Linux
/dev/sda4 4772 91201 694248975 5 Extended
/dev/sda5 4772 91201 694248943+ 8e Linux LVM

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

Okay, so we need to determine the volume group that contains the physical volume /dev/sda5:

# pvs
PV VG Fmt Attr PSize PFree
/dev/sda5 VolGroup00 lvm2 a- 662.06G 352.00M

Next, we need to list the logical volumes in VolGroup00:

# lvdisplay /dev/VolGroup00
— Logical volume —
LV Name /dev/VolGroup00/LogVol00
VG Name VolGroup00
LV UUID ThdwBX-Vj7g-Z2hE-sPq7-00v3-Pij8-6Kx7UF
LV Write Access read/write
LV Status available
# open 1
LV Size 659.78 GB
Current LE 21113
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 253:0

— Logical volume —
LV Name /dev/VolGroup00/LogVol01
VG Name VolGroup00
LV UUID Lxe5g6-cdyD-Se9W-FX9g-PqyC-2lI8-zYgDfe
LV Write Access read/write
LV Status available
# open 1
LV Size 1.94 GB
Current LE 62
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 253:1

In this example, we know that /dev/VolGroup00/LogVol00 contains the physical data that we would like to mount. If you are unsure about what to mount on your system, look at the LV Size and compare it to the output from ‘df -h’ (our system output is below):

# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
650G 306G 312G 50% /
/dev/sda3 2.0G 77M 1.8G 5% /boot
none 1005M 0 1005M 0% /dev/shm

The other logical volume returned from ‘lvdisplay’ in our example is a swap partition, which we do not want to mount. Here is the command for mounting the desired logical volume:

# mount /dev/VolGroup00/LogVol00 /tmp/mnt

Possibly-related Articles:                                        (auto-generated)

Trackback URI | Comments RSS

Leave a Reply

You must be logged in to post a comment.
Not A Member? Register for Free!