rm -f $here/$seq.full
if [ -n "$DEBUGDUMP" ]; then
- _dump_debug=-v5
- _restore_debug=-v5
+ _dump_debug=-v4
+ _restore_debug=-v4
_invutil_debug=-d
fi
for dir in /var/xfsdump/inventory /var/lib/xfsdump/inventory; do
[ -d $dir ] || continue
tar -cvf $seq.inventory.tar $dir
- ls -lR $dir >$seq.inventory.ls
+ ls -nR $dir >$seq.inventory.ls
done
fi
sub/smalll 10 $nobody $nobody 777 attr3 some_text3 user
sub/biggg 102400 $nobody $nobody 777 attr4 some_text4 root
dir d $nobody $nobody 777 attr5 dir_text user
-xflag_realtime 10 $nobody $nobody 777 XFS_XFLAG_REALTIME some_text5 root
-xflag_prealloc 10 $nobody $nobody 777 XFS_XFLAG_PREALLOC some_text6 root
-xflag_immutable 10 $nobody $nobody 777 XFS_XFLAG_IMMUTABLE some_text7 root
-xflag_append 10 $nobody $nobody 777 XFS_XFLAG_APPEND some_text8 root
-xflag_sync 10 $nobody $nobody 777 XFS_XFLAG_SYNC some_text9 root
-xflag_noatime 10 $nobody $nobody 777 XFS_XFLAG_NOATIME some_text10 root
-xflag_nodump 10 $nobody $nobody 777 XFS_XFLAG_NODUMP some_text11 root
-xflag_hasattr 10 $nobody $nobody 777 XFS_XFLAG_HASATTR some_text12 root
#
# Add more files so that there are more than the number
# of streams.
End-of-File
}
+#
+# extended file attribute flags
+#
+_mk_fillconfig_xattr()
+{
+ cat <<End-of-File >$tmp.config
+# pathname size user group perm name
+#
+xflag_realtime 10 $nobody $nobody 777 XFS_XFLAG_REALTIME
+xflag_prealloc 10 $nobody $nobody 777 XFS_XFLAG_PREALLOC
+xflag_immutable 10 $nobody $nobody 777 XFS_XFLAG_IMMUTABLE
+xflag_append 10 $nobody $nobody 777 XFS_XFLAG_APPEND
+xflag_sync 10 $nobody $nobody 777 XFS_XFLAG_SYNC
+xflag_noatime 10 $nobody $nobody 777 XFS_XFLAG_NOATIME
+xflag_nodump 10 $nobody $nobody 777 XFS_XFLAG_NODUMP
+xflag_hasattr 10 $nobody $nobody 777 XFS_XFLAG_HASATTR
+End-of-File
+}
+
#
# Create a bunch of directories/files of different sizes
# filled with data.
if [ -n "$perms" ]; then
chmod $perms $file
fi
+
+ # extended attributes (EA)
if [ -n "$ea_name" -a -n "$ea_value" ]; then
if [ "X$namespace" = "Xroot" ]; then
attr -R -s $ea_name -V $ea_value $file
else
attr -s $ea_name -V $ea_value $file
fi
+ # extended file attribute flags - no value - NOT EAs
+ elif [ -n "$ea_name" -a -z "$ea_value" ]; then
+ # set the flag
+ # TODO XXX
+ # use xfs_io to send the ioctl
+ :
fi
$verbose && echo -n "."
done
#
# Filter for ls
-# Filter out dates on symlinks and char devices
+# Filter out times and dates on symlinks and char devices.
# Filter out size on directories because this can differ
# when transitioning to long inode numbers (ie. 64 bits).
#
_ls_filter()
{
$AWK_PROG '
- /^l/ { date = $8; sub(date,"DATE"); print}
- /^c/ { date = $9; sub(date,"DATE"); print}
+ /^l/ { date = $8; time = $7; sub(date,"DATE"); sub(time,"TIME"); print}
+ /^c/ { date = $9; time = $7; sub(date,"DATE"); sub(time,"TIME"); print}
/^d/ { size = $5; sub(size,"SIZE"); print}
{print}' \
| sed -e 's/total [0-9][0-9]*/total TOTAL/'
}
+#
+# Filtering of Irix character hwgraph device names
+# e.g.
+# chardev: /hw/node/xtalk/15/pci/0/scsi_ctlr/0/target/1/lun/0/disk/partition/4/char
+# blkdev: /dev/dsk/dks0d1s4
+#
+_filter_devchar()
+{
+ $AWK_PROG '
+ /\/hw\/node/ {
+ sub(/\/hw.*scsi_ctlr\//,"/dev/dsk/dks") # blah blah /dev/dsk/dks0/target/1/....
+ sub(/\/target\//,"d") # blah blah /dev/dsk/dks0d1/lun/0/disk.....
+ sub(/\/lun.*partition\//,"s") # blah blah /dev/dsk/dks0d1s4/char
+ sub(/\/char/,"") # blah blah /dev/dsk/dks0d1s4
+ }
+ { print }
+ '
+}
+
#
# Filter out the non-deterministic dump msgs from
#
_dump_filter_main()
{
+ _filter_devchar |\
sed \
- -e "s/`hostname`/HOSTNAME/" \
- -e "s#$SCRATCH_DEV#SCRATCH_DEV#" \
- -e "s#$SCRATCH_RAWDEV#SCRATCH_DEV#" \
- -e "s#$dumptape#TAPE_DEV#" \
- -e "s#$SCRATCH_MNT#SCRATCH_MNT#" \
- -e "s#$dump_file#DUMP_FILE#" \
- -e 's#/var/lib/xfsdump#/var/xfsdump#' \
- -e 's/id:[ ]*[0-9a-f-]*/id: ID/' \
- -e 's/time:[ ].*/time: TIME/' \
- -e 's/date:[ ].*/date: DATE/' \
- -e 's/dump begun .*/dump begun DATE/' \
- -e 's/[0-9][0-9]* seconds/SECS seconds/' \
- -e 's/restore.[0-9][0-9]*/restore.PID/' \
- -e 's/ino [0-9][0-9]*/ino INO/' \
- -e '/: dump size/s/[0-9][0-9]*/NUM/' \
- -e '/dump size:/s/[0-9][0-9]*/NUM/' \
- -e '/dump size per stream:/s/[0-9][0-9]*/NUM/' \
+ -e "s/`hostname`/HOSTNAME/" \
+ -e "s#$SCRATCH_DEV#SCRATCH_DEV#" \
+ -e "s#$SCRATCH_RAWDEV#SCRATCH_DEV#" \
+ -e "s#$dumptape#TAPE_DEV#" \
+ -e "s#$SCRATCH_MNT#SCRATCH_MNT#" \
+ -e "s#$dump_file#DUMP_FILE#" \
+ -e 's#/var/lib/xfsdump#/var/xfsdump#' \
+ -e 's/session id:[ ]*[0-9a-f-]*/session id: ID/' \
+ -e '/filesystem id:[ ]*[0-9a-f-]*/d' \
+ -e 's/time:[ ].*/time: TIME/' \
+ -e 's/date:[ ].*/date: DATE/' \
+ -e 's/dump begun .*/dump begun DATE/' \
+ -e 's/[0-9][0-9]* seconds/SECS seconds/' \
+ -e 's/restore.[0-9][0-9]*/restore.PID/' \
+ -e 's/ino [0-9][0-9]*/ino INO/' \
+ -e '/: dump size/s/[0-9][0-9]*/NUM/' \
+ -e '/dump size:/s/[0-9][0-9]*/NUM/' \
+ -e '/dump size per stream:/s/[0-9][0-9]*/NUM/' \
-e 's/\(media file size[ ]*\)[0-9][0-9]*/\1NUM/' \
-e 's/\(mfile size:[ ]*\)[0-9][0-9]*/\1NUM/' \
- -e '/drive[ ]*[0-9][0-9]*:/d' \
- -e '/\/dev\/tty/d' \
- -e '/inventory session uuid/d' \
- -e '/ - Running single-threaded/d' \
- -e '/^.*I\/O metrics: .*$/d' \
- -e 's/1048576/BLOCKSZ/' \
- -e 's/2097152/BLOCKSZ/' \
- -e 's/(pid[ ]*[1-9][0-9]*)/\(pid PID\)/' \
+ -e '/drive[ ]*[0-9][0-9]*:/d' \
+ -e '/\/dev\/tty/d' \
+ -e '/inventory session uuid/d' \
+ -e '/ - Running single-threaded/d' \
+ -e '/^.*I\/O metrics: .*$/d' \
+ -e 's/1048576/BLOCKSZ/' \
+ -e 's/2097152/BLOCKSZ/' \
+ -e 's/(pid[ ]*[1-9][0-9]*)/\(pid PID\)/' \
+ -e '/version 3\.0/d' \
+ -e 's/\/hw\/module.*$/SCRATCH_DEV/' \
+ -e 's/id:[[:space:]]*[0-9a-f]\{8\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{12\}/ID: ID/' \
+ -e 's/\[y\/n\][- ]----------------------*/\[y\/n\]/' \
| perl -ne '
if ($_ =~ /(?:Dump|Restore) Summary/) {
$skip = 1;
#
# Compare dumped subdirectory with restored dir
-# using ls -lR.
+# using ls -nR.
# Thus no contents are compared but permissions, sizes,
# owners, etc... are.
#
# verify we got back what we dumped
#
echo "Comparing listing of dump directory with restore directory"
- ls -lR $dump_dir | tee -a $here/$seq.full | _ls_filter >$tmp.dump_dir
- ls -lR $restore_dir/$dump_sdir | tee -a $here/$seq.full | _ls_filter \
+ ls -nR $dump_dir | tee -a $here/$seq.full | _ls_filter >$tmp.dump_dir
+ ls -nR $restore_dir/$dump_sdir | tee -a $here/$seq.full | _ls_filter \
| sed -e "s#$restore_sdir\/##" >$tmp.restore_dir
- diff -cs $tmp.dump_dir $tmp.restore_dir | sed -e "s#$tmp#TMP#g"
+ diff -bcs $tmp.dump_dir $tmp.restore_dir | sed -e "s#$tmp#TMP#g"
+
}
#
# verify we got back what we dumped
#
echo "Comparing listing of dump directory with restore directory"
- ls -lR $dump_dir | tee -a $here/$seq.full | _ls_filter | _ls_nodate_filter >$tmp.dump_dir
- ls -lR $restore_dir/$dump_sdir | tee -a $here/$seq.full | _ls_filter \
+ ls -nR $dump_dir | tee -a $here/$seq.full | _ls_filter | _ls_nodate_filter >$tmp.dump_dir
+ ls -nR $restore_dir/$dump_sdir | tee -a $here/$seq.full | _ls_filter \
| _ls_nodate_filter | sed -e "s#$restore_sdir\/##" >$tmp.restore_dir
- diff -cs $tmp.dump_dir $tmp.restore_dir | sed -e "s#$tmp#TMP#g"
+ diff -bcs $tmp.dump_dir $tmp.restore_dir | sed -e "s#$tmp#TMP#g"
}
#
# sort |\
# and this is now the Linux way...
echo "User names"
- getfattr --absolute-names -Rh $_path |\
+ getfattr --absolute-names -Rh -m user $_path |\
perl -wn -e '
if (m/^# file: (\S+)/) { $file = $1 }
elsif (m/^user\.(\w+)/) { print $file, " ",$1,"\n" }' |\
attr -g $ea_name $file
done
+ if [ "$USE_ATTR_SECURE" = yes ]; then
+ echo "Security names"
+ getfattr --absolute-names -Rh -m security $_path |\
+ perl -wn -e '
+ if (m/^# file: (\S+)/) { $file = $1 }
+ elsif (m/^security\.(\w+)/) { print $file, " ",$1,"\n" }' |\
+ sort |\
+ while read file ea_name; do
+ attr -g $ea_name $file
+ done
+ fi
+
echo "Root names"
getfattr --absolute-names -Rh -m trusted $_path |\
perl -wn -e '
_check_quota 'xfsdump_quotas' 'xfsdump_quotas_group'
}
+
# make sure this script returns success
/bin/true