Viewing: lfs-mirror-extend.1

.TH LFS-MIRROR-EXTEND 1 2026-10-23 Lustre "Lustre User Utilities"
.SH NAME
lfs-mirror-extend \- add mirror(s) to an existing file
.SH SYNOPSIS
.SY "lfs mirror extend"
.RB [ --bandwidth | --bandwidth-limit | -W
.I BANDWIDTH_MB\c
.RB [ MG ]]
.RB [ --ec | --ec-stripe-count
.IR DATA + PARITY ]
.RB [ --ec-expert
.IR DATA + PARITY ]
.RB [ --fid | -F " [" --lustre-dir =\c
.I LUSTRE_MOUNT_POINT\c
.RB ]]
.RB [ --mirror-count | -N [[ = ]\c
.IR MIRROR_COUNT ]]
.RB [ --mirror-id
.IR MIRROR_ID ]
.RB [ --no-resync "] [" --no-verify "] [" --non-direct | -D ]
.RB [ --stats | --stats-interval =\c
.IR SECONDS ]
.RI [ SETSTRIPE_OPTIONS
.RB "| " -f
.IR VICTIM_FILE ]
.I FILES_FROM
.YS
.SH DESCRIPTION
This command adds mirror(s) to existing file(s) specified by
.IR FILES_FROM .
.P
The file(s) to be extended can already be a mirrored file,
or just a regular non-mirrored file.
If it's a non-mirrored file,
then the command will convert it to a mirrored file.
.P
When
.B --ec
is specified, the command operates in one of three erasure-coding modes:
.IP \(bu 2
With
.BI --mirror-id " MIRROR_ID"
.B --ec
.IR DATA + PARITY ,
a parity mirror is attached to the existing data mirror identified by
.IR MIRROR_ID .
The parity mirror inherits the extents and stripe configuration of the
target data mirror. The target must not itself be a parity mirror, and it
must not already be EC-protected: attaching a second parity mirror of a
different geometry to one data mirror, to change a file's EC protection
without rewriting its data, is not implemented yet.
.IP \(bu 2
With
.BR -N [\c
.IR MIRROR_COUNT ]
.B --ec
.IR DATA + PARITY ,
.I MIRROR_COUNT
new data+parity mirror pairs are added (one parity mirror per data
mirror).
.I MIRROR_COUNT
defaults to 1.
.IP \(bu 2
With
.B --ec
.IR DATA + PARITY
alone (no
.BR -N ,
no
.BR --mirror-id ),
a parity mirror is attached to the file's lone data mirror, at a cost of
.IR PARITY / DATA
of its size in additional storage. The target mirror is resolved per file;
files with two or more mirrors produce a per-file error directing the user
to disambiguate with
.B --mirror-id
or
.BR -N .
.P
In all three EC modes the new mirrors are brought in sync before the
command returns, matching the behavior of a regular (non-EC) extend:
new data mirrors are populated with a copy of the file data, and new
parity mirrors are computed from their data mirrors as
.BR lfs-mirror-resync (1)
does.
.P
A data mirror that is
.B stale
or
.B nosync
cannot be given a parity mirror. Parity is computed from the content of
the named mirror, and resynchronizing that mirror afterwards does not
mark its parity stale in turn, so the parity would go on protecting
superseded data; a
.B nosync
mirror is skipped by resync, which would leave the parity uncomputed. Run
.BR lfs-mirror-resync (1)
on the file first.
.P
.I FILES_FROM
may be:
.TP
.IR FILENAME " [" FILENAME " ...]"
File names are listed on command line.
Multiple file names are separated by space char.
.TP
.BR -0 ", " --null
Read file names from stdin by default. Each file name is followed by a NUL char.
Usually is used after a pipeline from
.B lfs find --print0
command.
.TP
.BR --files-from = \fILIST_FILE
Read file names from file
.IR LIST_FILE .
One line for each file name.
If
.I LIST_FILE
is
.RB ' - ',
read from stdin.
If
.B --null
is specified at the same time,
file names are separated by a NUL char.
.TP
.I SETSTRIPE_OPTIONS
specify the specific layout for the mirror.
These are the same options that are used by
.BR lfs-setstripe (1).
If
.I SETSTRIPE_OPTIONS
are not specified,
then the stripe options inherited from the previous component will be used.
If
.I VICTIM_FILE
is specified and exists, then the command will merge the layout from that
file as a mirror added to the mirrored file.
After the command is finished, the victim file will be removed.
.SH OPTIONS
.TP
.BR --chunk-size = \fISIZE_MB
The buffer chunk size in MB used to transfer data. It is 1 (MB) by default.
But if
.BR --aio-tasks =0,
the default value is 64 (MB).
.TP
.BR --ec ", " --ec-stripe-count " \fIDATA\fB+\fIPARITY\fR"
Enable Erasure Coding (EC) for the mirror(s) added by this command, with
.I DATA
data stripes and
.I PARITY
parity stripes per RAID Set. The format is
.IR DATA + PARITY
or
.IR DATA : PARITY .
The semantics of the
.I DATA+PARITY
specification are identical to those described in
.BR lfs-setstripe (1).
.RS
.PP
A parity mirror inherits the extents and stripe configuration of the data
mirror it protects, so no
.I SETSTRIPE_OPTIONS
are given for it. This option cannot be combined with
.B -f
on the same mirror:
a mirror taken from a victim file gets both its content and its layout from
that file, leaving nothing for
.B --ec
to act on.
.PP
The target data mirror must be made of components that a RAID Set can be
spread over. A Data-on-MDT component has no OST stripes, and a self-extending
component
.RB ( -z )
has no fixed extent for a parity component to match, so a mirror containing
either is rejected, as it is by
.BR lfs-setstripe (1)
.BR --ec .
.RE
.TP
.BR --ec-expert " \fIDATA\fB+\fIPARITY\fR"
Equivalent to
.B --ec
but allows EC stripe counts that exceed the supported limits, as described in
.BR lfs-setstripe (1).
.TP
.BR -F ", " --fid
FID(s) are provided from command
.RI line/stdin/ LIST_FILE
instead of file path(s). Option
.BR --lustre-dir =\c
.I LUSTRE_MOUNT_POINT
must be specified at the same time.
.TP
.BR -f ", " --file " " \fIVICTIM_FILE
First, the contents of
.I VICTIM_FILE
will be verified to be the same as
.IR FILENAME .
If they are, the layout of
.I VICTIM_FILE
will be merged as a mirror added to the mirrored file.
Otherwise the layout of
.I VICTIM_FILE
will be unchanged.
However,
.BR --no-verify
can be specified to override this check.
Once the command is complete
.I VICTIM_FILE
will be removed.
This option cannot be specified with
.IR SETSTRIPE_OPTIONS .
.TP
.BR -N ", " --mirror-count [[ = ] \fIMIRROR_COUNT ]
Specifies that the next
.I MIRROR_COUNT
mirrors will have the following layout. This option can be repeated multiple
times to separate mirrors that have different layouts. The
.I MIRROR_COUNT
argument is optional and will default to 1 if not specified.
This lets a single mirror be specified easily with
.BR -N .
The
.BR --mirror-count | -N
option itself is also optional, and if not specified only 1 mirror will be
created.
The
.I MIRROR_COUNT
can be specified with a preceding '=' to indicate the number of
.B total
mirrors desired for the layout, such as
.BI --mirror-count== TOTAL_MIRROR_COUNT
or
.B -N=\c
.IR TOTAL_MIRROR_COUNT .
This will create mirrors until the total
number of mirrors in the layout is at least
.IR TOTAL_MIRROR_COUNT .
This also means that if there are already at least
.I TOTAL_MIRROR_COUNT
mirrors in the layout then no new mirrors will be created.
.TP
.BR --mirror-id " \fIMIRROR_ID\fR"
Identify the existing data mirror that a new parity mirror should be
attached to. Requires
.BR --ec ,
and may be passed at most once per command. Cannot be combined with
.BR -N
or
.BR -f .
.I MIRROR_ID
must be 1 or greater;
.BR "--mirror-id 0"
is rejected. The target mirror must be a data mirror that is not already
EC-protected; otherwise the command fails.
.IP
For a non-mirrored (single-mirror) file omit
.B --mirror-id
entirely and rely on
.B --ec
auto mode to attach parity to the lone mirror.
.TP
.BR --no-resync
This option indicates that the added mirror does not contain the updated
data from the original file, and all newly-added mirrors will be marked
.RB ' stale '
and will be unusable until they are resynced by the
.B lfs mirror resync
command (see
.BR lfs-mirror-resync (1)).
This can allow an interactive command to configure the new mirrors on a
file, while deferring the work of data resync to another node.
This option cannot be used with
.B -f
or
.BR --ec .
It needs the FLR EC connect flag, which is negotiated when the client
mounts: set the module parameters
.B llite_enable_flr_ec=1
on the client and
.B mdt_enable_flr_ec=1
on the MDS before mounting, otherwise the extend fails with
.BR EOPNOTSUPP .
.TP
.BR --no-verify
This option indicates not to verify the mirror(s) from victim file(s) in case
the victim file(s) contains the same data as the original mirrored file. This
option can save siginificant time on file comparison if the file size is large,
but it should only be used when the file contents are known to be the same.
.TP
.BR -D ", " --non-direct
Use buffered, not
.BR O_DIRECT ,
read and write operations when migrating a file.
This adds CPU and memory overhead for the data copy between kernel and
userspace buffers, but avoids synchronous read and write operations
that may slow down small file operations.
.br
This option cannot be used on encrypted files when the encryption key is not
available. It will result in
.B -ENOKEY
being returned.
.TP
.BR --stats
This option enables progress updates every 5 seconds, in YAML format.
.TP
.BR --stats-interval =\fISTATS_INTERVAL
This option enables progress updates every
.I STATS_INTERVAL
seconds, in YAML format.
.TP
.BR -W ", " --bandwidth " " \fIBANDWIDTH_MB [ MG ]
Limit the read and write bandwidth a mirror extend consumes to no more than
.I BANDWIDTH_MB
MiB/s. An optional suffix can be used to specify units in
.BR M ebibytes
or
.BR G ibibytes
per second.
.SH EXAMPLES
Add 2 mirrors to /mnt/lustre/file1. If file1 is a non-mirrored file, then the
command will convert it to a mirrored file first and then add mirrors. Each
mirror has the same default striping pattern with
.I STRIPE_COUNT
and
.I STRIPE_SIZE
inherited from filesystem-wide default values, and OST
.I POOL_NAME
inherited from parent directory:
.RS
.EX
.B # lfs mirror extend -N2 /mnt/lustre/file1
.EE
.RE
.PP
Add 3 PFL mirrors to /mnt/lustre/file1. Each mirror has the same specified PFL
layout:
.RS
.EX
.B # lfs mirror extend -N3 -E 1M -c 1 -E 32M -c 4 -S 16M -E eof -c -1 \
/mnt/lustre/file1
.EE
.RE
.PP
Add 3 plain layout mirrors to /mnt/lustre/file1. The first mirror has a single
stripe and 4MB stripe size. The second mirror has two stripes and locates on
OSTs with indices 2 and 3 allocated from the
.B flash
OST pool.
It also has 4MB stripe size inherited from the first mirror.
The third mirror has two stripes and 4MB stripe size inherited from the previous
mirror, and also has inherited OST
.I POOL_NAME
from parent directory:
.RS
.EX
.B # lfs mirror extend -N -c 1 -S 4M -N -c 2 -o 2,3 -p flash \
-N -p none /mnt/lustre/file1
.EE
.RE
.PP
Add 5 PFL mirrors to /mnt/lustre/file1. The first and second mirrors have the
same PFL layout. All of the components are allocated from the flash OST pool.
The last three mirrors have the same PFL layout. All of these components have a
stripe size of 16MB and use OSTs in the archive pool:
.RS
.EX
.B # lfs mirror extend -N2 -E 4M -c 2 --pool flash -E eof -c 4 -N3 -E 16M -c 4 \
-S 16M --pool archive -E eof -c -1 /mnt/lustre/file1
.EE
.RE
.PP
Merge the layouts from /mnt/lustre/file2 and /mnt/lustre/file3, which contain
the same data as /mnt/lustre/file1, use the layouts as mirrors and add them to
/mnt/lustre/file1 without verification:
.RS
.EX
.B # lfs mirror extend --no-verify -N -f /mnt/lustre/file2 -N -f \
/mnt/lustre/file3 /mnt/lustre/file1
.EE
.RE
.PP
Attach an 8+2 parity mirror to mirror ID 1 of /mnt/lustre/file1. The parity
is computed from the data mirror before the command returns:
.RS
.EX
.B # lfs mirror extend --mirror-id 1 --ec 8+2 /mnt/lustre/file1
.EE
.RE
.PP
Attach an 8+2 parity mirror to a non-mirrored file in place (auto mode).
The single existing data mirror is auto-resolved as the target;
the storage cost is
.I (8 + 2) / 8
= 1.25x the file size, vs 2x for a plain mirror:
.RS
.EX
.B # lfs mirror extend --ec 8+2 /mnt/lustre/file1
.EE
.RE
.PP
Add 2 new data+parity mirror pairs to /mnt/lustre/file1, each data mirror
having a single PFL component striped across 4 OSTs and protected by a
4+2 EC parity mirror:
.RS
.EX
.B # lfs mirror extend -N2 -E -1 -c 4 --ec 4+2 /mnt/lustre/file1
.EE
.RE
.PP
Add 2 stale mirrors to /mnt/lustre/file1 without copying any data, and
resync them later, possibly from another node:
.RS
.EX
.B # lfs mirror extend -N2 --no-resync -c -1 /mnt/lustre/file1
.B # lfs mirror resync /mnt/lustre/file1
.EE
.RE
.SH AVAILABILITY
The
.B lfs mirror extend
command is part of the
.BR lustre (7)
filesystem package since release 2.11.0
.\" Added in commit v2_10_55_0-55-g125f98fb5c
.SH SEE ALSO
.BR lfs (1),
.BR lfs-mirror-create (1),
.BR lfs-mirror-delete (1),
.BR lfs-mirror-resync (1),
.BR lfs-mirror-split (1),
.BR lfs-mirror-verify (1),
.BR lfs-setstripe (1),
.BR obdfilter.failure_domain (4)