2 # test btrfstune uuid rewriting options
4 source "$TEST_TOP/common"
6 check_prereq mkfs.btrfs
13 run_check_stdout $TOP/btrfs inspect-internal dump-super "$1" | \
14 grep '^fsid' | awk '{print $2}'
21 origuuid=11111111-a101-4031-b29a-379d4f8b7a2d
23 run_check $SUDO_HELPER $TOP/mkfs.btrfs -f \
25 --rootdir $INTERNAL_BIN/Documentation \
27 run_check $TOP/btrfs inspect-internal dump-super "$TEST_DEV"
28 currentfsid=$(run_check_stdout $TOP/btrfstune -f -u $TEST_DEV | \
29 grep -i 'current fsid:' | awk '{print $3}')
30 if ! [ $currentfsid = $origuuid ]; then
31 _fail "FAIL: current UUID mismatch"
33 run_check $TOP/btrfs inspect-internal dump-super "$TEST_DEV"
34 run_check $SUDO_HELPER $TOP/btrfs check $TEST_DEV
42 origuuid=22222222-d324-4f92-80e9-7658bf3b845f
43 newuuid=33333333-bfc9-4045-9399-a396dc6893b3
45 run_check $SUDO_HELPER $TOP/mkfs.btrfs -f \
47 --rootdir $INTERNAL_BIN/Documentation \
49 run_check $TOP/btrfs inspect-internal dump-super "$TEST_DEV"
50 run_check $TOP/btrfstune -f -U $newuuid \
52 # btrfs inspect-internal dump-super is called within get_fs_uuid
53 fsid=$(get_fs_uuid $TEST_DEV)
54 if ! [ $fsid = $newuuid ]; then
55 _fail "FAIL: UUID not rewritten"
57 run_check $SUDO_HELPER $TOP/btrfs check $TEST_DEV