bugGNU GRUB - Bugs: bug #31771, GRUB2 with LVM snapshot of /boot


You are not allowed to post comments on this tracker with your current authentication level.

bug #31771: GRUB2 with LVM snapshot of /boot

Submitter:  eugene <eugeneus>
Submitted:  Fri 03 Dec 2010 02:14:15 PM UTC
Category:  Booting Severity:  Major
Priority:  5 - Normal Item Group:  Software Error
Status:  Fixed Privacy:  Public
Assigned to:  None Originator Name:  Eugene Shtokolov
Open/Closed:  Closed Release:  1.98
Release:  Reproducibility:  Every Time
Planned Release:  None

Fri 03 Dec 2010 10:31:00 PM UTC, comment #1: 

This was fixed in 1.99

Vladimir Serbinenko <phcoder>
Group administrator
Fri 03 Dec 2010 02:14:15 PM UTC, original submission:  

Maybe I found a bug or feature in the GRUB2.

I want to create a something like time machine. Install the system on LVM partition, before the full system upgrade, we take a snapshot. If something going wrong we can revert the snapshot with command:
lvconvert --merge /dev/VolGroup00/snap01.
Of course we can try to boot from LVM snapshot, after a little editing of grub.cnf. For correct work of this mechanism, we must install the system, including /boot, on LVM partition. This should work in theory. In practice, after creating a snapshot the system becomes unbootable. After removing snapshot the system becomes bootable again.
If I use a separate non LVM partition for /boot, everything works, but if the kernel has changed, we can't restore system by merging the snapshot.

Sources of information: https://wiki.archlinux.org/index.php/GRUB2#Installing_GRUB2_during_Arch_Linux_installation

Steps to reproduce:

  • Boot from archlinux liveCD 2010.05
  • modprobe dm-mod
  • Create single large physical LVM volume and smaller size logical volume (we need some free space on the physical volume to create a snapshot):

cfdisk /dev/sda
pvcreate /dev/sda1
  --- Physical volume ---
  PV Name               /dev/sda1
  VG Name               VolGroup00
  PV Size               15.99 GiB / not usable 2.74 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              4094
  Free PE               1534
  Allocated PE          2560
  PV UUID               MZgGF5-XnPs-hzFM-0eWw-mEYP-6wgn-AggDO0
vgcreate VolGroup00 /dev/sda1
      --- Volume group ---
  VG Name               VolGroup00
  System ID            
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  7
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               15.99 GiB
  PE Size               4.00 MiB
  Total PE              4094
  Alloc PE / Size       2560 / 10.00 GiB
  Free  PE / Size       1534 / 5.99 GiB
  VG UUID               1TS4q4-WHAJ-YCxt-RHm0-k0Ha-spS4-O0nZzf
lvcreate -L 10G VolGroup00 -n lvolsys
--- Logical volume ---
  LV Name                /dev/VolGroup00/lvolsys
  VG Name                VolGroup00
  LV UUID                FAfgNj-nDUW-WYyw-wwED-Fmct-it0L-NSOUDt
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                10.00 GiB
  Current LE             2560
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:0

  • Start the installation process: /arch/setup
  • Define the mountpoints: lvolsys to /
  • Continue with the installation
  • Configure the system:
    • set USELVM="yes" in /etc/rc.conf
    • insert lvm2 in the HOOKS section in /etc/mkinitcpio.conf before filesystems
    • add dm-snapshot to the MODULES variable in /etc/mkinitcpio.conf
  • Skip the Install Bootloader step and exit the installer.
  • Install the bootloader:

aif -p partial-configure-network # configure the network
mount -o bind /dev /mnt/dev
chroot /mnt bash
pacman -Sy grub2
grub-install /dev/sda --no-floppy
grub-mkconfig -o /boot/grub/grub.cfg

The system boots properly, but it becomes unbootable, after we make snapshot of the lvolsys volume:
lvcreate --size 100M --snapshot --name snap01 /dev/VolGroup00/lvolsys
After reboot:
GRUB loading.
Welcome to GRUB!
error: no such disk.
Entering rescue mode...
grub rescue> ls
(hd0) (hd0,1)
If you boot from LiveCD and remove snapshot, the system becomes bootable again.

eugene <eugeneus>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by phcoder (Posted a comment)
  • -email is unavailable- added by eugeneus (Submitted the item)
  • -email is unavailable- added by eugeneus

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.


    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-12-03 phcoder StatusNone Fixed
        Open/ClosedOpen Closed
    2010-12-03 eugeneus Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code