\- simple tool to migrate files between Lustre OSTs
.SH SYNOPSIS
.B lfs_migrate
-.RB [ -c | -s ]
.RB [ -h ]
.RB [ -l ]
.RB [ -n ]
+.RB [ -R ]
+.RB [ -s ]
.RB [ -y ]
.RI [ file | "directory ..." ]
.br
or OST index of a new file).
.SH OPTIONS
.TP
-.B \\-c
-Compare file data after migrate (default, use
-.B \\-s
-to disable).
-.TP
-.B \\-s
-skip file data comparison after migrate (use
-.B \\-c
-to enable).
-.TP
.B \\-h
Display help information.
.TP
.B \\-q
Run quietly (don't print filenames or status)
.TP
+.B \\-R
+Restripe file using default directory striping instead of keeping striping.
+.TP
+.B \\-s
+skip file data comparison after migrate. Default is to compare migrated file
+against original to verify correctness.
+.TP
.B \\-y
-Answer 'y' to usage warning without prompting (for scripts)
+Answer 'y' to usage warning without prompting (for scripts, use with caution).
.SH EXAMPLES
To rebalance all files within
.IR /mnt/lustre/dir :
usage() {
cat -- <<USAGE 1>&2
-usage: lfs_migrate [-c|-s] [-h] [-l] [-n] [-y] [file|dir ...]
- -c compare file data after migrate (default)
- -s skip file data comparison after migrate
+usage: lfs_migrate [-h] [-l] [-n] [-R] [-s] [-y] [file|dir ...]
-h show this usage message
-l migrate files with hard links (skip by default)
-n only print the names of files to be migrated
-q run quietly (don't print filenames or status)
+ -R restripe file using default directory striping
+ -s skip file data comparison after migrate
-y answer 'y' to usage question
If a directory is an argument, all files in the directory are migrated.
OPT_CHECK=y
-while getopts "chlnqsy" opt $*; do
+while getopts "chlnRqsSy" opt $*; do
case $opt in
- c) OPT_CHECK=y;;
+ c) echo "'-c' option deprecated, checking enabled by default" 1>&2;;
l) OPT_NLINK=y;;
n) OPT_DRYRUN=n; OPT_YES=y;;
q) ECHO=:;;
+ R) OPT_RESTRIPE=y;;
s) OPT_CHECK="";;
y) OPT_YES=y;;
h|\?) usage;;
fi
+ if [ "$OPT_RESTRIPE" ]; then
+ UNLINK=""
+ else
# if rsync copies Lustre xattrs properly in the future
# (i.e. before the file data, so that it preserves striping)
# then we don't need to do this getstripe/mktemp stuff.
- UNLINK="-u"
- COUNT=$($LFS getstripe -c "$OLDNAME" 2> /dev/null)
- SIZE=$($LFS getstripe -s "$OLDNAME" 2> /dev/null)
- [ -z "$COUNT" -o -z "$SIZE" ] && UNLINK=""
+ UNLINK="-u"
+ COUNT=$($LFS getstripe -c "$OLDNAME" 2> /dev/null)
+ SIZE=$($LFS getstripe -s "$OLDNAME" 2> /dev/null)
+ [ -z "$COUNT" -o -z "$SIZE" ] && UNLINK=""
+ fi
NEWNAME=$(mktemp $UNLINK "$OLDNAME.tmp.XXXXXX")
if [ $? -ne 0 -o -z "$NEWNAME" ]; then
echo -e "\r$OLDNAME: can't make temp file, skipped" 1>&2