4 atf_test_case resize cleanup
7 atf_set "descr" "geli resize will resize a geli provider"
8 atf_set "require.user" "root"
12 . $(atf_get_srcdir)/conf.sh
16 md=$(attach_md -t malloc -s40m)
19 atf_check -s exit:0 -o ignore gpart create -s BSD ${md}
20 atf_check -s exit:0 -o ignore gpart add -t freebsd-ufs -s 10m ${md}
23 atf_check geli init -Bnone -PKtmp.key ${md}a
24 atf_check geli attach -pk tmp.key ${md}a
26 atf_check -s exit:0 -o ignore newfs -U ${md}a.eli
27 atf_check -s exit:7 -o ignore fsck_ffs -Ffy ${md}a.eli
29 # Doing a backup, resize & restore must be forced (with -f) as geli
30 # verifies that the provider size in the metadata matches the consumer.
32 atf_check geli backup ${md}a tmp.meta
33 atf_check geli detach ${md}a.eli
34 atf_check -s exit:0 -o match:resized gpart resize -i1 -s 20m ${md}
35 atf_check -s not-exit:0 -e ignore geli attach -pktmp.key ${md}a
36 atf_check -s not-exit:0 -e ignore geli restore tmp.meta ${md}a
37 atf_check geli restore -f tmp.meta ${md}a
38 atf_check geli attach -pktmp.key ${md}a
39 atf_check -s exit:0 -o ignore growfs -y ${md}a.eli
40 atf_check -s exit:7 -o ignore fsck_ffs -Ffy ${md}a.eli
42 # Now do the resize properly
44 atf_check geli detach ${md}a.eli
45 atf_check -s exit:0 -o match:resized gpart resize -i1 -s 30m ${md}
46 atf_check geli resize -s20m ${md}a
47 atf_check -s not-exit:0 -e match:"Inconsistent provider.*metadata" \
48 geli resize -s20m ${md}a
49 atf_check geli attach -pktmp.key ${md}a
50 atf_check -s exit:0 -o ignore growfs -y ${md}a.eli
51 atf_check -s exit:7 -o ignore fsck_ffs -Ffy ${md}a.eli
53 atf_check geli detach ${md}a.eli
54 atf_check -s exit:0 -o ignore gpart destroy -F $md
57 # Verify that the man page example works, changing ada0 to $md,
58 # 1g to 20m, 2g to 30m and keyfile to tmp.key, and adding -B none
61 atf_check -s exit:0 -o ignore gpart create -s GPT $md
62 atf_check -s exit:0 -o ignore gpart add -s 20m -t freebsd-ufs -i 1 $md
63 atf_check geli init -B none -K tmp.key -P ${md}p1
64 atf_check -s exit:0 -o match:resized gpart resize -s 30m -i 1 $md
65 atf_check geli resize -s 20m ${md}p1
66 atf_check geli attach -k tmp.key -p ${md}p1
70 . $(atf_get_srcdir)/conf.sh
72 if [ -f "$TEST_MDS_FILE" ]; then
74 [ -c /dev/${md}a.eli ] && \
75 geli detach ${md}a.eli 2>/dev/null
76 [ -c /dev/${md}p1.eli ] && \
77 geli detach ${md}p1.eli
78 [ -c /dev/${md}.eli ] && \
79 geli detach ${md}.eli 2>/dev/null
80 mdconfig -d -u $md 2>/dev/null
87 atf_add_test_case resize