OS Manuals

lfs-find(1)

lfs-find - Lustre client utility to list files with specific attributes

LFS-FIND(1) Lustre User Utilities LFS-FIND(1)

lfs-find - Lustre client utility to list files with specific attributes

lfs find DIRECTORY|FILENAME ...
[[!] --atime|-A [-+]N[smhdwy]]
[[!] --attrs=[^]ATTR[,...]]
[[!] --blocks|-b [+-]N]
[[!] --btime|-B|--crtime [+-]N[smhdwy]]
[[!] --ctime|-C [+-]N[smhdwy]]
[[!] --component-count|--comp-count [+-]N]
[[!] --component-end|--comp-end|-E [+-]N[KMGTPE]]
[[!] --component-flags|--comp-flags [^]FLAG, ...]
[[!] --component-start|--comp-start [+-]N[KMGTPE]]
[[!] --extension-size|-z [+-]N[KMG]]
[[!] --foreign [TYPE]]
[[!] --gid|-g|--group|-G GNAME|GID] [--help|-h]
[[!] --layout|-L mdt|raid0|released] [--lazy|-l] [--ls]
[[!] --links [+-]N] [--maxdepth|-D N] [--mindepth|-d N]
[[!] --mdt|--mdt-index|-m UUID|INDEX|INDEX_RANGE, ...]
[[!] --mdt-count|-T [+-]N]
[[!] --mdt-hash|-H [^]HASHFLAG,[^]HASHTYPE, ...]
[[!] --mirror-count|-N [+-]N] [[!] --mirror-state [^]STATE]
[[!] --mtime|-M [-+] N[smhdwy]] [[!] --name|-n PATTERN]
[[!] --newer[XY] REFERENCE] [[!] --ost|-O INDEX|INDEX_RANGE, ...]
[[!] --perm [/-] MODE] [[!] --pool POOL] [--print|-P]
[--print0|-0] [--printf FORMAT] [[!] --projid PROJID|PROJNAME]
[[!] --size|-s [-+]N[KMGTPE]] [--skip|-k] PERCENT]
[[!] --stripe-count|-c [+-]N]
[[!] --stripe-index|-i n, ...] [[!] --stripe-size|-S [+-]N[KMG]]
[[!] --type|-t {bcdflps}] [--threads N] [[!] --uid|-u|--user|-U UNAME|UID]
[[!] --xattr NAME[=VALUE]]

lfs find is similar to the standard find(1) utility and is used to list files and directories with specific attributes, both regular POSIX attributes such as ownership, timestamps, and size using the same options as find(1), as well as Lustre-specific attributes such as stripe count and size, OST and MDT location, and composite layout attributes.

File was last accessed N*24 hours ago (if no units are given), or N*seconds, minutes, hours, days, weeks, or years ago within a margin of error of 24h if no unit is specified. Multiple units can be specified, for example 8h20m is equivalent to 500m. If multiple units are specified, the margin of error is based on the smallest unit used, so -atime 3d has a margin of error of one day, while -atime 72h has a margin of error of one hour. If both -atime +OLDER and -atime -NEWER are used, then files with atime within the range OLDER-NEWER are matched.
File has ATTRS attribute flags. Supported attributes are (non exhaustive list): Compressed (c), Immutable (i), Append_Only (a), No_Dump (d), Encrypted (E), Automount (M)
Blocks allocated by the file is N 512-byte blocks (if no units are given), or chars (bytes), Kibi-, Mebi-, Gibi-, Tebi-, Pebi-, or Ebi-bytes if that suffix is given.
File was created N*24 hours ago, see --atime for full details and options.
File's status was last changed N*24 hours ago, see --atime for full details and options.
The file has N components in its layout.
The file has component end offset N (in bytes) for any component.
The file has components with the specified flag set. If ^flag is used, print only components not matching flag. Multiple flags can be specified, separated by commas. Valid flag names are:
Component has been initialized (has allocated OST objects).
Replicated (mirrored) components that do not have up-to-date data. Stale components will not be used for read or write operations, and need to be resynched using lfs mirror resync before they can be accessed again.
Replicated (mirrored) components that are preferred for read or write. For example, because they are located on SSD-based OSTs, or are more local on the network to clients.
Replicated (mirrored) components that are preferred for read.
Replicated (mirrored) components that are preferred for write.
The file has component start offset N (in bytes) for any component.
File has a foreign (non-Lustre/free format) layout and is of the given TYPE, if specified. Presently only none or symlink are defined types, though 32-bit numeric types can also be used.
File has specified numeric group ID GID.
File belongs to specified GROUPNAME, or numeric group GID.
Print usage message.
File has a layout of the given type, one of:
Traditional Lustre RAID-0 striping format.
HSM-archived files that are not resident in the filesystem.
Files that have the first data component on an MDT.
Use file size and blocks from MDT, if available, to avoid extra RPCs.
Print files in a format similar to 'ls -l', showing the inode number, allocated blocks, permissions, link count, owner, group, size, modification time, and path. This is equivalent to specifying the --printf '%18i %10k %M %4n %-8u %-8g %13s %t %p  option. This option is for human convenience, but the exact formatting is not guaranteed to be constant or match 'find -ls' or 'ls -l' exactly. In particular the timestamp format may change, so if a consistent output is needed as input to a parser then the format should be explicitly specified.
File has N links.
Limits find to decend at most N levels of directory tree.
Starts find at N levels of directory tree.
File or directory inode is located on the specified MDT(s).
DNE striped directory uses the given filename hashing function, one of:
The CRUSH consistent hash function, added in Lustre 2.14, minimizes entry migration if the directory stripe count changes during migration.
The Fowler-Noll-Vo hash function, which is a simple and efficient hash.
Simple hash function that sums all of the characters in the filename. This is mostly for testing, or if it is known that filenames will use sequential filenames.

This implicitly selects only directories to be matched, like -type d and not other file types.

The DNE striped directory has the given number of MDT shards. This implicitly selects only directories to be matched, like -type d and not other file types.
The file has N mirrors in its layout.
The file has a state of state. If ^state is used, print only files not matching state. Only one state can be specified. Valid state name is:
The mirrored file is in read-only state. All of the mirrors contain the up-to-date data.
The mirrored file is in a state of being written.
The mirrored file is in a state of being resynchronized.
File's data was last modified N*24 hours ago, see --atime for full details and options.
Filename matches the given filename, or regular expression using standard glob(7) file name regular expressions and wildcards.
Succeeds if timestamp X of the file being considered is newer than timestamp Y of the file reference. The letters X and Y can be any of the following letters:
The access time of the file reference
The birth time of the file reference
The inode status change time of reference
The modification time of the file reference
reference is interpreted directly as a time

Some combinations are invalid; for example, it is invalid for X to be t. Specifying -newer is equivalent to -newermm. When reference is interpreted directly as a time, currently it must be in one of the following formats: "%Y-%m-%d %H:%M:%S", "%Y-%m-%d %H:%M", "%Y-%m-%d", "%H:%M:%S", "%H:%M", to represent year, month, day, hour, minute, seconds, with unspecified times at the start of that minute or day, unspecified dates being "today", and "@%s" or "%s" the seconds since the Unix epoch (see strftime(3) for details of the time formats). Otherwise, it will report an error. If you try to use the birth time of a reference file, and the birth time cannot be determined, a fatal error message results. If you specify a test which refers to the birth time of files being examined, this test will fail for any files where the birth time is unknown.

File has an object on the specified OST(s). The OST names can be specified using the whole OST target name, or just the OST index number, or OST index range like 0-3. If multiple OSTs are given in a comma-separated list, the file may have an object on any of the given OSTs. Specifying multiple OSTs allows scanning the filesystem only once when migrating objects off multiple OSTs for evacuation and replacement using lfs-migrate(1).
File's permission are exactly MODE (octal or symbolic).
All of the permission bits MODE are set for the file.
Any of the permission bits MODE are set for the file. If no permission bits in MODE are set, this test matches any file.
Layout was created with the specified POOL name. For composite files, this may match the pool of any component. -P, --print Prints the file or directory name to standard output if it matches all specified parameters, one file per line with a trailing linefeed. This is the default behaviour for any matching files.
-0, --print0
Print full file name to standard output if it matches the specified parameters, followed by a NUL character. This is for use together with xargs(1) with the -0 option to handle filenames with embedded spaces or other special characters.
Print FORMAT to standard output for each matching file, interpreting `´ escapes and `%' directives. Unlike --print, the --printf option does not automatically add a newline to the end of the string. The escapes and directives are:
Newline.
Horizontal tab.
\\
A literal backslash.
%%
A literal percent sign.
%[-0]WIDTH
Specify the field width, to print the value padded with spaces to at least WIDTH characters wide. If the value has more characters than the specified WIDTH then it will print the full value. With a leading zero, %0WIDTHm will pad the file mode with leading zeroes. If negative, %-WIDTH will align the value to the left of the field, positive values to the right.
%a
File´s last access time in the format returned by the C `ctime´ function.
%A@
File´s last access time in seconds since Jan. 1, 1970, 00:00 GMT.
%b
The amount of disk space used for the file (in 512-byte blocks).
%c
File´s last status change time in the format returned by the C `ctime´ function.
%C@
File´s last status change time in seconds since Jan. 1, 1970, 00:00 GMT.
%g
File´s groupname.
%G
File´s numeric group ID.
%i
File´s inode number in decimal.
%k
The amount of storage space allocated for this file in 1K blocks.
%m
File permission bits (in octal).
%M
File permissions (rwx format)
%n
Number of hard links to file.
%p
File's pathname name.
%s
File size in bytes.
%t
File´s last modification time in the format returned by the C `ctime´ function.
%T@
File´s last modification time in seconds since Jan. 1, 1970, 00:00 GMT.
%u
File's username.
%U
File's numeric user ID.
%w
File´s birth time in the format returned by the C `ctime´ function.
%W@
File´s birth time in seconds since Jan. 1, 1970, 00:00 GMT.
%y
File's type (f=file, d=directory, p=pipe, b=block device, c=character device, s=socket l=symbolic link)
%La
Comma-separated list of file's named attribute flags in short form (letter), or hex value of any unknown attributes.
%LA
Comma-separated list of file's named attribute flags, or hex value of any unknown attributes.

%Lc
File or directory stripe count. For a composite file, this is the stripe count of the last instantiated component.
%LF
File Identifier (FID) associated with the file.
%Lh
Directory's hash type (or `none´ for an unstriped directory).
%Li
File´s starting OST index (or starting MDT index for a directory). For a composite file, this is the starting OST index of the last instantiated component.
%Lo
List of all OST/MDT indices associated with a file or directory.
%Lp
File´s OST pool name. For a composite file, this is the pool associated with the last instantiated component. (NOTE: This can also be used for directories, but since MDT pools are not currently implemented, nothing will be printed.)
%LP
Numeric project ID assigned to the file or directory.
%LS
File's stripe size. For a composite file, this is the stripe size of the last instantiated component.
File belongs to the project specified by PROJID or PROJNAME. A username or group name can be used in place of a project name by specifying u:USERNAME or user:USERNAME or g:GROUPNAME or group:GROUPNAME respectively, though this name will not be shown in place of the numeric ID.
File size is N 512-byte blocks (if no unit is given), or N chars (bytes), Kibi-, Mebi-, Gibi-, Tebi-, Pebi-, or Ebi-bytes if a suffix is given.
Skip PERCENT of the total files that match the other filters. This is useful together with lfs-migrate(1) to allow processing only a fraction of the files to rebalance files when new OSTs are added to the filesystem.
File has N stripes allocated. For composite files, this matches the stripe count of the last initialized component.
File has stripe on OST index N. Multiple OST indices can be specified in a comma-separated list, which indicates that the file has a stripe on .B any of the specified OSTs. This allows a single namespace scan for files on multiple different OSTs, if there are multiple OSTs that are being replaced.
Stripe size is N bytes, or Kibi-, Mebi-, Gibi-, Tebi-, Pebi-, or Ebi-abytes if a suffix is given. For composite files, this matches the stripe size of the last initialized non-extension component.
Extension size is N bytes, or Kibi-, Mebi-, Gibi-, Tebi-, Pebi-, or Ebi-bytes if a suffix is given. For composite files, this matches the extension size of any extension component.
File has type: block, character, directory, file, pipe, symlink, or socket.
Use N threads for parallel directory traversal. If not specified, the default thread count is calculated as min(MDT_COUNT * 4, CPU_COUNT / 2), where CPU_COUNT is the total number of CPUs configured for Lustre. This allows faster scanning of large directory trees by processing multiple directories concurrently while respecting the available CPU resources.
File has specified numeric user ID UID.
File owned by specified USERNAME, or numeric user UID.
File has an extended attribute with name matching the regular expression (regex(7)) NAME, and optionally value matching the regular expression VALUE. The regular expressions must match the complete attribute names and values, and not just a substring. This option may be specified multiple times, and the file must match all provided arguments.

Specifying ! before an option negates its meaning (files NOT matching the parameter). Using + before a numeric value means 'more than N', while - before a numeric value means 'less than N'. If neither is used, it means 'equal to N', within the bounds of the unit specified (if any).

Numeric suffixes are in binary SI (power-of-two) units.

For compatibility with find(1) it is possible to specify long options with either a single or double leading dash.

The order of parameters does not affect how the files are matched. lfs find will first scan the directory for any specified filename, and then fetch MDT inode attributes for each matching filename. If it can make a positive or negative decision for a file based only on the MDT attributes (e.g. newer than specified time, user/group/project ID) it will not fetch the OST object attributes for that file.

The lfs find command supports bash-completion(1) for tab completion of option names and in some cases their arguments, with proper package installation and supporing shell usage. This can simplify usage when specifying complex search commands.

To list mountpoints, type 'lfs find TAB'. To list long options (more descriptive and easily understood) type '--TAB', and to list short options type '-TAB'. Some arguments also allow context-specific completion to the command-line option, for example generating a list of OST devices for the -ost option, or a list of OST pools for the -pool option.

The lfs find command isn't as comprehensive as find(1). In particular, it doesn't support complex boolean expressions with -o (logical OR), only logical AND of most expressions. The parameter ordering does not affect how the files are matched. Specifying multiple identical options generally clobbers the earlier option (e.g. it is not possible to specify a range of stripe counts or multiple pools).

Efficiently lists all files in a given directory and its subdirectories, without fetching any file attributes:

# lfs find /mnt/lustre

Prints a formatted find string, listing the username, access mode and inode number:

# lfs find /mnt/lustre -printf %u %M %i 0

Recursively list all regular files in given directory more than 30 days old:

# lfs find /mnt/lustre -mtime +30 -type f -print

Recursively find all files in test that have objects on OST0002 or OST0003 and migrate them to other OSTs. See lfs-migrate(1) for more details:

# lfs find /mnt/lustre/test -o OST0002,OST0003 -print0 | lfs migrate -0

Recursively list all files ending with .mpg that have more than 3 components:

# lfs find -name *.mpg --component-count +3 /mnt/lustre

Recursively list all files that have at least one component with both 'init' and 'prefer' flags set, and doesn't have flag 'stale' set:

# lfs find --component-flags=init,prefer,^stale /mnt/lustre

Recursively list all mirrored files that have more than 2 mirrors:

# lfs find --mirror-count +2 /mnt/lustre

Recursively list all out-of-sync mirrored files:

# lfs find ! --mirror-state=ro /mnt/lustre

Recursively list all but foreign files/dirs of symlink type:

# lfs find ! --foreign=symlink /mnt/lustre

Recursively list all files with the specified "user.job" extended attribute:

# lfs find -xattr user.job=202310.* /mnt/lustre

Recursively list all files in /var/www that have any SELinux extended attribute, but that do NOT have an SELinux extended attribute with a value containing "httpd":

# lfs find -xattr security.selinux ! -xattr security.selinux=.*httpd.* /var/www

Recursively list all files in a directory with detailed information in a format similar to 'ls -l':

# lfs find /mnt/lustre --ls

lfs find is part of the lustre(7) filesystem package since release 0.10.0

lfs(1), lfs-getdirstripe(1), lfs-getstripe(1), lfs-migrate(1), xargs(1), projid(5), lustre(7), regex(7)

2026-09-11 Lustre

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