Z F S B
- t
E n v i r
- n
m e n t s R e l
- a
d e d
S ł a w
- m
i r W
- j
c i e c h W
- j
t c z a k vermaden@interia.pl vermaden.wordpress.com twitter.com/vermaden https://is.gd/BECTL Z F S B
- t
E n v i r
- n
m e n t s R e l
- a
d e d
N L U U G
I n t r
- 2
Z F S B o o t E n v i r o n m e n t s R e l o - - PowerPoint PPT Presentation
N L U U G Z F S B o o t E n v i r o n m e n t s R e l o a d e d Z F S B o o t E n v i r o n m e n t s R e l o a d e d S a w o m i r W o j c i e c h W o j t c z a k
G r
n d h
D a y ( 1 9 9 3 )
R a i d e r s
t h e L
t A r k ( 1 9 8 1 )
A s ma n y u s e r s ma y b e a w a r e , D r a g
F l y B S D ’ s r e c e n t l y d e c l a r e d t h e H A M M E R 2 fi l e s y s t e m t
e s t a b l e a n d s u i t a b l e f
u s e . S i n c e t h i s i s a C
fi l e s y s t e m, a n d a l l
s mo u n t i n g
a r b i t r a r y s n a p s h
s
a n y P F S ( a n a l a g
s t
F S d a t a s e t s ) , w e c a n d e fi n e a c u s t
s c h e me
c r e a t i n g a n d ma n a g i n g s n a p s h
s
a n y mo u n t e d H A M M E R 2 P F S e s a n d u p d a t i n g t h e f s t a b a c c
d i n g l y . T u r n s
t b e a d m ( 1 ) i s a s h e l l s c r i p t . W h i l e i n v e s t i g a t i n g h
b e a d m a c t u a l l y g e t s Z F S d a t a s e t i n f
ma t i
, I d i s c
e r e d i t ’ s a c t u a l l y a v e r y c l e v e r mi x
s h a n d a w k , w h i c h i s n
w h a t I e x p e c t e d . S i n c e I ’ m u s i n g C , t h i n g s a r e a b i t mo r e c
l e x . S
’ v e h a d t
e t i n t
h e V F S l a y e r
D r a g
F l y B S D t
u e r y w h i c h fi l e s y s t e ms a r e mo u n t e d , a n d t h e n g e t a n d ma n i p u l a t e t h e i r n a me s i n t e r n a l l y , w h i c h h a s q u i c k l y t u r n e d i n t
mu c h mo r e c
l e x t a s k t h a n i n i t i a l l y e x p e c t e d .
# manageBE create -n 9_20120321 -s 9_20120317 -p zroot manageBE: cannot create /zroot/ROOT/9_20120321/boot/loader.conf: No such file or directory manageBE: cannot create /zroot/ROOT/9_20120321/etc/fstab: No such file or directory The new Boot-Environment is ready to be updated and/or activated.
# manageBE list Poolname: zroot BE Active Active Mountpoint Space Name Now Reboot - Used
9_20120321 no no /ROOT/9_20120321 145M 9_20120317 yes yes / 1.59G Used by BE snapshots: 1.99G
# bectl usage: bectl {-h | -? | subcommand [args...]} bectl activate [-t] beName bectl create [-e {nonActiveBe | -e beName@snapshot}] beName bectl create beName@snapshot bectl destroy [-F] {beName | beName@snapshot} bectl export sourceBe bectl import targetBe bectl jail [{-b | -U}] [{-o key=value | -u key}]... bootenv [utility [argument ...]] bectl list [-a] [-D] [-H] [-s] bectl mount beName [mountpoint] bectl rename origBeName newBeName bectl {ujail | unjail} jailID | jailName | bootenv)
# beadm create ASD Created successfully # # beadm activate ASD Activated successfully # # beadm list BE Active Mountpoint Space Created 11.2 N / 7.0G 2018-11-15 16:01 ASD R - 6.9M 2018-11-15 17:29 # beadm destroy ASD Are you sure you want to destroy 'ASD'? This action cannot be undone (y/[n]): y Destroyed successfully # # beadm rename ASD NEW Renamed successfully #
# bectl create ASD # (silent creation) # bectl activate ASD successfully activated boot environment ASD # # bectl list BE Active Mountpoint Space Created 12.0 N / 471M 2018-11-15 13:15 ASD R - 448K 2018-11-15 14:03 # bectl destroy ASD # (no confirmation for destroy) # bectl rename ASD NEW # (silent rename)
freebsd12 # hostname freebsd12.local freebsd12 # sysctl security.jail.jailed security.jail.jailed: 0 freebsd12 # bectl jail ASD # hostname ASD # sysctl security.jail.jailed security.jail.jailed: 1 # (you are directly in newly created FreeBSD Jail within ‘ASD’ ZFS Boot Environment)
freebsd12 # mount | grep ASD zroot/ROOT/ASD on /tmp/be_mount.WR1F (zfs, local, noatime, nfsv4acls) freebsd12 # jls -a JID IP Address Hostname Path 1 ASD /tmp/be_mount.WR1F
# bectl export ASD bectl export: must redirect output # bectl export ASD > ASD.raw # file ASD.raw | tr ',' '\n' ASD.raw: ZFS shapshot (little-endian machine) version 17 type: ZFS destination GUID: D9 72 9E 43 9C CF F9 A2 name: 'zroot/ROOT/NEW@2018-11-15-15:39:25' # bectl import NEW.raw bectl import: input can not be from terminal # bectl import NEW < NEW.raw # bectl list BE Active Mountpoint Space Created 12.0 NR / 905M 2018-11-15 13:24 ASD - - 448K 2018-11-15 15:39 NEW - - 471M 2018-11-15 16:44
# gpart show .> 40 16777136 ada0 GPT (8.0G) 40 1024 1 freebsd-boot (512K) 1064 984 - free - (492K) 2048 16773120 2 freebsd-zfs (8.0G) 16775168 2008 - free - (1.0M) # geli status Name Status Components ada0p2.eli ACTIVE ada0p2