Lvm Snapshot

Home » CentOS » Lvm Snapshot
CentOS 13 Comments

Hello

after a lvm snapshot creation and a reboot are all logical volumes are
missing, only swap is present.

lvcreate -L 5000M -s -n CentOS_h1-root_snap /dev/mapper/CentOS_h1-root

lvs
LV VG Attr LSize Pool Origin
Data% Meta% Move Log Cpy%Sync Convert
CentOS_h1-root_snap CentOS_h1 swi-a-s— 4,88g root 0,00
home CentOS_h1 -wi-ao—- 15,00g
root CentOS_h1 owi-aos— 20,00g
swap CentOS_h1 -wi-ao—- 7,62g
var CentOS_h1 -wi-ao—- 1000,00g

after reboot no complete start, dracut console is running:

dracut:#
ls /dev/CentOS_h1/
swap

dmsetup info shows swap only, too

I can reproduce this on 2 different Servers and a Virtual Machine have
same behavior.

What do i wrong?

Greetings

Axel

13 thoughts on - Lvm Snapshot

  • What release is that? And what does /proc/cmdline contain when the system boots to the dracut shell?

  • sorry: CentOS7 “fresh” minimal with a actual update

    cat proc/cmdline:

    BOOT_IMAGE=/vmlinuz-3.10.0-229.20.1.el7.x86_64
    root=/dev/mapper/CentOS_root ro rd.lvm.lv=CentOS/root
    rd.lvm.lv=CentOS/swap crashkernel=auto rhgb quiet LANG=de_DE.UTF-8
    systemd.debug

    ls /dev/mapper:
    CentOS-swap control

    Zitat von Gordon Messmer :

    Grüße

    Axel

  • Creating snapshot:

    [root@lvmtest ~]# lvcreate -L5G -s -n root_snap /dev/CentOS/root
    Reducing COW size 5,00 GiB down to maximum usable size 2,94 GiB.
    Logical volume “root_snap” created.
    [root@lvmtest ~]# lvs
    LV VG Attr LSize Pool Origin Data% Meta% Move
    Log Cpy%Sync Convert
    root CentOS owi-aos— 2,93g
    root_snap CentOS swi-a-s— 2,94g root 0,00
    swap CentOS -wi-ao—- 1,00g

    — reboot —

    dracut shell (missing /dev/CentOS/root)

    cat proc/cmdline:
    BOOT_IMAGE=/vmlinuz-3.10.0-229.20.1.el7.x86_64
    root=/dev/mapper/CentOS_root ro rd.lvm.lv=CentOS/root rd.lvm.lv=CentOS/swap crashkernel=auto rhgb quiet LANG=de_DE.UTF-8
    systemd.debug

    ls /dev/mapper:
    CentOS-swap control

    Grüße

    Axel

  • shouldn’t you have a new grub entry with:
    root=/dev/mapper/root_snap rd.lvm.lv=CentOS/root_snap

    Tru

  • in journalctl i found:
    modprobe: FATAL: Module dm-snapshot not found
    … Can’t process LV root_snap: snapshot target support missing from kernel

    Zitat von Tru Huynh :

    Grüße

    Axel

  • Ok, kernel needs the module dm-snapshot for snapshot support, but the
    modules is storage on a snapshoted-lv …

    you can’t make a root_snapshot with CentOS?

    Zitat von Axel Glienke :

    Grüße

    Axel

  • I installed a very simple CentOS 7 system with an LVM root FS. Created a snapshot and rebooted, no problem. Updated dracut, then updated everything else and rebooted, no problem.

    As far as I can tell, dracut normally includes the entire kernel module tree under kernel/drivers/md, which should provide the dm-snapshot module required to complete the boot sequence.

    I can’t determine what’s causing the problem you see, but it doesn’t appear to affect a standard installation.

    Try:

    dracut –force –debug > /var/tmp/dracut.txt 2>&1

    Upload /var/tmp/dracut.txt to http://paste.fedoraproject.org/. I’ll see if I spot anything useful.

  • ok, thank you very much Gordon.

    but you know what the difference?

    if i do
    1. CentOS7 installation
    2. yum upgrade
    3. lvcreate -s …
    4. reboot

    then i got the error.

    if i do your way
    1. CentOS7 installtion
    2. snapshot & reboot
    3. yum upgrade
    4. reboot

    then the system start.

    Zitat von Gordon Messmer :

    Grüße

    Axel

  • I’ll try to recreate the problem on a new VM, but that doesn’t make much sense. Including the required module isn’t dependent on creating the snapshot as far as I can tell.

    If you can get dracut debug output from an affected system, I might be able to help. Without that, I can’t think of anything else I can offer you.

    dracut –force –debug > /var/tmp/dracut.txt 2>&1

    (Upload /var/tmp/dracut.txt to http://paste.fedoraproject.org/)

  • LVM is terribly flawed and most imprudent piece of any filesystem that you can have for snapshot’ing!

    The only snapshot-friendly filesystem or volume manager is ZFS. Whether create a single snapshot or few hundred thousand. It is instant and no data is lost.

  • Crazy pants.

    I can reproduce the problem now. I don’t know what the hell is going on, but I’m still looking.

  • a manually dracut -f –add-drivers “dm-snapshot”
    solve the problem

    Zitat von Gordon Messmer :

    Grüße

    Axel

  • https://bugzilla.redhat.com/show_bug.cgi?id87940

    I’m not sure what I saw that made me think the entire drivers/md tree was included. I deleted the first VM that I used to investigate the problem, so I can’t look at the shell history to figure that one out. In any case, that’s not what dracut does.

    I filed a bug suggesting that dm-snapshot should always be included for systems on LVM.