Whamcloud - gitweb
43fc9e4312cab89c29b147397c28c569320bf7df
[fs/lustre-release.git] / lustre / doc / lfs-migrate.1
1 .TH LFS-MIGRATE 1 2021-11-08 "Lustre" "Lustre Utilities"
2 .SH NAME
3 lfs-migrate \- migrate files or directories between MDTs or OSTs.
4 .SH SYNOPSIS
5 .B lfs migrate
6 .RB [ -h "] [" -v ]
7 .RI [ SETSTRIPE_OPTIONS " ... ]"
8 .IR FILE " ..."
9 .br
10 .B lfs migrate -m \fISTART_MDT_INDEX
11 .RB [ -cdHv ]
12 .I DIRECTORY
13 .br
14 .SH DESCRIPTION
15 Migrate OST objects between OSTs for the specified
16 .IR FILE ,
17 or recursively migrate
18 .I DIRECTORY
19 and all inodes/directories therein between MDTs.
20 .SH OST MIGRATE OPTIONS
21 .P
22 The
23 .B lfs migrate
24 command can be used for moving files from one (or more) OSTs to other
25 OSTs (e.g. for space balancing between OSTs, or to evacuate an OST for
26 hardware reasons), to change the stripe count or other layout parameters
27 of a file (e.g. to increase the bandwidth of a file by striping it over
28 multiple OSTs), or to move the file between different classes of storage
29 (e.g. SSD vs. HDD OSTs, or local vs. remote OSTs in different pools).
30 .P
31 In OST object migration mode, the command supports the same
32 .I SETSTRIPE_OPTIONS
33 listed in
34 .BR lfs-setstripe (1)
35 to specify the layout of the target file.  The migrate command differs from
36 .B lfs setstripe
37 in that
38 .B lfs migrate
39 will copy the data from the existing file(s) using the new layout parameters
40 to the new OST(s). In contrast,
41 .B lfs setstripe
42 is used for creating new (empty) files with the specified layout.
43 For OST object migration, there additional options available:
44 .TP
45 .BR -b , --block
46 Block access to the file by other applications during data migration
47 (default).  This prevents other processes from accessing the file during
48 migration, which prevents data data writes to the old file objects from
49 being lost.  This should be used if an OST needs to be completely emptied
50 prior to its removal, to ensure all requested files are migrated off the
51 OST.
52 .TP
53 .BR -h , --help
54 Print usage message.
55 .TP
56 .BR -n , --non-block
57 Abort migration if concurrent file access is detected.  This can be
58 used with OST space balancing migration to avoid interfering with file
59 access by applications if there is not a requirement to migrate any
60 particular file to the new layout.
61 .TP
62 .BR -D , --non-direct
63 Do
64 .B not
65 use
66 .B O_DIRECT
67 read and write operations when migrating a file.  The
68 .B O_DIRECT
69 option avoids data copy from kernel buffers into userspace, which can
70 impose CPU and memory overhead on the copy operation, but makes read and
71 write operations synchronous.  Using the
72 .B --non-direct
73 option uses buffered read/write operations, which may improve migration
74 speed at the cost of more CPU and memory overhead.
75 .br
76 This option cannot be used on encrypted files when the encryption key is not
77 available. It will result in
78 .B
79 -ENOKEY.
80 .TP
81 .BR -W , --bandwidth
82 Limit how much file system bandwidth a migrate job can consume.
83 .TP
84 .BR --stats
85 Output verbose stats about migrate job progress in YAML format.
86 .TP
87 .BR --stats-interval
88 Controls how often the stats are output; this defaults to 5 seconds.
89 .TP
90 .BR -v , --verbose
91 Print each filename as it is migrated.
92 .P
93 NOTE:
94 .B lfs migrate
95 has a complementary
96 .B lfs_migrate
97 script which is used to provide extra functionality when migrating file
98 data between OSTs and has a separate man page.  See
99 .BR lfs_migrate (1)
100 for details.
101 .SH MDT MIGRATE OPTIONS
102 .TP
103 .BR -m , --mdt-index=\fIMDT_INDEX [, \fIMDT_INDEX ,...]
104 The specified
105 .I DIRECTORY
106 .B and all subdirectories and inodes
107 will be migrated to the MDT with the specified
108 .IR MDT_INDEX .
109 This is useful if new MDTs have been added to a filesystem and existing user or
110 project directories should be migrated off old MDTs to balance the space usage
111 and future metadata workload. If
112 .I MDT_INDEX
113 is -1, the MDT index will be balanced by free space and inodes among
114 available MDTs.  If multiple
115 .I MDT_INDEX
116 values are specified in a comma-seperated list, then all
117 subdirectories will be
118 .B striped
119 across all of the specified MDT indices as if an equivalent
120 .BI -c N
121 option were given.
122 .TP
123 .BR -c , --mdt-count=\fICOUNT\fR
124 All directories and subdirectories in the tree will be striped across
125 .I COUNT
126 MDTs, always using
127 .I MDT_INDEX
128 as the primary MDT for the directory.  If
129 .I MDT_INDEX is
130 .B -1
131 then
132 .I COUNT
133 directory stripes will be chosen from MDTs proportional to the amount
134 of free inodes and space on each MDT.  If multiple
135 .I MDT_INDEX
136 values are specified in a comma-separated list, then the number of specified
137 .I MDT_INDEX
138 values must match
139 .IR COUNT .
140 .TP
141 .BR -d , --directory
142 Only migrate the specified \fIDIRECTORY\fR and the non-directory inodes that are
143 directly located within it.
144 Similar to '\fBls -d\fR' and '\fBlfs getstripe -d\fR'.
145 .TP
146 .BR -H , --mdt-hash=\fIHASH_TYPE\fR
147 Use
148 .I HASH_TYPE
149 for the new directory layout.
150 .RS 1.2i
151 .TP
152 .B all_char (type 1)
153 Sum of ASCII characters modulo number of MDTs. This
154 provides weak hashing of the filename, and is suitable
155 for only testing or when the input is known to have
156 perfectly uniform distribution (e.g. sequential numbers).
157 .TP
158 .B fnv_1a_64 (type 2)
159 Fowler-Noll-Vo (FNV-1a) hash algorithm.  This provides
160 reasonably uniform, but not cryptographically strong,
161 hashing of the filename. (default)
162 .TP
163 .B crush (type 3)
164 CRUSH hash algorithm.  This is a consistent hash
165 algorithm, so minimum sub files need to relocate
166 during directory restripe.
167 .RE
168 .P
169 .TP
170 .B NOTE
171 Only the root user can migrate directories.  Files that have been archived by
172 HSM or are currently opened will fail to migrate, user can run the same migrate
173 command again to finish migration when files are ready.  Both inode and
174 directory entry will be migrated.  During migration directory and sub files can
175 be accessed like normal ones, but the migration itself cannot be interrupted.
176 .TP
177 .B NOTE
178 It is not currently possible to migrate files with an
179 .B mdt
180 component (Data-on-MDT, DoM).  If it is necessary to migrate such files off
181 a particular MDT, they must first be migrated to have a non-DoM file layout
182 and then the inodes migrated separately.  See
183 .B EXAMPLES
184 for details on how to migrate DoM files between MDTs.
185 .TP
186 .B WARNING
187 Each migrated file or directory will have a new FID, and hence a new inode
188 number.  As a consequence, files archived by Lustre HSM that depend on
189 the FID as the identifier in the HSM archive cannot currently be migrated.
190 Having a new inode number may also cause backup tools to consider the
191 migrated file(s) to be a new, and cause them to be backed up again.
192 .P
193 .SH EXAMPLES
194 .TP
195 .B $ lfs migrate -c 2 /mnt/lustre/file1
196 This migrates the data in
197 .B file1
198 into a new layout with 2 stripes.
199 .TP
200 .B $ lfs migrate -E 256M -c 1 -E 16G -c 4 -E eof -c 40 /mnt/lustre/file2
201 .br
202 This migrates the data in
203 .B file2
204 into a three component composite layout (number of stripes depends on
205 file size).
206 .TP
207 .B # lfs migrate -m 0,2 testremote
208 .br
209 Recursively move the subdirectories and inodes contained in directory
210 .B remotedir
211 from its current MDT to MDT0000 and MDT0002.  The
212 .B testremote
213 directory and all of its subdirectories will be striped across both MDTs.
214 .TP
215 .B $ lfs migrate -m 0,2 -d ./testremote
216 Move ./testremote and the first level of sub files from their current MDT
217 to the MDT with index 0 and 2. Different from above case, the layout of
218 subdirectories under ./testremote won't be changed.
219 .TP
220 .B # lfs setstripe -E 256M -c 1 -E 16G -c 4 -E eof -c 40 topdir
221 Set a default PFL layout (without any DoM component) on the directory
222 .BR topdir ,
223 .TP
224 .B # lfs find dir -type f -L mdt -0 | xargs -0 lfs migrate --copy topdir
225 then find and migrate all regular files that have an
226 .B mdt
227 component to copy the default layout from the specified
228 .BR topdir ,
229 .TP
230 .B # lfs migrate -m 2 topdir
231 .br
232 and finally migrate the directory
233 .B topdir
234 and all files and subdirectories in that tree to MDT0002.  This allows
235 migrating files with DoM components off an MDT.
236 .SH AUTHOR
237 The lfs command is part of the Lustre filesystem.
238 .SH SEE ALSO
239 .BR lfs (1),
240 .BR lfs-setstripe (1),
241 .BR lfs-setdirstripe (1),
242 .BR lfs-getdirstripe (1),
243 .BR lfs-mkdir (1),
244 .BR lfs_migrate (1),
245 .BR lctl (8),