OS Manuals

lfs_migrate(1)

lfs_migrate - migrate files between Lustre OSTs

LFS_MIGRATE(1) Lustre User Utilities LFS_MIGRATE(1)

lfs_migrate - migrate files between Lustre OSTs

lfs_migrate [-A [-C CAP] [-M MIN_FREE] [-X MAX_FREE ]] [--cp] [--dry-run|-n] [--fid|-F [--lustre-dir LUSTRE_MOUNT_POINT]] [--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|FID|DIR]...

WARNING: lfs_migrate is scheduled for removal after Lustre 2.20. Please use lfs-migrate(1) instead.

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).

Force use of cp(1) to copy files instead of rsync(1).
Only print the names of files to be migrated.
Do not use direct I/O to copy file contents.
FID(s) are provided from command line/stdin instead of file path(s). Option --lustre-dir=LUSTRE_MOUNT_POINT may be specified at the same time.
The mount point of Lustre file system on which FID(s) are when --fid is specified. If there is only one mounted Lustre file system, this option is not necessary. This option must be specified together with --fid.
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.
Restripe file using the specified STRIPE_COUNT. This option may not be specified at the same time as the -A or -R options.
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.
Display usage message.
Do not fall back to using rsync if lfs-migrate(1) fails. Cannot be used at the same time as --rsync.
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.
Migrate files to specified pool.
Run quietly (don't print filenames or status).
Force rsync to be used instead of lfs-migrate(1). May not be used at the same time as --no-rsync.
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 file data comparison after migrate. Default is to compare migrated file against original to verify correctness.
Restripe file using the specified stripe size. This option may not be specified at the same time as the -R option.
Show verbose debug messages.
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.
Answer 'y' to usage warning without prompt (--rsync only, use with caution).
-0
Input file names on stdin are separated by a null character.

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.

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

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

lfs(1), lfs-migrate(1)

2025-12-20 Lustre

lustre 2.17.60-r0 · enterprise-packages · ingested 2026-10-22