---
name: "mfscreatepattern"
section: "1"
platform: "linux"
package: "moosefs"
version: "4.59.2-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/mfspatadmin"
---

# mfscreatepattern(1)

MooseFS patterns administration tool

Part of [mfspatadmin(1)](/mfspatadmin/1.md).

## NAME

mfspatadmin - **MooseFS** patterns administration tool

## SYNOPSIS

**mfscreatepattern** \[**-?**\] \[**-M** *MOUNTPOINT*\] **-n** *pattern* \[**-u** *uid*\] \[**-g** *gid*\] \[**-p** *priority*\] \[**-c** *storage\_class*\] \[**-t** *trash\_retention*\] \[**-f** *eattr*\]

**mfsdeletepattern** \[**-?**\] \[**-M** *MOUNTPOINT*\] **-n** *pattern* \[**-u** *uid*\] \[**-g** *gid*\]

**mfslistpattern** \[**-?**\] \[**-M** *MOUNTPOINT*\]

## DESCRIPTION

This  is  a  set  of  tools for managing patterns, which are used to override storage classes, trash retention and/or extra attributes whenever a new file is created or an existing file is renamed.

**mfscreatepattern** adds new pattern definition, described below.

**mfsdeletepattern** removes specific pattern definition

**mfslistpattern** lists all the pattern definitions

## OPTIONS

**-n** defines pattern that will be matched against file names. This is simple GLOB format (see below). This option must be defined for **add** and **delete** commands

**-u** defines user id that has to be equal to effective user id of the user that creates or renames a file. If not specified, user id will not be checked on match.

**-g** defines group id that has to be equal to one of the group ids of the user that creates or renames a file. If not specified, group id will not be checked on match.

**-p** priority of match. When there are more patterns that match a file name, patterns with higher priority take precedence. Priority can be defined as a value between **0** (lowest) and **255** (highest). If not specified, default value of **128** is used.  If two or more patterns with the same priority match a file name (with highest possible priority  for that file), only one (unspecified) of them will be used.

**-c** name of storage class that will be set on match

**-t** value of trash retention that will be set on match; minimum unit is hours, for value formatting see TIME

**-f** names of flags, separated by commas, that will be set on match.  Each flag **must** be preceded with either '+' or '-' sign, meaning that this flag should be set on or off, respectively. For description of flags refer to [**mfseattr**(1)](/mfseattr/1.md).

**-M** **MooseFS** mount point, doesn't need to be specified if a tool is run inside **MooseFS**  mounted directory or **MooseFS** is mounted in /mnt/mfs/

**-?** displays short usage message

At least one of the **-c**, **-t**, **-f** options must be defined for **add** command.

## NOTES

### TIME

For variables that define time without requiring a single, specific unit, time can be defined as a number of seconds or hours (integer), depending on minimum unit for the variable, or as a time period in one of two possible formats:

first format: #.#T where T is one of: s-seconds, m-minutes, h-hours, d-days or w-weeks; fractions of minimum unit will be rounded

second format: #w#d#h#m#s, any number of definitions can be omitted, but the remaining definitions must be in order (so #d#m is still a valid definition, but #m#d is not); ranges: s,m: 0 to 59, h: 0 to 23, d: 0 t o 6, w is unlimited and the first definition is also always unlimited (i.e. for #d#h#m d will be unlimited)

If a minimum unit of a variable is larger than seconds, units below the minimum one will not be accepted. For example, a variable that has hours as a minimum unit will not accept s and m units.

Examples:

1\.5d is the same as 1d12h, is the same as 36h

2\.5w is the same as 2w3d12h, is the same as 420h; 2w84h is not a valid time period (h is not the first definition, so it is bound by range 0 to 23)

### PATTERN DEFINITION

Pattern is a string with optional wildcards (similar to UNIX glob). Recognized wildcards:

**\*** - matches any number of any characters including none

**?** - matches any single character

**\[***abc***\]** - matches one character given in the bracket

**\[***FROM***-***TO***\]** - matches one character from the range given in the bracket

**\[!***abc***\]** - matches one character that is not given in the bracket

**\[!***FROM***-***TO***\]** - matches one character that is not from the range given in the bracket

Examples of patterns:

**exactname** - matches file with name 'exactname' only

**\*.txt** - matches any 'text' file (formally file with name suffix '.txt').

**myproject\*** - matches any file with name prefix 'myproject'.

**letter\[0-9\]** - matches files with names 'letter0', 'letter1', 'letter2', ... 'letter9'.

**\[CB\]at** - matches files with names 'Cat' and 'Bat'.

**\[!0-9\]\*** - matches files with names that don't start with a digit

## REPORTING BUGS

Report bugs to \<bugs@moosefs.com\>.

## COPYRIGHT

Copyright (C) 2026 Jakub Kruszona-Zawadzki, Saglabs SA

This file is part of MooseFS.

MooseFS is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2 (only).

MooseFS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, see \<https://www.gnu.org/licenses/\>.

## SEE ALSO

[**mfsmount**(8)](/mfsmount/8.md), [**mfstools**(1)](/mfstools/1.md), [**mfssclass**(1)](/mfssclass/1.md), [**mfseattr**(1)](/mfseattr/1.md)
