1xfsrestore(8) System Manager's Manual xfsrestore(8)
2
3
4
6 xfsrestore - XFS filesystem incremental restore utility
7
9 xfsrestore -h
10 xfsrestore [ options ] -f source [ -f source ... ] dest
11 xfsrestore [ options ] - dest
12 xfsrestore -I [ subopt=value ... ]
13
15 xfsrestore restores filesystems from dumps produced by xfsdump(8). Two
16 modes of operation are available: simple and cumulative.
17
18 The default is simple mode. xfsrestore populates the specified desti‐
19 nation directory, dest, with the files contained in the dump media.
20
21 The -r option specifies the cumulative mode. Successive invocations of
22 xfsrestore are used to apply a chronologically ordered sequence of
23 delta dumps to a base (level 0) dump. The contents of the filesystem
24 at the time each dump was produced is reproduced. This can involve
25 adding, deleting, renaming, linking, and unlinking files and directo‐
26 ries.
27
28 A delta dump is defined as either an incremental dump (xfsdump -l
29 option with level > 0) or a resumed dump (xfsdump -R option). The
30 deltas must be applied in the order they were produced. Each delta
31 applied must have been produced with the previously applied delta as
32 its base.
33
34 The options to xfsrestore are:
35
36 -a housekeeping
37 Each invocation of xfsrestore creates a directory called xfsre‐
38 storehousekeepingdir. This directory is normally created directly
39 under the dest directory. The -a option allows the operator to
40 specify an alternate directory, housekeeping, in which xfsrestore
41 creates the xfsrestorehousekeeping directory. When performing a
42 cumulative (-r option) restore, each successive invocation of xfs‐
43 restore must specify the same alternate directory.
44
45 -b blocksize
46 Specifies the blocksize, in bytes, to be used for the restore.
47 For other drives such as DAT or 8 mm , the same blocksize used for
48 the xfsdump operation must be specified to restore the tape. The
49 default block size is 1Mb.
50
51 -c progname
52 Use the specified program to alert the operator when a media
53 change is required. The alert program is typically a script to
54 send a mail or flash a window to draw the operator's attention.
55
56 -e Prevents xfsrestore from overwriting existing files in the dest
57 directory.
58
59 -f source [ -f source ... ]
60 Specifies a source of the dump to be restored. This can be the
61 pathname of a device (such as a tape drive), a regular file or a
62 remote tape drive (see rmt(8)). This option must be omitted if
63 the standard input option (a lone - preceding the dest specifica‐
64 tion) is specified.
65
66 -i Selects interactive operation. Once the on-media directory hier‐
67 archy has been read, an interactive dialogue is begun. The opera‐
68 tor uses a small set of commands to peruse the directory hierar‐
69 chy, selecting files and subtrees for extraction. The available
70 commands are given below. Initially nothing is selected, except
71 for those subtrees specified with -s command line options.
72
73 ls [arg] List the entries in the current directory or the
74 specified directory, or the specified non-directory
75 file entry. Both the entry's original inode number
76 and name are displayed. Entries that are directo‐
77 ries are appended with a `/'. Entries that have
78 been selected for extraction are prepended with a
79 `*'.
80
81 cd [arg] Change the current working directory to the speci‐
82 fied argument, or to the filesystem root directory
83 if no argument is specified.
84
85 pwd Print the pathname of the current directory, rela‐
86 tive to the filesystem root.
87
88 add [arg] The current directory or specified file or direc‐
89 tory within the current directory is selected for
90 extraction. If a directory is specified, then it
91 and all its descendents are selected. Entries that
92 are selected for extraction are prepended with a
93 `*' when they are listed by ls.
94
95 delete [arg] The current directory or specified file or direc‐
96 tory within the current directory is deselected for
97 extraction. If a directory is specified, then it
98 and all its descendents are deselected. The most
99 expedient way to extract most of the files from a
100 directory is to select the directory and then dese‐
101 lect those files that are not needed.
102
103 extract Ends the interactive dialogue, and causes all
104 selected subtrees to be restored.
105
106 quit xfsrestore ends the interactive dialogue and imme‐
107 diately exits, even if there are files or subtrees
108 selected for extraction.
109
110 help List a summary of the available commands.
111
112 -m Use the minimal tape protocol. This option cannot be used without
113 specifying a blocksize to be used (see -b option above).
114
115 -n file
116 Allows xfsrestore to restore only files newer than file. The mod‐
117 ification time of file (i.e., as displayed with the ls -l command)
118 is compared to the inode modification time of each file on the
119 source media (i.e., as displayed with the ls -lc command). A file
120 is restored from media only if its inode modification time is
121 greater than or equal to the modification time of file.
122
123 -o Restore file and directory owner/group even if not root. When run
124 with an effective user id of root, xfsrestore restores owner and
125 group of each file and directory. When run with any other effec‐
126 tive user id it does not, unless this option is specified.
127
128 -p interval
129 Causes progress reports to be printed at intervals of interval
130 seconds. The interval value is approximate, xfsrestore will delay
131 progress reports to avoid undue processing overhead.
132
133 -q Source tape drive is a QIC tape. QIC tapes only use a 512 byte
134 blocksize, for which xfsrestore must make special allowances.
135
136 -r Selects the cumulative mode of operation.
137
138 -s subtree
139 Specifies a subtree to restore. Any number of -s options are
140 allowed. The restore is constrained to the union of all subtrees
141 specified. Each subtree is specified as a pathname relative to
142 the restore dest. If a directory is specified, the directory and
143 all files beneath that directory are restored.
144
145 -t Displays the contents of the dump, but does not create or modify
146 any files or directories. It may be desirable to set the ver‐
147 bosity level to silent when using this option.
148
149 -v verbosity
150 -v subsys=verbosity[,subsys=verbosity,...]
151 Specifies the level of detail used for messages displayed during
152 the course of the restore. The verbosity argument can be passed as
153 either a string or an integer. If passed as a string the following
154 values may be used: silent, verbose, trace, debug, or nitty. If
155 passed as an integer, values from 0-5 may be used. The values 0-4
156 correspond to the strings already listed. The value 5 can be used
157 to produce even more verbose debug output.
158
159 The first form of this option activates message logging across all
160 restore subsystems. The second form allows the message logging
161 level to be controlled on a per-subsystem basis. The two forms can
162 be combined (see the example below). The argument subsys can take
163 one of the following values: general, proc, drive, media, inven‐
164 tory, and tree.
165
166 For example, to restore the root filesystem with tracing activated
167 for all subsystems:
168
169 # xfsrestore -v trace -f /dev/tape /
170
171 To enable debug-level tracing for drive and media operations:
172
173 # xfsrestore -v drive=debug,media=debug -f /dev/tape /
174
175 To enable tracing for all subsystems, and debug level tracing for
176 drive operations only:
177
178 # xfsrestore -v trace,drive=debug -f /dev/tape /
179
180
181 -A Do not restore extended file attributes. When restoring a
182 filesystem managed within a DMF environment this option should not
183 be used. DMF stores file migration status within extended
184 attributes associated with each file. If these attributes are not
185 preserved when the filesystem is restored, files that had been in
186 migrated state will not be recallable by DMF. Note that dumping of
187 extended file attributes is also optional.
188
189 -B Change the ownership and permissions of the destination directory
190 to match those of the root directory of the dump.
191
192 -D Restore DMAPI (Data Management Application Programming Interface)
193 event settings. If the restored filesystem will be managed within
194 the same DMF environment as the original dump it is essential that
195 the -D option be used. Otherwise it is not usually desirable to
196 restore these settings.
197
198 -E Prevents xfsrestore from overwriting newer versions of files. The
199 inode modification time of the on-media file is compared to the
200 inode modification time of corresponding file in the dest direc‐
201 tory. The file is restored only if the on-media version is newer
202 than the version in the dest directory. The inode modification
203 time of a file can be displayed with the ls -lc command.
204
205 -F Inhibit interactive operator prompts. This option inhibits xfsre‐
206 store from prompting the operator for verification of the selected
207 dump as the restore target and from prompting for any media
208 change.
209
210 -I Causes the xfsdump inventory to be displayed (no restore is per‐
211 formed). Each time xfsdump is used, an online inventory in
212 /var/lib/xfsdump/inventory is updated. This is used to determine
213 the base for incremental dumps. It is also useful for manually
214 identifying a dump session to be restored (see the -L and -S
215 options). Suboptions to filter the inventory display are
216 described later.
217
218 -J Inhibits inventory update when on-media session inventory encoun‐
219 tered during restore. xfsrestore opportunistically updates the
220 online inventory when it encounters an on-media session inventory,
221 but only if run with an effective user id of root and only if this
222 option is not given.
223
224 -L session_label
225 Specifies the label of the dump session to be restored. The
226 source media is searched for this label. It is any arbitrary
227 string up to 255 characters long. The label of the desired dump
228 session can be copied from the inventory display produced by the
229 -I option.
230
231 -O options_file
232 Insert the options contained in options_file into the beginning of
233 the command line. The options are specified just as they would
234 appear if typed into the command line. In addition, newline char‐
235 acters (\n) can be used as whitespace. The options are placed
236 before all options actually given on the command line, just after
237 the command name. Only one -O option can be used. Recursive use
238 is ignored. The destination directory cannot be specified in
239 options_file.
240
241 -Q Force completion of an interrupted restore session. This option
242 is required to work around one specific pathological scenario.
243 When restoring a dump session which was interrupted due to an EOM
244 condition and no online session inventory is available, xfsrestore
245 cannot know when the restore of that dump session is complete.
246 The operator is forced to interrupt the restore session. In that
247 case, if the operator tries to subsequently apply a resumed dump
248 (using the -r option), xfsrestore refuses to do so. The operator
249 must tell xfsrestore to consider the base restore complete by
250 using this option when applying the resumed dump.
251
252 -R Resume a previously interrupted restore. xfsrestore can be inter‐
253 rupted at any time by pressing the terminal interrupt character
254 (see stty(1)). Use this option to resume the restore. The -a and
255 destination options must be the same.
256
257 -S session_id
258 Specifies the session UUID of the dump session to be restored.
259 The source media is searched for this UUID. The UUID of the
260 desired dump session can be copied from the inventory display pro‐
261 duced by the -I option.
262
263 -T Inhibits interactive dialogue timeouts. xfsrestore prompts the
264 operator for media changes. This dialogue normally times out if
265 no response is supplied. This option prevents the timeout.
266
267 -X subtree
268 Specifies a subtree to exclude. This is the converse of the -s
269 option. Any number of -X options are allowed. Each subtree is
270 specified as a pathname relative to the restore dest. If a direc‐
271 tory is specified, the directory and all files beneath that direc‐
272 tory are excluded.
273
274 -Y io_ring_length
275 Specify I/O buffer ring length. xfsrestore uses a ring of input
276 buffers to achieve maximum throughput when restoring from tape
277 drives. The default ring length is 3. However, this is only sup‐
278 ported when running multi-threaded which has not been done for
279 Linux yet - making this option benign.
280
281 - A lone - causes the standard input to be read as the source of the
282 dump to be restored. Standard input can be a pipe from another
283 utility (such as xfsdump(8)) or a redirected file. This option
284 cannot be used with the -f option. The - must follow all other
285 options, and precede the dest specification.
286
287 The dumped filesystem is restored into the dest directory. There is no
288 default; the dest must be specified.
289
291 Cumulative Restoration
292 A base (level 0) dump and an ordered set of delta dumps can be sequen‐
293 tially restored, each on top of the previous, to reproduce the contents
294 of the original filesystem at the time the last delta was produced.
295 The operator invokes xfsrestore once for each dump. The -r option must
296 be specified. The dest directory must be the same for all invocations.
297 Each invocation leaves a directory named xfsrestorehousekeeping in the
298 dest directory (however, see the -a option above). This directory con‐
299 tains the state information that must be communicated between invoca‐
300 tions. The operator must remove this directory after the last delta
301 has been applied.
302
303 xfsrestore also generates a directory named orphanage in the dest
304 directory. xfsrestore removes this directory after completing a simple
305 restore. However, if orphanage is not empty, it is not removed. This
306 can happen if files present on the dump media are not referenced by any
307 of the restored directories. The orphanage has an entry for each such
308 file. The entry name is the file's original inode number, a ".", and
309 the file's generation count modulo 4096 (only the lower 12 bits of the
310 generation count are used).
311
312 xfsrestore does not remove the orphanage after cumulative restores.
313 Like the xfsrestorehousekeeping directory, the operator must remove it
314 after applying all delta dumps.
315
316 Media Management
317 A dump consists of one or more media files contained on one or more
318 media objects. A media file contains all or a portion of the filesys‐
319 tem dump. Large filesystems are broken up into multiple media files to
320 minimize the impact of media dropouts, and to accommodate media object
321 boundaries (end-of-media).
322
323 A media object is any storage medium: a tape cartridge, a remote tape
324 device (see rmt(8)), a regular file, or the standard input (currently
325 other removable media drives are not supported). Tape cartridges can
326 contain multiple media files, which are typically separated by (in tape
327 parlance) file marks. If a dump spans multiple media objects, the
328 restore must begin with the media object containing the first media
329 file dumped. The operator is prompted when the next media object is
330 needed.
331
332 Media objects can contain more than one dump. The operator can select
333 the desired dump by specifying the dump label (-L option), or by speci‐
334 fying the dump UUID (-S option). If neither is specified, xfsrestore
335 scans the entire media object, prompting the operator as each dump ses‐
336 sion is encountered.
337
338 The inventory display (-I option) is useful for identifying the media
339 objects required. It is also useful for identifying a dump session.
340 The session UUID can be copied from the inventory display to the -S
341 option argument to unambiguously identify a dump session to be
342 restored.
343
344 Dumps placed in regular files or the standard output do not span multi‐
345 ple media objects, nor do they contain multiple dumps.
346
347 Inventory
348 Each dump session updates an inventory database in /var/lib/xfs‐
349 dump/inventory. This database can be displayed by invoking xfsrestore
350 with the -I option. The display uses tabbed indentation to present the
351 inventory hierarchically. The first level is filesystem. The second
352 level is session. The third level is media stream (currently only one
353 stream is supported). The fourth level lists the media files sequen‐
354 tially composing the stream.
355
356 The following suboptions are available to filter the display.
357
358 -I depth=n
359 (where n is 1, 2, or 3) limits the hierarchical depth of the dis‐
360 play. When n is 1, only the filesystem information from the inven‐
361 tory is displayed. When n is 2, only filesystem and session infor‐
362 mation are displayed. When n is 3, only filesystem, session and
363 stream information are displayed.
364
365 -I level=n
366 (where n is the dump level) limits the display to dumps of that
367 particular dump level.
368
369 The display may be restricted to media files contained in a specific
370 media object.
371
372 -I mobjid=value
373 (where value is a media ID) specifies the media object by its
374 media ID.
375
376 -I mobjlabel=value
377 (where value is a media label) specifies the media object by its
378 media label.
379
380 Similarly, the display can be restricted to a specific filesystem.
381
382 -I mnt=mount_point
383 (that is, [hostname:]pathname), identifies the filesystem by
384 mountpoint. Specifying the hostname is optional, but may be use‐
385 ful in a clustered environment where more than one host can be
386 responsible for dumping a filesystem.
387
388 -I fsid=filesystem_id
389 identifies the filesystem by filesystem ID.
390
391 -I dev=device_pathname
392 (that is, [hostname:]device_pathname) identifies the filesystem by
393 device. As with the mnt filter, specifying the hostname is
394 optional.
395
396 More than one of these suboptions, separated by commas, may be speci‐
397 fied at the same time to limit the display of the inventory to those
398 dumps of interest. However, at most four suboptions can be specified
399 at once: one to constrain the display hierarchy depth, one to constrain
400 the dump level, one to constrain the media object, and one to constrain
401 the filesystem.
402
403 For example, -I depth=1,mobjlabel="tape 1",mnt=host1:/test_mnt would
404 display only the filesystem information (depth=1) for those filesystems
405 that were mounted on host1:/test_mnt at the time of the dump, and only
406 those filesystems dumped to the media object labeled "tape 1".
407
408 Dump records may be removed (pruned) from the inventory using the xfs‐
409 invutil program.
410
411 An additional media file is placed at the end of each dump stream.
412 This media file contains the inventory information for the current dump
413 session. If the online inventory files in /var/lib/xfsdump/inventory
414 are missing information for the current dump session, then the inven‐
415 tory information in the media file is automatically added to the files
416 in /var/lib/xfsdump/inventory. If you wish to incorporate the inven‐
417 tory information from the media file without restoring any data, you
418 may do so using the -t option:
419
420 # xfsrestore -t -f /dev/tape
421
422 This is useful to rebuild the inventory database if it is ever lost or
423 corrupted. The only caveat is that xfsrestore needs to read through
424 the entire dump in order to reach the inventory media file. This could
425 become time consuming for dump sessions with large media files.
426
427 Media Errors
428 xfsdump is tolerant of media errors, but cannot do error correction.
429 If a media error occurs in the body of a media file, the filesystem
430 file represented at that point is lost. The bad portion of the media
431 is skipped, and the restoration resumes at the next filesystem file
432 after the bad portion of the media.
433
434 If a media error occurs in the beginning of the media file, the entire
435 media file is lost. For this reason, large dumps are broken into a
436 number of reasonably sized media files. The restore resumes with the
437 next media file.
438
439 Quotas
440 When xfsdump dumps a filesystem with user quotas, it creates a file in
441 the root of the dump called xfsdump_quotas. xfsrestore can restore
442 this file like any other file included in the dump. This file can be
443 processed by the restore command of xfs_quota(8) to reactivate the quo‐
444 tas. However, the xfsdump_quotas file contains information which may
445 first require modification; specifically the filesystem name and the
446 user ids. If you are restoring the quotas for the same users on the
447 same filesystem from which the dump was taken, then no modification
448 will be necessary. However, if you are restoring the dump to a differ‐
449 ent filesystem, you will need to:
450
451 - ensure the new filesystem is mounted with the quota option
452
453 - modify the xfsdump_quotas file to contain the new filesystem name
454
455 - ensure the uids in the xfsdump_quotas file are correct
456
457 Once the quota information has been verified, the restore command of
458 xfs_quota [4m(8) can be used to apply the quota limits to the filesystem.
459
460 Group and project quotas are handled in a similar fashion and will be
461 restored in files called xfsdump_quotas_group and xfsdump_quotas_proj,
462 respectively.
463
465 To restore the root filesystem from a locally mounted tape:
466
467 # xfsrestore -f /dev/tape /
468
469 To restore from a remote tape, specifying the dump session id:
470
471 # xfsrestore -L session_1 -f otherhost:/dev/tape /new
472
473 To restore the contents a of a dump to another subdirectory:
474
475 # xfsrestore -f /dev/tape /newdir
476
477 To copy the contents of a filesystem to another directory (see xfs‐
478 dump(8)):
479
480 # xfsdump -J - / | xfsrestore -J - /new
481
482
484 /var/lib/xfsdump/inventory
485 dump inventory database
486
488 rmt(8), xfsdump(8), xfsinvutil(8), xfs_quota(8), attr_set(2).
489
491 The exit code is 0 on normal completion, and non-zero if an error
492 occurred or the restore was terminated by the operator.
493
494 For all verbosity levels greater than 0 (silent) the final line of the
495 output shows the exit status of the restore. It is of the form:
496
497 xfsdump: Restore Status: code
498
499 Where code takes one of the following values: SUCCESS (normal comple‐
500 tion), INTERRUPT (interrupted), QUIT (media no longer usable), INCOM‐
501 PLETE (restore incomplete), FAULT (software error), and ERROR (resource
502 error). Every attempt will be made to keep both the syntax and the
503 semantics of this log message unchanged in future versions of xfsre‐
504 store. However, it may be necessary to refine or expand the set of
505 exit codes, or their interpretation at some point in the future.
506
508 Pathnames of restored non-directory files (relative to the dest direc‐
509 tory) must be 1023 characters (MAXPATHLEN) or less. Longer pathnames
510 are discarded and a warning message displayed.
511
512 There is no verify option to xfsrestore. This would allow the operator
513 to compare a filesystem dump to an existing filesystem, without actu‐
514 ally doing a restore.
515
516 The interactive commands (-i option) do not understand regular expres‐
517 sions.
518
519 When the minimal rmt option is specified, xfsrestore applies it to all
520 remote tape sources. The same blocksize (specified by the -b option) is
521 used for all these remote drives.
522
523 xfsrestore uses the alert program only when a media change is required.
524
525 Cumulative mode (-r option) requires that the operator invoke xfsre‐
526 store for the base and for each delta to be applied in sequence to the
527 base. It would be better to allow the operator to identify the last
528 delta in the sequence of interest, and let xfsrestore work backwards
529 from that delta to identify and apply the preceding deltas and base
530 dump, all in one invocation.
531
532
533
534 xfsrestore(8)