Bug 602723

Summary: Add support for booting LVM snapshot root volume
Product: Red Hat Enterprise Linux 6 Reporter: James Laska <jlaska>
Component: dracutAssignee: Harald Hoyer <harald>
Status: CLOSED CURRENTRELEASE QA Contact: Release Test Team <release-test-team-automation>
Severity: medium Docs Contact:
Priority: low    
Version: 6.0CC: atodorov, harald, jonathan, jstodola, jturner, pknirsch, prajnoha
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: dracut-004-21.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 602649 Environment:
Last Closed: 2010-11-10 20:19:18 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 602649    
Bug Blocks:    

Description James Laska 2010-06-10 14:56:04 UTC
+++ This bug was initially created as a clone of Bug #602649 +++

Description of problem:


Version-Release number of selected component (if applicable):
 * dracut-005-3.fc13.noarch

How reproducible:


Steps to Reproduce:
1. lvcreate -s -n lv_snap -L 9G /dev/vg_test1055/lv_root
2. sed -i 's|lv_root|lv_snap|g' /etc/grub.conf /etc/fstab
3. reboot
  
Actual results:

No root device found
+ source_all emergency
+ local f
+ [ emergency ]
+ [ -d /emergency ]
+ [ -e /emergency/50plymouth-emergency.sh ]
+ . /emergency/50plymouth-emergency.sh
+ [ -x /bin/plymouth ]
+ /bin/plymouth --hide-splash
+ echo

+ getarg rdshell
+ set +x
+ return 0
+ echo Dropping to debug shell.
Dropping to debug shell.
+ echo

+ export PS1=dracut:${PWD}# 
+ [ -e /.profile ]
+ echo exec 0<>/dev/console 1<>/dev/console 2<>/dev/console
+ sh -i -l
sh: can't access tty; job control turned off

dracut:/# lvm lvs
File descriptor 9 (/.console_lock) leaked on lvm invocation. Parent PID 853: sh
  LV      VG          Attr   LSize Origin  Snap%  Move Log Copy%  Convert
  lv_root vg_test1055 owi--- 8.81g                                       
  lv_snap vg_test1055 swi--- 9.00g lv_root                               
  lv_swap vg_test1055 -wi-a- 1.00g                                       

dracut:/# lvm vgscan
File descriptor 9 (/.console_lock) leaked on lvm invocation. Parent PID 853: sh
  Reading all physical volumes.  This may take a while...
  Found volume group "vg_test1055" using metadata type lvm2

dracut:/# lvm vgchange -ay
File descriptor 9 (/.console_lock) leaked on lvm invocation. Parent PID 853: sh
  vg_test1055-lv_snap: event registration failed: 856:3 libdevmapper-event-lvm2snapshot.so dlopen failed: libdevmapper-event-lvm2snapshot.so: cannot open shared object file: No such file or directory
  vg_test1055/snapshot0: snapshot segment monitoring function failed.
  3 logical volume(s) in volume group "vg_test1055" now active


Expected results:

 * dracut is able to find and use a LVM snapshot as the root volume

Additional info:
 # cat /proc/cmdline
ro root=/dev/mapper/vg_test1055-lv_snap rd_LVM_LV=vg_test1055/lv_snap rd_LVM_LV=vg_test1055/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=us console=ttyS0 rdshell rdinitdebug

 * Harald already has a patch to address the missing library libdevmapper-event-lvm2snapshot.so.  See http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut/dracut;a=commitdiff;h=edcd2c5eb7a455e9a606153bdbe2e9a4b8774a9c

--- Additional comment from jlaska on 2010-06-10 08:23:27 EDT ---

Additional info:
 * Using the patch noted in comment#0, and rebuilding the dracut ramdisk addresses the missing library
 * I then needed to remove all rd_LVM_LV= values from the boot command-line, then dracut is able to find and use the lvm snapshot as the root volume

--- Additional comment from jlaska on 2010-06-10 09:04:06 EDT ---

(In reply to comment #1)
>  * I then needed to remove all rd_LVM_LV= values from the boot command-line,
> then dracut is able to find and use the lvm snapshot as the root volume    

Still investigating why 'lvm vgchange -ay' WORKS, but 'lvm lvchange -ay /dev/vg_test1055/lv_snap' FAILS when attempting to mount the root device...

--- Additional comment from jlaska on 2010-06-10 10:54:34 EDT ---

(In reply to comment #2)
> (In reply to comment #1)
> >  * I then needed to remove all rd_LVM_LV= values from the boot command-line,
> > then dracut is able to find and use the lvm snapshot as the root volume    
> 
> Still investigating why 'lvm vgchange -ay' WORKS, but 'lvm lvchange -ay
> /dev/vg_test1055/lv_snap' FAILS when attempting to mount the root device...    

According to prajnoha, the 'lvchange' command does not support a snapshot as an argument.  

"Instead, you need to run lvchange -ay /dev/vg/origin_lv which will activate *both* origin_lv and snap_lv.  Because of the way snapshots work, it is necessary always to have all snapshots+origin active together, or none of them active.  You can't pick and choose which"

To summarize, to get LVM snapshot root volume working:
 1. I applied the patch noted in comment#0
 2. I rebuild the initramfs
 3. Create a snapshot volume: lvcreate -s -n lv_snap -L9G /dev/vg_test1055/lv_root
 4. Update grub.conf and set root=/dev/vg_test1055/lv_snap 
 5. Update fstab to use /dev/vg_test1055/lv_snap 
 6. Reboot

Comment 2 RHEL Program Management 2010-06-10 15:23:22 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
inclusion.

Comment 4 Alexander Todorov 2010-06-11 11:55:39 UTC
Something I've been personally interested in. qa_ack+

Comment 6 Alexander Todorov 2010-07-05 10:03:29 UTC
With dracut-004-23.el6.noarch there is no error on boot and the system comes up fine. So I'll move this to VERIFIED.


Some notes though:

(In reply to comment #0)
> To summarize, to get LVM snapshot root volume working:
>  1. I applied the patch noted in comment#0
>  2. I rebuild the initramfs
>  3. Create a snapshot volume: lvcreate -s -n lv_snap -L9G
> /dev/vg_test1055/lv_root
>  4. Update grub.conf and set root=/dev/vg_test1055/lv_snap 
>  5. Update fstab to use /dev/vg_test1055/lv_snap 

I believe you have to update the fstab which is on the lv_snap not on lv_root. I'll open another bug to track this (needs proper documentation at least).

Comment 7 Alexander Todorov 2010-07-05 10:20:15 UTC
Bug #611445 filed to track default behavior and (possibly documentation).

Comment 8 releng-rhel@redhat.com 2010-11-10 20:19:18 UTC
Red Hat Enterprise Linux 6.0 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.