manage zfs / clones to allow use of boot environments

Registered by Damian Wojsław

Boot environments for ZFS / enable storage cheap redundant copy of / directory that can quickly be rolled back or booted into, allowing toe easily test new packages.

Blueprint information

Status:
Not started
Approver:
Damian Wojsław
Priority:
Low
Drafter:
Damian Wojsław
Direction:
Needs approval
Assignee:
Damian Wojsław
Definition:
New
Series goal:
None
Implementation:
Unknown
Milestone target:
None

Related branches

Sprints

Whiteboard

Based on illumos beadm command. Man page: https://illumos.org/man/1m/beadm
Synopsis:
SYNOPSIS

beadm create [-a] [-d description]
[-e non-activeBeName | beName@snapshot]
[-o property=value] ... [-p zpool]
[-v] beName

beadm create [-v] beName@snapshot

beadm destroy [-fFsv] beName | beName@snapshot

beadm list [-a | -ds] [-H]
[-k|-K date | name | space] [-v] [beName]

beadm mount [-s ro|rw] [-v] beName mountpoint

beadm unmount [-fv] beName | mountpoint

beadm rename [-v] beName newBeName

beadm activate [-v] beName

beadm rollback [-v] beName snapshot

beadm rollback [-v] beName@snapshot

-------------------
Output from illumos beadm:

trochej@openindiana:/home/trochej$ beadm list
BE Active Mountpoint Space Policy Created
openindiana NR / 2,36G static 2016-05-16 23:40
openindiana-1 - - 51,0K static 2016-05-16 23:51

--------------------

Steps to follow after installing rootfs in rpool/ROOT/ubuntu:

1. FS list:

root@ubuntuzfs:~# zfs list
NAME USED AVAIL REFER MOUNTPOINT
rpool 3.95G 3.74G 96K /
rpool/ROOT 2.03G 3.74G 96K none
rpool/ROOT/ubuntu 2.03G 3.74G 1.97G /
rpool/ROOT/ubuntuinstall 1.35M 3.74G 400M /
rpool/home 8.49M 3.74G 96K /home
rpool/home/root 124K 3.74G 124K /root
rpool/home/trochej 8.27M 3.74G 8.27M /home/trochej
rpool/swap 1.06G 4.80G 64K -
rpool/var 866M 3.74G 96K /var
rpool/var/cache 865M 3.74G 865M /var/cache
rpool/var/log 768K 3.74G 768K /var/log
rpool/var/spool 104K 3.74G 104K /var/spool
rpool/var/tmp 132K 3.74G 132K /var/tmp

2. Create a snapshot and clone:

root@ubuntuzfs:~# zfs snapshot rpool/ROOT/ubuntu@install

root@ubuntuzfs:~# zfs clone rpool/ROOT/ubuntu@install rpool/ROOT/ubuntuinstall

root@ubuntuzfs:~# zfs set canmount=noauto rpool/ROOT/ubuntuinstall

root@ubuntuzfs:~# zfs set mountpoint=/ rpool/ROOT/ubuntuinstall

3. Added Ubuntu Clone entry to /boot/grub/grub.cfg:

menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-3da0b77e44dee80b' {
        recordfail
        load_video
        gfxmode $linux_gfx_mode
        insmod gzio
        if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
        insmod part_gpt
        insmod zfs
        set root='hd0,gpt1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1 3da0b77e44dee80b
        else
          search --no-floppy --fs-uuid --set=root 3da0b77e44dee80b
        fi
        linux /ROOT/ubuntu@/boot/vmlinuz-4.4.0-22-generic root=ZFS=rpool/ROOT/ubuntu ro quiet splash $vt_handoff
        initrd /ROOT/ubuntu@/boot/initrd.img-4.4.0-22-generic
}
menuentry 'Ubuntu Clone' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-3da0b77e44dee80b' {
        recordfail
        load_video
        gfxmode $linux_gfx_mode
        insmod gzio
        if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
        insmod part_gpt
        insmod zfs
        set root='hd0,gpt1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1 3da0b77e44dee80b
        else
          search --no-floppy --fs-uuid --set=root 3da0b77e44dee80b
        fi
        linux /ROOT/ubuntu@/boot/vmlinuz-4.4.0-22-generic root=ZFS=rpool/ROOT/ubuntuinstall ro quiet splash $vt_handoff
        initrd /ROOT/ubuntu@/boot/initrd.img-4.4.0-22-generic
}

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.