4 # Functions useful for xfsdump/xfsrestore tests
6 # Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
8 # This program is free software; you can redistribute it and/or modify it
9 # under the terms of version 2 of the GNU General Public License as
10 # published by the Free Software Foundation.
12 # This program is distributed in the hope that it would be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 # Further, this software is distributed without any warranty that it is
17 # free of the rightful claim of any third person regarding infringement
18 # or the like. Any license provided herein, whether implied or
19 # otherwise, applies only to this software file. Patent licenses, if
20 # any, provided herein do not apply to combinations of this program with
21 # other software, or any other product whatsoever.
23 # You should have received a copy of the GNU General Public License along
24 # with this program; if not, write the Free Software Foundation, Inc., 59
25 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
27 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
28 # Mountain View, CA 94043, or:
32 # For further information regarding this notice, see:
34 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
37 # --- initializations ---
40 if [ -n "$DEBUGDUMP" ]; then
46 # Use dump/restore in qa directory for debugging
53 # status returned for not run tests
56 # name those directories
57 dump_file=$tmp.dumpfile
58 # dump_file=$here/dumpfile #TEMP OVERRIDE DUMP FILE
60 dump_dir=$SCRATCH_MNT/$dump_sdir
61 restore_sdir=restoredir
62 restore_dir=$SCRATCH_MNT/$restore_sdir
65 media_label="stress_tape_media"
66 session_label="stress_$seq"
68 nobody=4 # define this uid/gid as a number
69 do_quota_check=true # do quota check if quotas enabled
74 trap "_cleanup; exit \$status" 0 1 2 3 15
76 # start inventory from a known base - move it aside for test
77 for dir in /var/xfsdump/inventory /var/lib/xfsdump/inventory; do
79 [ -d $dir.$seq ] && rm -rf $dir.$seq
84 # remove this when xfstests irix/linux port done
85 if [ "X$XFS_HOST_OS" = "Xirix" ]
96 # do a remote/local mt
103 _rmtdev=`echo $dumptape | $AWK_PROG -F: '{print $2}'`
105 if echo $dumptape | grep '@' >/dev/null; then
106 _spec=`echo $dumptape | $AWK_PROG -F: '{print $1}'`
107 _rmtuser=`echo $_spec | $AWK_PROG -F@ '{print $1}'`
108 _rmthost=`echo $_spec | $AWK_PROG -F@ '{print $2}'`
109 rsh -n -l $_rmtuser $_rmthost "mt -t $_rmtdev $op"
111 _rmthost=`echo $dumptape | $AWK_PROG -F: '{print $1}'`
112 rsh -n $_rmthost "mt -t $_rmtdev $op"
124 while [ $i -lt $_limit ]; do
125 echo "Checking online..." >>$seq.full
126 if _mt status >$tmp.status 2>&1; then
135 if [ $i -eq $_limit ]; then
136 echo "ERROR: mt -f $dumptape failed"
139 echo "mt -f $dumptape failed" >$seq.notrun
145 if egrep -i 'onl|ready' $tmp.status | grep -iv 'not ready' >/dev/null; then
148 echo "ERROR: $dumptape is not online"
151 echo "dumptape, $dumptape, is not online" >$seq.notrun
159 echo "Wait for tape, $dumptape, ..." >>$seq.full
162 while [ $i -lt 20 ]; do
163 echo "Checking status..." >>$seq.full
164 if _mt status 2>&1 | tee -a $seq.full | egrep -i "onl|ready" >/dev/null; then
174 # Keep trying so we know we really have rewound
178 echo "Initiate rewind..." >>$seq.full
180 _mt rewind >/dev/null
185 # Do a custom erase because:
186 # (i) some machines don't support it
187 # (ii) some machines take forever to do it
191 echo "Erasing tape" | tee -a $seq.full
199 echo "Erasing tape" | tee -a $seq.full
205 echo $dumptape | grep ':' >/dev/null
213 $have_mtvariable || return
219 echo "Put scsi tape driver into variable block size mode"
220 mt -f $dumptape setblk 0
228 if [ -z "$dumptape" ]; then
229 echo "This test requires a dump tape - none was specified"
230 echo "No dump tape specified" >$seq.notrun
241 echo "Error: $*" | tee -a $seq.full
242 echo "(see $seq.full for details)"
251 mkfs -t xfs $MKFS_OPTS $SCRATCH_DEV>>$seq.full ||\
254 mount -t xfs $SCRATCH_DEV $SCRATCH_MNT >>$seq.full ||\
255 _error "mount failed"
259 # Cleanup created dirs and files
267 if [ -n "$DEBUGDUMP" ]; then
268 # save it for inspection
269 for dir in /var/xfsdump/inventory /var/lib/xfsdump/inventory; do
270 [ -d $dir ] || continue
271 tar -cvf $seq.inventory.tar $dir
272 ls -lR $dir >$seq.inventory.ls
276 # put inventory dir back
277 for dir in /var/xfsdump/inventory /var/lib/xfsdump/inventory; do
278 [ -d $dir.$seq ] || continue
279 rm -rf $dir # get rid of new one
283 if [ $status -ne $NOTRUNSTS ]; then
284 # Sleep added to stop _check_fs from complaining that the
285 # scratch_dev is still busy
288 _check_fs $SCRATCH_DEV
293 # ensure that bulkstat data will
294 # match with incore data
295 # by forcing disk data to be written out
299 umount $SCRATCH_MNT >>$seq.full ||\
300 _error "unmount failed"
301 mount -t xfs $SCRATCH_DEV $SCRATCH_MNT >>$seq.full ||\
302 _error "mount failed"
306 # Run src/fsstress to create a mixture of
307 # files,dirs,links,symlinks
309 # Pinched from test 013.
311 _create_dumpdir_stress()
313 echo "Creating directory system to dump using src/fsstress."
317 _param="-f link=10 -f creat=10 -f mkdir=10 -f truncate=5 -f symlink=10"
320 if ! mkdir $dump_dir; then
321 echo " failed to mkdir $dump_dir"
326 echo "-----------------------------------------------"
327 echo "fsstress : $_param"
328 echo "-----------------------------------------------"
329 if ! $here/src/fsstress $_param -s 1 $FSSTRESS_AVOID -n $_count -d $dump_dir >$tmp.out 2>&1
331 echo " fsstress (count=$_count) returned $? - see $seq.full"
333 echo "--------------------------------------" >>$here/$seq.full
334 echo "output from fsstress:" >>$here/$seq.full
335 echo "--------------------------------------" >>$here/$seq.full
336 cat $tmp.out >>$here/$seq.full
345 cat <<End-of-File >$tmp.config
346 # pathname size in bytes owner group
348 small 10 $nobody $nobody
349 big 102400 daemon sys
351 sub/big 102400 $nobody sys
353 sub/a 1 $nobody $nobody
354 sub/b 2 $nobody $nobody
355 sub/c 4 $nobody $nobody
356 sub/d 8 $nobody $nobody
357 sub/e 16 $nobody $nobody
358 sub/f 32 $nobody $nobody
359 sub/g 64 $nobody $nobody
360 sub/h 128 $nobody $nobody
361 sub/i 256 $nobody $nobody
362 sub/j 512 $nobody $nobody
363 sub/k 1024 $nobody $nobody
364 sub/l 2048 $nobody $nobody
365 sub/m 4096 $nobody $nobody
366 sub/n 8192 $nobody $nobody
368 sub/a00 100 $nobody $nobody
369 sub/b00 200 $nobody $nobody
370 sub/c00 400 $nobody $nobody
371 sub/d00 800 $nobody $nobody
372 sub/e00 1600 $nobody $nobody
373 sub/f00 3200 $nobody $nobody
374 sub/g00 6400 $nobody $nobody
375 sub/h00 12800 $nobody $nobody
376 sub/i00 25600 $nobody $nobody
377 sub/j00 51200 $nobody $nobody
378 sub/k00 102400 $nobody $nobody
379 sub/l00 204800 $nobody $nobody
380 sub/m00 409600 $nobody $nobody
381 sub/n00 819200 $nobody $nobody
383 sub/a000 1000 $nobody $nobody
384 sub/e000 16000 $nobody $nobody
385 sub/h000 128000 $nobody $nobody
386 sub/k000 1024000 $nobody $nobody
392 cat <<End-of-File >$tmp.config
393 # pathname size in bytes
395 smalll 10 $nobody $nobody
396 biggg 102400 $nobody $nobody
397 sub/smalll 10 $nobody $nobody
398 sub/biggg 102400 $nobody $nobody
402 _mk_fillconfig_perm()
404 # dir_guid: ugo=rwx,g+s on dir is for IRIX chmod(1)
406 cat <<End-of-File >$tmp.config
407 # pathname size/dir user group mode
409 file_suid 10 $nobody $nobody 04777
410 file_guid 10 $nobody $nobody 02777
411 file_sticky 10 $nobody $nobody 01777
412 file_mix1 10 $nobody $nobody 761
413 file_mix2 10 $nobody $nobody 642
414 dir_suid d $nobody $nobody 04777
415 dir_guid d $nobody $nobody ugo=rwx,g+s
416 dir_sticky d $nobody $nobody 01777
417 dir_mix1 d $nobody $nobody 761
418 dir_mix2 d $nobody $nobody 642
424 cat <<End-of-File >$tmp.config
425 # pathname size user group perm name value
427 smalll 10 $nobody $nobody 777 attr1 some_text
428 biggg 102400 $nobody $nobody 777 attr2 some_text2
429 sub/smalll 10 $nobody $nobody 777 attr3 some_text3
430 sub/biggg 102400 $nobody $nobody 777 attr4 some_text4
431 dir d $nobody $nobody 777 attr5 dir_text
433 # Add more files so that there are more than the number
435 # There are bugs in dump/restore for # non-dir files < # streams
436 # It can be tested in another configuration.
437 # It is a pathalogical case.
439 sub/a 1 $nobody $nobody
440 sub/b 2 $nobody $nobody
441 sub/c 4 $nobody $nobody
442 sub/d 8 $nobody $nobody
443 sub/e 16 $nobody $nobody
444 sub/f 32 $nobody $nobody
445 sub/g 64 $nobody $nobody
446 sub/h 128 $nobody $nobody
447 sub/i 256 $nobody $nobody
448 sub/j 512 $nobody $nobody
449 sub/k 1024 $nobody $nobody
450 sub/l 2048 $nobody $nobody
451 sub/m 4096 $nobody $nobody
452 sub/n 8192 $nobody $nobody
457 # Create a bunch of directories/files of different sizes
460 # Pinched from test 001.
462 _do_create_dumpdir_fill()
464 echo "Creating directory system to dump using src/fill."
466 mkdir -p $dump_dir ||\
467 _error "cannot mkdir \"$dump_dir\""
470 $verbose && echo -n "Setup "
471 sed -e '/^#/d' $tmp.config \
472 | while read file nbytes owner group perms ea_name ea_value
474 if [ $nbytes = "d" ]; then
484 echo "Error: cannot mkdir \"$dir\""
489 # create a directory/file
500 echo "Error: cannot mkdir \"$dir\""
506 if $here/src/fill $file $file $nbytes
511 echo "Error: cannot create \"$file\""
515 if [ -n "$owner" -a -n "$group" ]; then
516 chown $owner.$group $file
518 if [ -n "$perms" ]; then
521 if [ -n "$ea_name" -a -n "$ea_value" ]; then
522 attr -s $ea_name -V $ea_value $file
524 $verbose && echo -n "."
532 _create_dumpdir_fill()
536 _do_create_dumpdir_fill
540 _create_dumpdir_fill2()
544 _do_create_dumpdir_fill
548 _create_dumpdir_fill_perm()
552 _do_create_dumpdir_fill
556 _create_dumpdir_fill_ea()
560 _do_create_dumpdir_fill
566 # Append a subset of the fill'ed files
567 # So we can see if just these get dumped on an incremental
569 _append_dumpdir_fill()
572 cat <<End-of-File >$tmp.config
582 sed -e '/^#/d' $tmp.config \
585 echo 'Extra text' >>$file
592 _do_create_dump_symlinks()
594 echo "Creating directory system of symlinks to dump."
596 mkdir -p $dump_dir ||\
597 _error "cannot mkdir \"$dump_dir\""
600 $verbose && echo -n "Setup "
601 sed -e '/^#/d' $tmp.config \
602 | while read file nbytes owner group owner2 group2 perms perms2
614 echo "Error: cannot mkdir \"$dir\""
622 # Do chmod on symlink using umask.
623 # This won't do the right thing as it subtracts permissions.
624 # However, I don't care, as long as I get some different perms
626 if [ -n "$perms2" ]; then
630 ln -s $file $file-link
631 if [ -n "$perms2" ]; then
635 if [ -n "$owner" -a -n "$group" ]; then
636 chown $owner.$group $file
638 if [ -n "$owner" -a -n "$group" ]; then
639 chown -h $owner.$group $file-link
641 if [ -n "$perms" ]; then
644 $verbose && echo -n "."
653 cat <<End-of-File >$tmp.config
654 # path size owner1 group1 owner2 group2 perm1 perm2
656 a 0 $nobody $nobody daemon sys 124 421
657 b 0 daemon sys bin bin 347 743
658 sub/a 0 bin bin $nobody sys 777 777
659 sub/b 0 $nobody sys $nobody $nobody 367 763
663 _create_dumpdir_symlinks()
667 _do_create_dump_symlinks
672 # create hardlinks of form $_fname, $_fname_h1 $_fname_h2 ...
681 while [ $_j -le $_numlinks ]; do
683 _hardlink=$_fname$_suffix
684 echo "creating hardlink $_hardlink to $_fname"
685 ln $_fname $_hardlink
691 # create a set of hardlinks
692 # create hardlinks of form file1, file1_h1 file1_h2 ...
693 # create hardlinks of form file2, file2_h1 file2_h2 ...
694 # create hardlinks of form file3, file3_h1 file3_h2 ...
700 while [ $_i -le $_numsets ]; do
701 _create_hardlinks file$_i 5
710 echo "mod level $_level" >$dump_dir/file$_level
713 _create_dumpdir_hardlinks()
717 echo "Creating directory system of hardlinks to incrementally dump."
719 mkdir -p $dump_dir ||\
720 _error "cannot mkdir \"$dump_dir\""
723 _create_hardset $_numsets
731 # Filter out dates on symlinks and char devices
736 /^l/ { date = $8; sub(date,"DATE"); print}
737 /^c/ { date = $9; sub(date,"DATE"); print}
739 | sed -e 's/total [0-9][0-9]*/total TOTAL/'
744 # Filter out the non-deterministic dump msgs from
745 # xfsdump and xfsrestore
750 -e "s/`hostname`/HOSTNAME/" \
751 -e "s#$SCRATCH_DEV#SCRATCH_DEV#" \
752 -e "s#$SCRATCH_RAWDEV#SCRATCH_DEV#" \
753 -e "s#$dumptape#TAPE_DEV#" \
754 -e "s#$SCRATCH_MNT#SCRATCH_MNT#" \
755 -e "s#$dump_file#DUMP_FILE#" \
756 -e 's#/var/lib/xfsdump#/var/xfsdump#' \
757 -e 's/id:[ ]*[0-9a-f-]*/id: ID/' \
758 -e 's/time:[ ].*/time: TIME/' \
759 -e 's/date:[ ].*/date: DATE/' \
760 -e 's/dump begun .*/dump begun DATE/' \
761 -e 's/[0-9][0-9]* seconds/SECS seconds/' \
762 -e 's/restore.[0-9][0-9]*/restore.PID/' \
763 -e 's/ino [0-9][0-9]*/ino INO/' \
764 -e '/: dump size/s/[0-9][0-9]*/NUM/' \
765 -e '/dump size:/s/[0-9][0-9]*/NUM/' \
766 -e '/dump size per stream:/s/[0-9][0-9]*/NUM/' \
767 -e 's/\(media file size[ ]*\)[0-9][0-9]*/\1NUM/' \
768 -e 's/\(mfile size:[ ]*\)[0-9][0-9]*/\1NUM/' \
769 -e '/drive[ ]*[0-9][0-9]*:/d' \
771 -e '/inventory session uuid/d' \
772 -e '/ - Running single-threaded/d' \
773 -e '/^.*I\/O metrics: .*$/d' \
774 -e 's/1048576/BLOCKSZ/' \
775 -e 's/2097152/BLOCKSZ/' \
776 -e 's/(pid[ ]*[1-9][0-9]*)/\(pid PID\)/' \
778 if ($_ =~ /(?:Dump|Restore) Summary/) {
780 } elsif ($_ =~ /(?:Dump|Restore) Status/) {
790 _dump_filter_main | _check_quota_dumprestore | _check_quota_entries
800 -e 's/UUID[ ]*:[ ][0-9a-f-]*/UUID : ID/' \
801 -e 's/TIME OF DUMP[ ]*:.*/TIME OF DUMP : TIME/' \
802 -e 's/HOSTNAME:SCRATCH_MNT.*/HOSTNAME:SCRATCH_MNT/' \
803 -e 's#inventory/[0-9a-f-]*#inventory/UUID#' \
811 -e "s#$dump_file#DUMP_FILE#" \
812 -e "s#$SCRATCH_DEV#SCRATCH_DEV#" \
813 -e "s#$SCRATCH_RAWDEV#SCRATCH_DEV#" \
814 -e "s#$dumptape#TAPE_DEV#" \
815 -e "s#$dump_dir#DUMP_DIR#g" \
816 -e "s#$restore_dir#RESTORE_DIR#g" \
817 -e "s#$SCRATCH_MNT#SCRATCH_MNT#g" \
818 -e "s#$dump_sdir#DUMP_SUBDIR#g" \
819 -e "s#$restore_sdir#RESTORE_SUBDIR#g" \
825 # Note: requires a space between option letter and argument
836 [ -z "$2" ] && _error "missing argument for -f"
841 [ -z "$2" ] && _error "missing argument for -L"
846 dump_args="$dump_args -o"
849 dump_args="$dump_args -F"
862 [ -z "$2" ] && _error "missing argument for -l"
863 dump_args="$dump_args -l$2"
867 _error "invalid argument to common.dump function: $1"
882 echo "Dumping to tape..."
883 opts="$_dump_debug$dump_args -s $dump_sdir -f $dumptape -M $media_label -L $session_label $SCRATCH_MNT"
884 echo "xfsdump $opts" | _dir_filter
885 xfsdump $opts 2>&1 | tee -a $seq.full | _dump_filter
895 echo "Dumping to tape..."
896 opts="$_dump_debug$dump_args -f $dumptape -M $media_label -L $session_label $SCRATCH_MNT"
897 echo "xfsdump $opts" | _dir_filter
898 xfsdump $opts 2>&1 | tee -a $seq.full | _dump_filter
903 # Do full dump with -m
909 echo "Dumping to tape..."
911 opts="$_dump_debug$dump_args -m -b $onemeg -l0 -f $dumptape -M $media_label -L $session_label $SCRATCH_MNT"
912 echo "xfsdump $opts" | _dir_filter
913 xfsdump $opts 2>&1 | tee -a $seq.full | _dump_filter
918 # Do full dump to file
924 echo "Dumping to file..."
925 opts="$_dump_debug$dump_args -f $dump_file -M $media_label -L $session_label $SCRATCH_MNT"
926 echo "xfsdump $opts" | _dir_filter
927 xfsdump $opts 2>&1 | tee -a $seq.full | _dump_filter
931 # Do full dump to multiple files
933 _do_dump_multi_file()
940 while [ $i -lt $multi ]
942 multi_args="$multi_args -f $dump_file.$i -M $media_label.$i"
946 echo "Dumping to files..."
947 opts="$_dump_debug$dump_args $multi_args -L $session_label $SCRATCH_MNT"
948 echo "xfsdump $opts" | _dir_filter
949 xfsdump $opts 2>&1 | tee -a $seq.full | _dump_filter
953 _prepare_restore_dir()
956 mkdir $restore_dir ||\
957 _error "failed to mkdir $restore_dir"
962 # Get tape ready and restore dir
968 echo "Rewinding tape"
973 # Restore the tape into $restore_dir
981 echo "Restoring from tape..."
982 opts="$_restore_debug -f $dumptape -L $session_label $restore_dir"
983 echo "xfsrestore $opts" | _dir_filter
984 xfsrestore $opts 2>&1 | tee -a $seq.full | _dump_filter
988 # Restore the tape into $restore_dir using -m
995 echo "Restoring from tape..."
997 opts="$_restore_debug -m -b $onemeg -f $dumptape -L $session_label $restore_dir"
998 echo "xfsrestore $opts" | _dir_filter
999 xfsrestore $opts 2>&1 | tee -a $seq.full | _dump_filter
1003 # Restore the tape from a dump file
1008 _prepare_restore_dir
1010 echo "Restoring from file..."
1011 opts="$_restore_debug -f $dump_file -L $session_label $restore_dir"
1012 echo "xfsrestore $opts" | _dir_filter
1013 xfsrestore $opts 2>&1 | tee -a $seq.full | _dump_filter
1017 # Cumulative restore from a file
1018 # Need to specify the dump level e.g. "-l 0"
1020 _do_restore_file_cum()
1023 if echo $dump_args | grep '\-l0' >/dev/null; then
1024 _prepare_restore_dir
1027 echo "Restoring cumumlative from file..."
1028 opts="$_restore_debug -f $dump_file -r $restore_dir"
1029 echo "xfsrestore $opts" | _dir_filter
1030 xfsrestore $opts 2>&1 | tee -a $seq.full | _dump_filter
1035 echo "Contents of dump ..."
1036 opts="$_restore_debug -f $dump_file -t"
1037 echo "xfsrestore $opts" | _dir_filter
1038 cd $SCRATCH_MNT # for IRIX which needs xfs cwd
1039 xfsrestore $opts 2>&1 | tee -a $seq.full | _dump_filter_main |\
1040 _check_quota_file |\
1041 _check_quota_entries |\
1042 $AWK_PROG 'NF != 1 { print; next }
1043 {files = sprintf("%s\n%s", files, $1)}
1044 END { print files | "sort" } '
1045 # the above awk code is to alpha sort only the output
1046 # of files (and not the verbose restore msgs)
1051 # Restore the tape from multiple dump files
1053 _do_restore_multi_file()
1056 _prepare_restore_dir
1061 while [ $i -lt $multi ]
1063 multi_args="$multi_args -f $dump_file.$i"
1067 echo "Restoring from file..."
1068 opts="$_restore_debug $multi_args -L $session_label $restore_dir"
1069 echo "xfsrestore $opts" | _dir_filter
1070 xfsrestore $opts 2>&1 | tee -a $seq.full | _dump_filter
1074 # Do xfsdump piped into xfsrestore - xfsdump | xfsrestore
1076 # Use -s as we want to dump and restore to the same xfs partition
1081 _prepare_restore_dir
1082 echo "xfsdump|xfsrestore ..."
1083 restore_opts="$_restore_debug - $restore_dir"
1084 dump_opts="$_dump_debug$dump_args -s $dump_sdir - $SCRATCH_MNT"
1085 echo "xfsdump $dump_opts | xfsrestore $restore_opts" | _dir_filter
1086 xfsdump $dump_opts 2>$tmp.dump.mlog | xfsrestore $restore_opts 2>&1 | tee -a $seq.full | _dump_filter
1087 _dump_filter <$tmp.dump.mlog
1091 # Compare dumped subdirectory with restored dir
1093 # Thus no contents are compared but permissions, sizes,
1094 # owners, etc... are.
1099 # verify we got back what we dumped
1101 echo "Comparing listing of dump directory with restore directory"
1102 ls -lR $dump_dir | tee -a $seq.full | _ls_filter >$tmp.dump_dir
1103 ls -lR $restore_dir/$dump_sdir | tee -a $seq.full | _ls_filter \
1104 | sed -e "s#$restore_sdir\/##" >$tmp.restore_dir
1106 diff -cs $tmp.dump_dir $tmp.restore_dir | sed -e "s#$tmp#TMP#g"
1110 # filter out the date fields
1114 $AWK_PROG 'NF == 9 { print $1, $2, $3, $4, $9 }'
1118 # _ls_compare_sub but don't compare dates
1119 _ls_nodate_compare_sub()
1122 # verify we got back what we dumped
1124 echo "Comparing listing of dump directory with restore directory"
1125 ls -lR $dump_dir | tee -a $seq.full | _ls_filter | _ls_nodate_filter >$tmp.dump_dir
1126 ls -lR $restore_dir/$dump_sdir | tee -a $seq.full | _ls_filter \
1127 | _ls_nodate_filter | sed -e "s#$restore_sdir\/##" >$tmp.restore_dir
1129 diff -cs $tmp.dump_dir $tmp.restore_dir | sed -e "s#$tmp#TMP#g"
1133 # Compare using recursive diff the files of the dumped
1135 # This one will compare the contents.
1139 echo "Comparing dump directory with restore directory"
1140 diff -rs $dump_dir $restore_dir/$dump_sdir | _dir_filter
1147 find $_path -exec attr -l {} \; |\
1148 awk '{print $9, $2}' |\
1151 while read file ea_name; do
1152 attr -g $ea_name $file
1157 # Compare the extended attributes of the files/dirs
1158 # b/w the dumped and restore dirs.
1161 # Attribute "attr5" had a 8 byte value for /spare1/dump.5460/dir:
1162 # Attribute "attr5" had a 8 byte value for /spare1/restore.5460/dump.5460/dir:
1166 echo "Comparing dump directory with restore directory"
1167 echo "Looking at the extended attributes (EAs)"
1169 _get_eas_on_path $dump_dir | tee $seq.ea1 | _dir_filter
1170 echo "EAs on restore"
1171 _get_eas_on_path $restore_dir/$dump_sdir \
1172 | sed -e "s#$restore_sdir\/##" \
1175 diff -s $seq.ea1 $seq.ea2
1180 # Compare using recursive diff the files of the dumped
1185 echo "Comparing dump directory with restore directory"
1186 diff -rs $SCRATCH_MNT $restore_dir | _dir_filter | _check_quota_diff
1190 # Check out the dump inventory
1194 xfsdump $_dump_debug -I | tee -a $seq.full | _dump_filter_main
1198 # Do the xfsinvutil cmd with debug and filters
1199 # Need to set variable: "$middate" to the invutil date
1204 echo "xfsinvutil $_invutil_debug -M $host:$SCRATCH_MNT \"$middate\" $*" >$seq.full
1205 xfsinvutil $_invutil_debug $* -M $host:$SCRATCH_MNT "$middate" \
1206 | tee -a $seq.full | _invutil_filter
1210 # ensure we can find the user quota msg if user quotas are on
1211 # ensure we can find the group quota msg if group quotas are on
1219 $here/src/feature -U $SCRATCH_DEV && uquota=1
1220 $here/src/feature -G $SCRATCH_DEV && gquota=1
1222 $AWK_PROG -v uquota=$uquota -v gquota=$gquota -v full=$seq.full \
1223 -v usermsg="$usermsg" -v groupmsg="$groupmsg" '
1225 print "Found group quota:", $0 >>full
1228 print "Found extra:", $0
1233 print "Found user quota:", $0 >>full
1236 print "Found extra:", $0
1242 if (uquota && !found_uquota) {
1243 print "Missing: ", usermsg
1245 if (gquota && !found_gquota) {
1246 print "Missing: ", groupmsg
1253 # xfsrestore: 3 directories and 40 entries processed
1255 # num entries needs to be reduced by num quota file(s)
1257 _check_quota_entries()
1261 $here/src/feature -U $SCRATCH_DEV && uquota=1
1262 $here/src/feature -G $SCRATCH_DEV && gquota=1
1263 $AWK_PROG -v uquota=$uquota -v gquota=$gquota '
1264 /entries processed/ {
1273 # xfsdump: saving user quota information for: SCRATCH_MNT
1274 # xfsdump: saving group quota information for: SCRATCH_MNT
1275 # xfsrestore: user quota information written to ...'
1276 # xfsrestore: group quota information written to ...'
1278 _check_quota_dumprestore()
1280 _check_quota 'user quota information' \
1281 'group quota information'
1286 # Only in RESTORE_DIR: xfsdump_quotas
1287 # Only in RESTORE_DIR: xfsdump_quotas_group
1291 _check_quota 'Only in RESTORE_DIR: xfsdump_quotas' \
1292 'Only in RESTORE_DIR: xfsdump_quotas_group'
1296 # Look for the quota file in the output
1297 # Ensure that it is there if it should be
1298 # Filter it out so that the output is always the same
1299 # even with no quotas
1303 _check_quota 'xfsdump_quotas' 'xfsdump_quotas_group'
1306 # make sure this script returns success