LFS-SETDIRSTRIPE(1) Lustre Utilities LFS-SETDIRSTRIPE(1)

# [NAME](#NAME)

lfs setdirstripe, mkdir - set striping pattern of a directory.

# [SYNOPSIS](#SYNOPSIS)

**lfs setdirstripe \[-cCdDhHioTxX] *DIR*...**

# [DESCRIPTION](#DESCRIPTION)

Create a striped directory with specified striping pattern. This **lfs** sub-command is similar to **lfs setstripe**, but is used to create a striped directory or set the default layout for subdirectories. Can also be used to create directory with a foreign (free format) striping pattern (see **--foreign** and **--xattr** options). **lfs mkdir** is an alias for this command.

# [OPTIONS](#OPTIONS)

[**-c**, **-T**, **--mdt-count**=*COUNT*](#c)

Stripe the new directory over *COUNT* MDTs.

[**-C, --overstripe-count *STRIPE\_COUNT***](#C)

The number of stripes to create, creating &gt; 1 stripe MDT if *STRIPE\_COUNT* exceeds the number of MDTs in the file system. **0** means to use the filesystem-wide default stripe count (default 1). While negative value **-N** means **N** stripes per available MDT. **-1** allocates one stripe per MDT, values of -2, -3, -4, and -5 allocate 2, 3, 4, and 5 stripes per MDT, respectively. The maximum allowable multiplier is currently **-5**.

[**-h**, **--help**](#h)

Print usage message.

[**-i**, **--mdt-index**=*START\_MDT\_INDEX*\[,*MDT\_INDEX*...\]**](#i)

Use the MDT whose index is *START\_MDT\_INDEX* as the master/starting MDT for the directory. If multiple *MDT\_INDEX* values are given, then the stripes will be allocated on the specified MDT indices. If **-1** (default) is used, the client will round-robin subdirectory creation across all MDTs if their free space is within **lod.\*.mdt\_qos\_threshold\_rr** percent of each other, otherwise the client will prefer to select **COUNT** MDT(s) proportional to the free space and inodes on each.

Providing multiple *MDT\_INDEX* values while trying to set the default striping pattern of subdirectories using **-D** will not load balance subdirectory creation amongst the MDTs. Instead, this will cause all new subdirectories to be striped across all of the specified MDTs. This is discouraged and can lead to filesystem problems if too many striped directories are created. To do this anyway, **-c N** must also be specified, where **N** matches the number of MDT indices given.

[**-H**, **--mdt-hash**=*HASH\_TYPE*](#H)

Use *hash\_type* for the striped directory.

[**crush**](#crush)

CRUSH hash algorithm. This is a consistent hash algorithm, so minimum sub files need to relocate during directory restripe.

[**fnv\_1a\_64**](#fnv_1a_64)

Fowler-Noll-Vo (FNV-1a) hash algorithm. This provides reasonably uniform, but not cryptographically strong, hashing of the filename. (default)

[**all\_char**](#all_char)

Sum of ASCII characters modulo number of MDTs. This provides weak hashing of the filename, and is suitable for only testing or when the input is known to have perfectly uniform distribution (e.g. sequential numbers).

[**-d**, **--delete**](#d)

Delete the default striping layout from the directory. New subdirectories created in this directory will inherit the global default directory layout (by default they will not be striped).

[**-D**, **--default**](#D)

Set the default striping pattern of subdirectories. Newly created sub-directories will use the new default striping pattern, but existing sub-directories will not be affected. The newly created sub-directories will also inherit the specified default striping pattern.

Note that striping all directories across all MDTs by default is **not** recommended at this time, as the clients will have to do more RPCs to create and access each directory, hurting performance rather than improving it. Default striped directories are preferred only for parent directories where large subdirectories will be created (e.g. file-per-process job output directories). Instead, using **-c 1 -i -1** on top-level directories balances mkdir therein over MDTs automatically without causing all subdirectories to be remote by default.

[**-o**, **--mode**=*MODE*](#o)

Set the file access permissions of the new directory to the specified numeric *MODE* (typically octal), as with [**chmod**(1)](/man/enterprise-packages/lustre/chmod.1). It is not affected by the current [**umask**(1p)](/man/enterprise-packages/lustre/umask.1p).

[**--foreign\[=type\]**](#foreign_=type_)

Create a directory with a foreign (non-Lustre/free format, see **--xattr** option) striping. Where **type** specifies a known foreign type (like **none** , **symlink** , ...) or a 32-bit numeric type.

[**--flags**=*&lt;hex&gt;*](#flags)

Specify a numeric bitmask of type-specific layout flags for the foreign layout.

[**-x**, **--xattr**=*STRING*](#x)

Specify a string to be used as a foreign (free format) striping.

[**-X**, **--max-inherit**=***MAX\_INHERIT***](#X)

Set the inherit depth of default directory layout. If non-zero, then *MAX\_INHERIT* is the number of subdirectory levels for which this default layout is inherited, up to a maximum of 250 levels, and is decremented by one when copying the default layout to each new subdirectory, until zero and the default layout is no longer copied. A *MAX\_INHERIT* of -1 means the default layout is inherited for all subdirectories.

[**--max-inherit-rr**=***MAX\_INHERIT\_RR***](#max-inherit-rr)

Set the round-robin inherit depth of the default directory layout, only when *START\_MDT\_INDEX* is -1. If *MAX\_INHERIT\_RR* is zero (unset), then new subdirectories are preferentially created on MDTs with more free space and inodes if the MDTs are imbalanced. If non-zero, then *MAX\_INHERIT\_RR* is the number of subdirectory levels, up to a maximum of 250 levels, for which new subdirectories will be created in a round-robin manner across all available MDTs, rather than using MDT space balancing for new subdirectories. Otherwise, *MAX\_INHERIT\_RR* is decremented by one when copying the default layout to each new subdirectory, until zero and round-robin is no longer used. It may be useful to set *MAX\_INHERIT\_RR* to 2 or 3 when setting the default directory layout on the root of a **new** filesystem, so that top-level subdirectories are immediately spread across MDTs, rather than waiting for the MDTs to become imbalanced. Round-robin subdirectory creation is unlikely to be useful for existing filesystems that already have many files and imbalanced MDTs, since space balancing will already happen, and this will unnecessarily increase the number of remote subdirectories (increasing overhead) without any benefit.

# [NOTE](#NOTE)

If neither **-c** or **-i** are specified, **lfs mkdir** will default to **-c 1 -i -1** and create the directory on an MDT that is less full than the others.

The **lfs setdirstripe** command is only usable by root unless the **mdt.\*.enable\_remote\_dir\_gid** is set on the MDS via **lctl set\_param** to be either a non-zero numeric GID to limit it to a single group (e.g. the **operator** or **admin** GID), or **-1** to allow any user/group to create remote directories. By default, it is **0** to limit remote/striped directories to only the root user.

The root directory of the file system is on MDT0000, and a filesystem-wide default directory layout is set on it by default: **lfs setdirstripe -D -i -1 -c 1 --max-inherit -1 --max-inherit-rr 3** , which is a space balanced directory layout, therefore new directories will be created on all MDTs by inode and space usage, and the top three level of new directories will be created in roundrobin mode if system is balanced. If user doesn't want automatic space balance, deleting this default directory layout won't work, because it will be recreated if not set, instead user can run **lfs setdirstripe -D -i -1 -c 1 --max-inherit 1 &lt;mountpoint&gt;** to limit space balance in the top level, or run **lfs setdirstripe -D -i 0 -c 1 --max-inherit 1 &lt;mountpoint&gt;** to disable it.

# [EXAMPLES](#EXAMPLES)

**$ lfs setdirstripe -c 2 -i 1 -H all\_char /mnt/lustre/dir1**

This creates a directory striped on two MDTs, whose first stripe is on **MDT0001** (MDT index 1), and whose hash type is **all\_char**.

**$ lfs mkdir --foreign=symlink --xattr PUUID/CUUID /mnt/lustre/dir1**

This creates **dir1** with foreign (non-lustre/free format) **PUUID/CUUID** striping/LMV EA value (symlink type).

# [AVAILABILITY](#AVAILABILITY)

The **lfs setdirstripe** command is part of the Lustre filesystem.

# [SEE ALSO](#SEE_ALSO)

[**lctl**(8)](/man/enterprise-packages/lustre/lctl.8), [**lfs**(1)](/man/enterprise-packages/lustre/lfs.1), [**lfs-getdirstripe**(1)](/man/enterprise-packages/lustre/lfs-getdirstripe.1), [**lfs-setstripe**(1)](/man/enterprise-packages/lustre/lfs-setstripe.1), [**lustre**(7)](/man/enterprise-packages/lustre/lustre.7)

2017-11-07 Lustre

---

Document: lfs-mkdir(1) from lustre 2.17.59-r2 (Chainguard OS)
Source: https://github.com/lustre/lustre-release
