You are not logged in.

#1 2010-11-28 12:25:11

eugeneus
Member
Registered: 2010-11-27
Posts: 3

GRUB2 with LVM snapshots

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/GR … stallation
https://wiki.archlinux.org/index.php/LVM#Important

Steps to reproduce:
  1. Boot from archlinux liveCD 2010.05

  2. modprobe dm-mod

  3. 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
    pvdisplay 
              --- 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
    vgdisplay
          --- 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
    lvdisplay
             --- 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 
  4. Start the installation process: /arch/setup

  5. Define the mountpoints: lvolsys to /

  6. Continue with the installation

  7. Configure the system:

    1. set USELVM="yes" in /etc/rc.conf

    2. insert lvm2 in the HOOKS section in /etc/mkinitcpio.conf before filesystems

    3. add dm-snapshot to the MODULES variable in /etc/mkinitcpio.conf

  8. Skip the Install Bootloader step and exit the installer.

  9. 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
    exit
    reboot

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 

If you boot from LiveCD and remove snapshot, the system becomes bootable again.

Please confirm this bug and I'll report on https://bugs.archlinux.org

Offline

#2 2010-11-30 16:17:15

eugeneus
Member
Registered: 2010-11-27
Posts: 3

Re: GRUB2 with LVM snapshots

Small addition. GRUB output:

GRUB loading.
Welcome to GRUB!
error: no such disk.
Entering rescue mode...
grub rescue> ls
(hd0) (hd0,1)

Offline

#3 2010-12-06 10:06:10

ArchIMEDE
Member
Registered: 2010-04-20
Posts: 14

Re: GRUB2 with LVM snapshots

Could you please attach contents of grub.cfg?

Offline

#4 2010-12-07 09:01:07

eugeneus
Member
Registered: 2010-11-27
Posts: 3

Re: GRUB2 with LVM snapshots

I report this bug to the GNU GRUB bugtracker (http://savannah.gnu.org/bugs/?group=grub) and receive a message:
This was fixed in 1.99
Please mark this topic as FIXED

Last edited by eugeneus (2010-12-07 09:03:05)

Offline

Board footer

Powered by FluxBB