4 . $(dirname $0)/conf.sh
11 md=$(attach_md -t malloc -s40m)
18 out=$(fsck_ffs -Ffy ${md}a.eli)
19 if [ $? -eq 0 -o $? -eq 7 ]; then
20 echo "ok $i - fsck says ${md}a.eli is clean"
22 echo "not ok $i - fsck says ${md}a.eli is dirty"
30 gpart resize -i 1 -s ${partszMB}m ${md}
35 gpart create -s BSD ${md}
36 gpart add -t freebsd-ufs -s 10m ${md}
37 setsize 10 || echo -n "not "
38 echo ok $i - "Sized ${md}a to 10m"
42 geli init -Bnone -PKtmp.key ${md}a || echo -n "not "
43 echo ok $i - "Initialised geli on ${md}a"
45 geli attach -pk tmp.key ${md}a || echo -n "not "
46 echo ok $i - "Attached ${md}a as ${md}a.eli"
49 newfs -U ${md}a.eli >/dev/null || echo -n "not "
50 echo ok $i - "Initialised the filesystem on ${md}a.eli"
54 # Doing a backup, resize & restore must be forced (with -f) as geli
55 # verifies that the provider size in the metadata matches the consumer.
57 geli backup ${md}a tmp.meta || echo -n "not "
58 echo ok $i - "Backed up ${md}a metadata"
61 geli detach ${md}a.eli || echo -n "not "
62 echo ok $i - "Detached ${md}a.eli"
65 setsize 20 || echo -n "not "
66 echo ok $i - "Sized ${md}a to 20m"
68 geli attach -pktmp.key ${md}a && echo -n "not "
69 echo ok $i - "Attaching ${md}a fails after resizing the consumer"
72 geli restore tmp.meta ${md}a && echo -n "not "
73 echo ok $i - "Restoring metadata on ${md}a.eli fails without -f"
75 geli restore -f tmp.meta ${md}a || echo -n "not "
76 echo ok $i - "Restoring metadata on ${md}a.eli can be forced"
79 geli attach -pktmp.key ${md}a || echo -n "not "
80 echo ok $i - "Attaching ${md}a is now possible"
83 growfs -y ${md}a.eli >/dev/null || echo -n "not "
84 echo ok $i - "Extended the filesystem on ${md}a.eli"
89 # Now do the resize properly
91 geli detach ${md}a.eli || echo -n "not "
92 echo ok $i - "Detached ${md}a.eli"
95 setsize 30 || echo -n "not "
96 echo ok $i - "Sized ${md}a to 30m"
99 geli resize -s20m ${md}a || echo -n "not "
100 echo ok $i - "Resizing works ok"
102 geli resize -s20m ${md}a && echo -n "not "
103 echo ok $i - "Resizing doesn't work a 2nd time (no old metadata)"
106 geli attach -pktmp.key ${md}a || echo -n "not "
107 echo ok $i - "Attaching ${md}a works ok"
110 growfs -y ${md}a.eli >/dev/null || echo -n "not "
111 echo ok $i - "Extended the filesystem on ${md}a.eli"
116 geli detach ${md}a.eli
117 gpart destroy -F $md >/dev/null
120 # Verify that the man page example works, changing ada0 to $md,
121 # 1g to 20m, 2g to 30m and keyfile to tmp.key, and adding -B none
124 gpart create -s GPT $md || echo -n "not "
125 echo ok $i - "Installed a GPT on ${md}"
127 gpart add -s 20m -t freebsd-ufs -i 1 $md || echo -n "not "
128 echo ok $i - "Added a 20m partition in slot 1"
130 geli init -B none -K tmp.key -P ${md}p1 || echo -n "not "
131 echo ok $i - "Initialised geli on ${md}p1"
133 gpart resize -s 30m -i 1 $md || echo -n "not "
134 echo ok $i - "Resized partition ${md}p1 to 30m"
136 geli resize -s 20m ${md}p1 || echo -n "not "
137 echo ok $i - "Resized geli on ${md}p1 to 30m"
139 geli attach -k tmp.key -p ${md}p1 || echo -n "not "
140 echo ok $i - "Attached ${md}p1.eli"
143 geli detach ${md}p1.eli