LVM: Mount LVM Partition(s) in Rescue Mode

LVM: Mount LVM Partition(s) in Rescue Mode

# When system is not able to boot up due to OS problems we may be leaded to boot it into
# Rescue Mode using a installation CD.

# While booting in this mode, system will try to find out linux installation and mount it
# under /mnt/sysimage giving us the opportunity of getting to F.S. in order to make
# appropriate modifications for system to be recovered. Sometimes, if OS is seriously
# damaged this is not possible. In this case, it may be useful to manually mount LVM
# partitions to check/modify OS to recover server.

# Boot the machine with installation CD into Rescue Mode.

sh-3.2# df -k
   Filesystem                1K-blocks        Used     Available  Use%   Mounted on
   /dev                         517568           0        517568    0%   /dev
   /tmp/loop0                   109184      109184             0  100%   /mnt/runtime

sh-3.2# vgs
   sh: vgs: command not found

sh-3.2# pvscan
   sh:  pvscan: command not found

# We get this kind of errors because lvm commands are not available in Rescue Mode.
# Instead we will precede any lvm commands by "lvm" command this way:

sh-3.2# lvm vgs
   VG    #PV  #LV  #SN  Attr      VSize    VFree
   vg00    1    7    0  wz--n-    31.50G      0

# Now we are ready to use lvm commands so we can mount our lvm volumes

# Check existing logical volumes

sh-3.2# lvm lvs
   LV      VG    Attr    LSize  Origin Snap%  Move Log Copy%  Convert
   lvhome  vg00  -wi---  4.50G
   lvopt   vg00  -wi---  5.00G
   lvroot  vg00  -wi---  5.00G
   lvswap  vg00  -wi---  5.00G
   lvtmp   vg00  -wi---  2.00G
   lvusr   vg00  -wi---  5.00G
   lvvar   vg00  -wi---  5.00G

# Activate our root volume group

sh-3.2# lvm vgchange -a y vg00
  7 logical volume(s) in volume group "vg00" now active

# Mount any desired volume, in this case "/" filesystem
sh-3.2# mkdir /mnt/temp
sh-3.2# mount /dev/vg00/lvroot /mnt/temp

# Now we are able to access our OS data to make any needed check/modification
0 (0)
Article Rating (No Votes)
Rate this article
There are no attachments for this article.
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
Fałszujemy rozpoznania skanerów #1
Viewed 1357 times since Mon, May 21, 2018
stunnel: Authentication
Viewed 816 times since Fri, Sep 28, 2018
RHEL: Reserved space on a ext2/ext3/ext4 filesystem
Viewed 2664 times since Sun, May 27, 2018
Viewed 656 times since Fri, Nov 30, 2018
RHEL7: Configure automatic updates.
Viewed 638 times since Wed, Oct 17, 2018
RHCS6: Extend an existing Logical Volume / GFS2 filesystem
Viewed 1116 times since Sun, Jun 3, 2018
Linux How to reset a root password on Fedora
Viewed 99 times since Sun, Dec 6, 2020
How To Run Multiple SSH Command On Remote Machine And Exit Safely
Viewed 834 times since Tue, Aug 6, 2019
OEL 7 – How to disable IPv6 on Oracle Linux 7
Viewed 7558 times since Fri, Aug 3, 2018
Extending Linux LVM partitions script
Viewed 681 times since Wed, Feb 6, 2019