4 . $(dirname $0)/conf.sh
11 md=$(mdconfig -s40m) || exit 1
19 out=$(fsck_ffs -Ffy ${md}a.eli)
20 if [ $? -eq 0 -o $? -eq 7 ]; then
21 echo "ok $i - fsck says ${md}a.eli is clean"
23 echo "not ok $i - fsck says ${md}a.eli is dirty"
29 partszMB=$1 unitszMB=$2
32 echo a: $(($partszMB * $BLKS_PER_MB)) 0 4.2BSD 1024 8192
33 echo c: $(($unitszMB * $BLKS_PER_MB)) 0 unused 0 0
34 } | disklabel -R $md /dev/stdin
39 setsize 10 40 || echo -n "not "
40 echo ok $i - "Sized ${md}a to 10m"
44 geli init -Bnone -PKtmp.key ${md}a || echo -n "not "
45 echo ok $i - "Initialised geli on ${md}a"
47 geli attach -pk tmp.key ${md}a || echo -n "not "
48 echo ok $i - "Attached ${md}a as ${md}a.eli"
51 newfs -U ${md}a.eli >/dev/null || echo -n "not "
52 echo ok $i - "Initialised the filesystem on ${md}a.eli"
56 # Doing a backup, resize & restore must be forced (with -f) as geli
57 # verifies that the provider size in the metadata matches the consumer.
59 geli backup ${md}a tmp.meta || echo -n "not "
60 echo ok $i - "Backed up ${md}a metadata"
63 geli detach ${md}a.eli || echo -n "not "
64 echo ok $i - "Detached ${md}a.eli"
67 setsize 20 40 || echo -n "not "
68 echo ok $i - "Sized ${md}a to 20m"
70 geli attach -pktmp.key ${md}a && echo -n "not "
71 echo ok $i - "Attaching ${md}a fails after resizing the consumer"
74 geli restore tmp.meta ${md}a && echo -n "not "
75 echo ok $i - "Restoring metadata on ${md}a.eli fails without -f"
77 geli restore -f tmp.meta ${md}a || echo -n "not "
78 echo ok $i - "Restoring metadata on ${md}a.eli can be forced"
81 geli attach -pktmp.key ${md}a || echo -n "not "
82 echo ok $i - "Attaching ${md}a is now possible"
85 growfs -y ${md}a.eli >/dev/null || echo -n "not "
86 echo ok $i - "Extended the filesystem on ${md}a.eli"
91 # Now do the resize properly
93 geli detach ${md}a.eli || echo -n "not "
94 echo ok $i - "Detached ${md}a.eli"
97 setsize 30 40 || echo -n "not "
98 echo ok $i - "Sized ${md}a to 30m"
101 geli resize -s20m ${md}a || echo -n "not "
102 echo ok $i - "Resizing works ok"
104 geli resize -s20m ${md}a && echo -n "not "
105 echo ok $i - "Resizing doesn't work a 2nd time (no old metadata)"
108 geli attach -pktmp.key ${md}a || echo -n "not "
109 echo ok $i - "Attaching ${md}a works ok"
112 growfs -y ${md}a.eli >/dev/null || echo -n "not "
113 echo ok $i - "Extended the filesystem on ${md}a.eli"
118 geli detach ${md}a.eli
119 gpart destroy -F $md >/dev/null
122 # Verify that the man page example works, changing ada0 to $md,
123 # 1g to 20m, 2g to 30m and keyfile to tmp.key, and adding -B none
126 gpart create -s GPT $md || echo -n "not "
127 echo ok $i - "Installed a GPT on ${md}"
129 gpart add -s 20m -t freebsd-ufs -i 1 $md || echo -n "not "
130 echo ok $i - "Added a 20m partition in slot 1"
132 geli init -B none -K tmp.key -P ${md}p1 || echo -n "not "
133 echo ok $i - "Initialised geli on ${md}p1"
135 gpart resize -s 30m -i 1 $md || echo -n "not "
136 echo ok $i - "Resized partition ${md}p1 to 30m"
138 geli resize -s 20m ${md}p1 || echo -n "not "
139 echo ok $i - "Resized geli on ${md}p1 to 30m"
141 geli attach -k tmp.key -p ${md}p1 || echo -n "not "
142 echo ok $i - "Attached ${md}p1.eli"
145 geli detach ${md}p1.eli