lfs_migrate(1)

NAME
lfs_migrate - migrate files between Lustre OSTs

SYNOPSIS
lfs_migrate [-A [-C<cap>][-M<min_free>][-X<max_free>]] [--dry-run|-n] [--help|-h] [--no-rsync|--rsync] [--pool|-p<pool>] [--quiet|-q] [--restripe|-R] [--stripe-count|-c<stripe_count>] [--stripe-size|-S<stripe_size>] [--skip|-s] [--verbose|-v] [--yes|-y] [-D] [-0] [FILE|DIR]...

DESCRIPTION
lfs_migrate is a tool to assist migration of files between Lustre OSTs, possibly also restriping the files as it goes. It copies each specified file to a new file, verifies the file contents have not changed, and then replaces the original filename with the new file (either atomically via lfs-migrate(1) on Lustre 2.5 and later, or mv(1) on older versions of Lustre). This allows balancing space usage between OSTs, moving files off OSTs that are starting to show hardware problems but are still functional, or OSTs that will be removed from the filesystem.

Files to be migrated can be specified as command-line arguments. If a directory is specified on the command-line then all files within that directory are migrated. If no files are specified on the command-line, then a list of files is read from the standard input, making lfs_migrate suitable for use with lfs-find(1) to locate files on specific OSTs and/or matching other file attributes, or any other tools that generate a list of files.

Any options and arguments not explicitly recognized by lfs_migrate are passed through to the underlying lfs migrate command, see lfs-migrate(1) and lfs-setstripe(1) for a complete list of options.

To maintain backward compatibility, the -n option is used by the script to indicate a dry-run (no modifications made), and is not passed to lfs migrate as the non-block option. To specify non-block, use the long option --non-block.

The current file allocation policies on MDS dictate where the new files are placed, taking into account whether specific OSTs have been disabled on the MDS via lctl(8) (preventing new files from being allocated there), whether some OSTs are overly full (reducing the number of files placed on those OSTs), or if there is a specific default file striping for the target directory (potentially changing the stripe count, stripe size, OST pool, or OST index of a new file).

OPTIONS

\--dry-run|-n
    Only print the names of files to be migrated.

\-D Do not use direct I/O to copy file contents.

\-A Automatically determine the stripe count for the file, using the algorithm count = sqrt(filesize_in_GB) + 1. This option may not be specified at the same time as the -c or \-R options.

\--stripe-count|-c <stripe_count>
    Restripe file using the specified stripe_count. This option may not be specified at the same time as the -A or -R options.

\-C <cap>
    When -A is set, limit the migrated file to use on each OST at most 1/cap of the available space of the smallest OST. If this option is not set, a default value of 100 is used, limiting the object size to 1% of available space.

\--help|-h
    Display usage message.

\--no-rsync
    Do not fall back to using rsync if lfs-migrate(1) fails. Cannot be used at the same time as --rsync.

\--min-free|-M <min_free>
    When -A is set, only consider OSTs with free space greater than the min_free value to be available for migration. The value is specified in KB. If this option is not set, a default of 256MB is used.

\--pool|-q<pool>
    Migrate files to specified pool.

\--quiet|-q
    Run quietly (don't print filenames or status).

\--rsync
    Force rsync to be used instead of lfs-migrate(1). May not be used at the same time as --no-rsync.

\--restripe|-R
    Restripe file using default directory striping instead of keeping striping. This option may not be specified at the same time as the -A, -c, or -S options. (these options are passed through to lfs migrate, and are therefore not listed here).

\--skip|-s
    Skip file data comparison after migrate. Default is to compare migrated file against original to verify correctness.

\--stripe-size|-S
    <stripe_size> Restripe file using the specified stripe size. This option may not be specified at the same time as the -R option.

\--verbose|-v
    Show verbose debug messages.

\--max-free|-X <max_free>
    When -A is set, max_free is the maximum amount of free space that can be considered available for the migration of the file on each OST. The value is specified in KB. This option is useful for testing, by simulating OSTs that are nearly full.

\--yes|-y
    Answer 'y' to usage warning without prompt (--rsync only, use with caution).

\-0 Input file names on stdin are separated by a null character.

EXAMPLES
To rebalance all files within /testfs/jobs/2011:

    lfs_migrate /testfs/jobs/2011

To migrate files within the /testfs filesystem on OST0004 (perhaps because it is much more full than other OSTs), larger than 4GB (because it is more efficient to migrate a few large files than many small ones), and older than two days (to avoid files that are in use) to use auto-restriping for these files, after disabling file creation on testfs-OST0004 (this is needed on all MDS nodes):

    mds# lctl set_param osp.testfs-OST0004*.max_create_count=0
    client# lfs find /testfs -obd testfs-OST0004 -size +4G -mtime +2d | lfs_migrate -A
    mds# lctl set_param osp.testfs-OST0004*.max_create_count=20000

To use automatic restriping, and limit the object size per OST to 5% of current free space:

    lfs_migrate -A -C 20 /testfs/jobs/2011

NOTES
In versions prior to 2.5, lfs_migrate is not closely integrated with the MDS, and cannot determine whether a file is currently open and/or in-use by other applications or nodes. That makes it UNSAFE for use on files that might be modified by other applications, since the migrated file is only a copy of the current file. This will result in the old file becoming an open-unlinked file, and any modifications to that file will be lost.

AVAILABILITY
lfs_migrate is part of the Lustre(7) filesystem package. Added in the 1.8.4 release.

SEE ALSO
lfs(1)