# to be 100% safe the administrator needs to ensure this is safe.
RSYNC=${RSYNC:-rsync}
+LFS_MIGRATE_RSYNC_MODE=${LFS_MIGRATE_RSYNC_MODE:-false}
ECHO=echo
LFS=${LFS:-lfs}
LFS_SIZE_OPT="-s"
-c <stripe_count>
restripe file using the specified stripe count
-h show this usage message
- -l migrate files with hard links (skip by default)
+ -l migrate files with hard links (skip by default for rsync)
-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
$LFS getstripe --help 2>&1 | grep -q stripe-size && LFS_SIZE_OPT="-S"
lfs_migrate() {
- local RSYNC_MODE=false
-
while IFS='' read -d '' OLDNAME; do
$ECHO -n "$OLDNAME: "
continue
fi
- if [ -z "$OPT_NLINK" -a ${TYPE_LINK[0]} -gt 1 ]; then
- echo -e "multiple hard links, skipped"
- continue
- fi
-
# working out write perms is hard, let the shell do it
if [ ! -w "$OLDNAME" ]; then
echo -e "no write permission, skipped"
# first try to migrate inside lustre
# if failed go back to old rsync mode
- if [[ $RSYNC_MODE == false ]]; then
+ if [[ $LFS_MIGRATE_RSYNC_MODE == false ]]; then
if $LFS migrate -c${COUNT} ${SIZE} "$OLDNAME"; then
$ECHO "done"
continue
else
echo "falling back to rsync-based migration"
- RSYNC_MODE=true
+ LFS_MIGRATE_RSYNC_MODE=true
fi
fi
+ if [ -z "$OPT_NLINK" -a ${TYPE_LINK[0]} -gt 1 ]; then
+ echo -e "multiple hard links, skipped"
+ continue
+ 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