Real persistence with oVirt Node
Node is conservative about keeping changes in files. And it is impossible to modify the root filesystem of a running Node in such a way, that changes to it would survive a reboot.
That’s true. But you can modify the intermediate layers to persist the changes made to the rootfs. Huh? That sounds weird. It is.
The background is roughly: The Node iso is going through some loop mounts and through device-mapper snapshot. Somewhere the dm snapshot requires a backing file for the changes made to the block device it maps. Normally this temporary device is a memory (thorugh a tmpfs), but with some nifty dracut magic this backing device for the device-mapper snapshot can be any device. And if you choose a device which keeps changes (like any regular harddisk) then your changes to the rootfs will survive - not in the rootfs - but in the intermediate layers.
It’s a bit complex to explain but easy to use and but useful.
I’ll illustrate the flow using qemu:
# Create a file for the harddisk where you want to install Node:
qemu-img create -f qcow2 hda.qcow2 20G
# Create a backing file for the persistency
qemu-img create -f raw hdb.raw 500M
# Create a file in the persistence image which holds the actual changes
mkfs.ext4 hdb.raw
mkdir loop
mount -o loop hdb.raw loop
dd if=/dev/zero bs=1M count=300 of=loop/persist-hda.img
umount -f loop
# Run qemu
qemu-system-x86_64 -m 2048 -hda hda.qcow2 -hdb hdb.raw -cdrom node.iso
Now install Node normally.
Whenever you want to make a change or run the system with the change, you need to add the following to your grub commandline:
rd.live.overlay=/dev/sdb:/persist-hda.img
# overlay= on el6
or in general:
rd.live.overlay=<device>:<absolute path relative to the root of device>
That also means that you can have different files inside your persistence device for different persisted things. Maybe you know what I mean. I.e.:
- /persist-vdsm-update.img
- /persist-node-update.img
- /persist-qemu-update.img
However, one drawback is: This doesnot work for upgrades. After you upgraded Node, the persistence image can not be used anymore.
Also note that the rootfs is by default mounted ro
- you either need
to remove the ro
keyword from the kernel cmdline or remount the root
fs writable. Take also care that you don’t try to modify a path which is
on a tmpfs.
::: {#footer} [ May 7th, 2015 5:59pm ]{#timestamp} [node]{.tag} [dracut]{.tag} [fedora]{.tag} [persistence]{.tag} :::