ZFS Boot Environments Reloaded NLUUG ZFS Boot Environments Reloaded
Total Page:16
File Type:pdf, Size:1020Kb
ZFS Boot Environments Reloaded NLUUG ZFS Boot Environments Reloaded Sławomir Wojciech Wojtczak [email protected] vermaden.wordpress.com twitter.com/vermaden https://is.gd/BECTL ntro !"#$%##%#& ZFS Boot Environments Reloaded NLUUG What is ZFS Boot Environment? Its bootable clone%sna(shot of the working system. What it is' !"#$%##%#& ZFS Boot Environments Reloaded NLUUG What is ZFS Boot Environment? Its bootable clone%sna(shot of the working system. ● In ZFS terminology its clone of the snapshot. ZFS dataset → ZFS dataset@snapshot → ZFS clone (origin=dataset@snapshot) What it is' !"#$%##%#& ZFS Boot Environments Reloaded NLUUG What is ZFS Boot Environment? Its bootable clone%sna(shot of the working system. ● In ZFS terminology its clone of the snapshot. ZFS dataset → ZFS dataset@snapshot → ZFS clone (origin=dataset@snapshot) ● In ZFS (as everywhere) sna(shot is read onl). What it is' !"#$%##%#& ZFS Boot Environments Reloaded NLUUG What is ZFS Boot Environment? Its bootable clone%sna(shot of the working system. ● In ZFS terminology its clone of the snapshot. ZFS dataset → ZFS dataset@snapshot → ZFS clone (origin=dataset@snapshot) ● In ZFS (as everywhere) sna(shot is read onl). ● In ZFS clone can be mounted read write (and you can boot from it). What it is' !"#$%##%#& ZFS Boot Environments Reloaded NLUUG What is ZFS Boot Environment? Its bootable clone%sna(shot of the working system. ● In ZFS terminology its clone of the snapshot. ZFS dataset → ZFS dataset@snapshot → ZFS clone (origin=dataset@snapshot) ● In ZFS (as everywhere) sna(shot is read onl). ● In ZFS clone can be mounted read write (and you can boot from it). ● The B s are !laced in the (ool/R**+ ZFS dataset !ath. sys/ROOT/default sys/ROOT/safe sys/ROOT/pre-upgrade ( .) What it is' !"#$%##%#& ZFS Boot Environments Reloaded NLUUG Use cases' "llows ,ullet(roo. upgrades/changes to the system. Use cases' !"#$%##%#& ZFS Boot Environments Reloaded NLUUG Use cases' "llows ,ullet(roo. upgrades/changes to the system. ● Create sa.e .ail,ack ZFS Boot nvironment before u!grade or major changes to system. Use cases' !"#$%##%#& ZFS Boot Environments Reloaded NLUUG Use cases' "llows ,ullet(roo. upgrades/changes to the system. ● Create sa.e .ail,ack ZFS Boot nvironment before u!grade or major changes to system. ● &!date system inside new ZFS Boot nvironment without touching running system. Use cases' !"#$%##%#& ZFS Boot Environments Reloaded NLUUG Use cases' "llows ,ullet(roo. upgrades/changes to the system. ● Create sa.e .ail,ack ZFS Boot nvironment before u!grade or major changes to system. ● &!date system inside new ZFS Boot nvironment without touching running system. ● 'erform u!grade and test the results inside FreeBSD 0ail. Use cases' !"#$%##%#& ZFS Boot Environments Reloaded NLUUG Use cases' "llows ,ullet(roo. upgrades/changes to the system. ● Create sa.e .ail,ack ZFS Boot nvironment before u!grade or major changes to system. ● &!date system inside new ZFS Boot nvironment without touching running system. ● 'erform u!grade and test the results inside FreeBSD 0ail. ● 1o()%move ZFS Boot nvironment into another machine. Use cases' !"#$%##%#& ZFS Boot Environments Reloaded NLUUG Use cases' "llows ,ullet(roo. upgrades/changes to the system. ● Create sa.e .ail,ack ZFS Boot nvironment before u!grade or major changes to system. ● &!date system inside new ZFS Boot nvironment without touching running system. ● 'erform u!grade and test the results inside FreeBSD 0ail. ● 1o()%move ZFS Boot nvironment into another machine. ● 2ajor recon34-ration (Bareos/Post()#*). Use cases' !"#$%##%#& ZFS Boot Environments Reloaded NLUUG Use cases' "llows ,ullet(roo. upgrades/changes to the system. ● Create sa.e .ail,ack ZFS Boot nvironment before u!grade or major changes to system. ● &!date system inside new ZFS Boot nvironment without touching running system. ● 'erform u!grade and test the results inside FreeBSD 0ail. ● 1o()%move ZFS Boot nvironment into another machine. ● 2ajor recon34-ration (Bareos/Post()#*). ● 2ass (o(-late large amount of servers with one con(gured B . Use cases' !"#$%##%#& ZFS Boot Environments Reloaded NLUUG Use cases' "llows ,ullet(roo. upgrades/changes to the system. ● Create sa.e .ail,ack ZFS Boot nvironment before u!grade or major changes to system. ● &!date system inside new ZFS Boot nvironment without touching running system. ● 'erform u!grade and test the results inside FreeBSD 0ail. ● 1o()%move ZFS Boot nvironment into another machine. ● 2ajor recon34-ration (Bareos/Post()#*). ● 2ass (o(-late large amount of servers with one con(gured B . ● Bare metal ,ack-( solution. Use cases' !"#$%##%#& ZFS Boot Environments Reloaded NLUUG Can I test and break ZFS BEs witho-t conse5-ences' Bullet(roo. !"#$%##%#& ZFS Boot Environments Reloaded NLUUG Can I test and break ZFS BEs witho-t conse5-ences' +es you can, *ver and over again. Bullet(roo. !"#$%##%#& ZFS Boot Environments Reloaded NLUUG Can I test and break ZFS BEs witho-t conse5-ences' +es you can, *ver and over again. -roundhog .ay (1001) Bullet(roo. !"#$%##%#& ZFS Boot Environments Reloaded NLUUG 6ow the World was be.ore BEs' 2endors used s(lit mirror or co(yin4 3les to the other#second disk. B2 7 8 SUN Solaris Live Upgrade alt_disk_copy lucreate alt_disk_install luactivate nimadm luupgrade unmirrorvg ludelete (...) (...) 69:U8 GNU/Lin-; lvsplit mdadm lvmerge mirrorlv vgchange lvconvert vgcfgrestore (...) (...) /ark ages !"#$%##%#& ZFS Boot Environments Reloaded NLUUG 2istyped command? Felling luck)3 4aiders of the 5ost "rk (106/) *ne mistake and )o- have a disaster ... recover) !"#$%##%#& ZFS Boot Environments Reloaded 'olish BSD UserNLUUG Grou! +he beadm command 7ne simple command 8 beadm 8 to create#activate#destroy ZFS Boot nvironments. # beadm usage: beadm activate <beName> beadm create [-e nonActiveBe | -e beName@snapshot] <beName> beadm create <beName@snapshot> beadm destroy [-F] <beName | beName@snapshot> beadm list [-a] [-s] [-D] [-H] beadm rename <origBeName> <newBeName> beadm mount <beName> [mountpoint] beadm { umount | unmount } [-f] <beName> beadm version beadm command !"#$%##%#& ZFS Boot Environments Reloaded NLUUG +he beadm is written in P*S 8 /bin/sh beadm code !"#$%##%#& ZFS Boot Environments Reloaded NLUUG Example beadm usa4e (1/5) 5ist current B s and create new one named new,e. # beadm list BE Active Mountpoint Space Created 11.2-RELEASE NR / 6.3G 2018-11-15 16:01 # beadm create newbe Created successfully # beadm list BE Active Mountpoint Space Created 11.2-RELEASE NR / 6.3G 2018-11-15 16:01 newbe - - 296.0K 2018-11-15 17:04 E;am(le #%& !"#$%##%#& ZFS Boot Environments Reloaded NLUUG E;ample beadm usa4e (2/5) 2erify which sna(shot is used for this clone used as new,e B . # beadm list -s BE/Dataset/Snapshot Active Mountpoint Space Created 11.2-RELEASE sys/ROOT/11.2-RELEASE NR / 6.3G 2018-11-15 16:01 sys/ROOT/11.2-RELEASE@2018-11-15-17:04:22 - - 288.0K 2018-11-15 10:04 newbe sys/ROOT/newbe - - 8.0K 2018-11-15 10:04 11.2-RELEASE@2018-11-15-17:04:22 - - 288.0K 2018-11-15 10:04 # zfs get origin sys/ROOT/newbe NAME PROPERTY VALUE SOURCE sys/ROOT/newbe origin sys/ROOT/11.2-RELEASE@2018-11-15-17:04:22 - E;am(le !%& !"#$%##%#& ZFS Boot Environments Reloaded 'olish BSD UserNLUUG Grou! E;ample beadm -sage (3/5) 4ename sna(shot used for this clone. # zfs rename sys/ROOT/11.2-RELEASE@2018-11-15-17:04:22 sys/ROOT/11.2-RELEASE@newbe # zfs get origin sys/ROOT/newbe NAME PROPERTY VALUE SOURCE sys/ROOT/newbe origin sys/ROOT/11.2-RELEASE@newbe - # beadm list -s BE/Dataset/Snapshot Active Mountpoint Space Created 11.2-RELEASE sys/ROOT/11.2-RELEASE NR / 6.3G 2018-11-15 16:01 sys/ROOT/11.2-RELEASE@newbe - - 516.0K 2018-11-15 17:04 newbe sys/ROOT/newbe - - 8.0K 2018-11-15 17:04 11.2-RELEASE@newbe - - 516.0K 2018-11-15 17:04 E;am(le =%& !"#$%##%#& ZFS Boot Environments Reloaded NLUUG Example beadm usa4e (4/5) "ctivate the new,e B to be booted after the restart. # beadm list BE Active Mountpoint Space Created 11.2-RELEASE NR / 6.4G 2018-11-15 16:01 newbe - - 68.8M 2018-11-15 17:04 # beadm activate newbe Activated successfully # beadm list BE Active Mountpoint Space Created 11.2-RELEASE N / 187.5M 2018-11-15 16:01 newbe R - 6.3G 2018-11-15 17:04 Exam(le >%& !"#$%##%#& ZFS Boot Environments Reloaded NLUUG Example beadm usa4e (5/5) 4emove new,e. It will ask for additional con(rmation as we renamed sna!shot. # beadm list BE Active Mountpoint Space Created 11.2-RELEASE NR / 6.4G 2018-11-15 16:01 newbe - - 68.8M 2018-11-15 17:04 # beadm destroy newbe Are you sure you want to destroy 'newbe'? This action cannot be undone (y/[n]): y Boot environment 'newbe' was created from existing snapshot Destroy '11.2-RELEASE@newbe' snapshot? (y/[n]): y Destroyed successfully # beadm list BE Active Mountpoint Space Created 11.2-RELEASE NR / 6.4G 2018-11-15 16:01 Exam(le &%& !"#$%##%#& ZFS Boot Environments Reloaded NLUUG FreeBS/ loader inte4ration Selection of B at boot is integrated into the FreeBSD loader. FreeBSD loader integration #%! !"#$%##%#& ZFS Boot Environments Reloaded NLUUG FreeBS/ loader inte4ration The test B is selected to boot instead of the default one. FreeBSD loader integration !%! !"#$%##%#& ZFS Boot Environments Reloaded NLUUG Not j-st FreeBS/ loader <<< Its integrated into other o(eratin4 systems as well. ● BSDs ● FreeBS. ● HardenedBS. (rolling Free!SD for#) ● ll-mos ● 7!enIndiana ● OmniOS Not j-st FreeBS/ loader <<< !"#$%##%#& ZFS Boot Environments Reloaded NLUUG Not j-st FreeBS/ loader <<< Its integrated idea implemented into other o(eratin4 systems as well. ● BSDs EuroBSDcon 2018 : B-ildin4 Boot Environment 2anager .or /ragonFly BSD ● FreeBS. "s many users may be aware; .ragonFly BSD<s recently declared the 9"== 4> ● HardenedBS.