Monday, 29 September 2014

Mounting a LVM partition from LiveCD

Imagine that your "/" partition is an  LVM and it is corrupted. You need to  perform an fsck inorder to boot the system.

Now, get a live CD and boot your system to live cd.

1) Check if lvm2 packages are installed. Else, you can install it via yum.

2) Run the command "fdisk -l" to see if the harddisk partitions are detected. 

3) Run pvscan to scan all disks for physical volume. This to make sure that the LVM harddisk is        detected by  Centos.
====
# pvscan
PV /dev/sda2 VG VolGroup00 lvm2 [74.41 GB / 32.00 MB free]
Total: 1 [74.41 GB] / in use: 1 [74.41 GB] / in no VG: 0 [0 ]
====

4) After that run vgscan to scan disks for volume groups.
====
# vgscan
Reading all physical volumes. This may take a while...
Found volume group "VolGroup00" using metadata type lvm2
====

5) Activate all volume groups available.
====
# vgchange -a y
2 logical volume(s) in volume group "VolGroup00" now active
====

6)  Run lvscan to scan all disks for logical volume. You can see partitions inside the hard disk now active.
====
# lvscan
ACTIVE '/dev/VolGroup00/LogVol00' [72.44 GB] inherit
ACTIVE '/dev/VolGroup00/LogVol01' [1.94 GB] inherit
=====

7) Mount the partition to any directory you want, usually to /mnt
# mount /dev/VolGroup00/LogVol00 /mnt

8) You can access the partition in the /mnt directory and can backup your data

No comments:

Post a comment

Note: only a member of this blog may post a comment.