restore.8 (22990) | restore.8 (23685) |
---|---|
1.\" Copyright (c) 1985, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. --- 15 unchanged lines hidden (view full) --- 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" | 1.\" Copyright (c) 1985, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. --- 15 unchanged lines hidden (view full) --- 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" |
32.\" @(#)restore.8 8.2 (Berkeley) 12/11/93 33.\" $Id$ 34.\" " 35.Dd December 11, 1993 | 32.\" @(#)restore.8 8.4 (Berkeley) 5/1/95 33.\" $Id: restore.8,v 1.9 1997/02/22 14:33:08 peter Exp $ 34.\" 35.Dd May 1, 1995 |
36.Dt RESTORE 8 37.Os BSD 4 38.Sh NAME 39.Nm restore 40.Nd "restore files or file systems from backups made with dump" 41.Sh SYNOPSIS 42.Nm restore | 36.Dt RESTORE 8 37.Os BSD 4 38.Sh NAME 39.Nm restore 40.Nd "restore files or file systems from backups made with dump" 41.Sh SYNOPSIS 42.Nm restore |
43.Ar key 44.Op Ar name Ar ... | 43.Fl i 44.Op Fl chmvy 45.Op Fl b Ar blocksize 46.Op Fl f Ar file 47.Op Fl s Ar fileno 48.Nm restore 49.Fl R 50.Op Fl cvy 51.Op Fl b Ar blocksize 52.Op Fl f Ar file 53.Op Fl s Ar fileno 54.Nm restore 55.Fl r 56.Op Fl cvy 57.Op Fl b Ar blocksize 58.Op Fl f Ar file 59.Op Fl s Ar fileno 60.Nm restore 61.Fl t 62.Op Fl chvy 63.Op Fl b Ar blocksize 64.Op Fl f Ar file 65.Op Fl s Ar fileno 66.Op file ... 67.Nm restore 68.Fl x 69.Op Fl chmvy 70.Op Fl b Ar blocksize 71.Op Fl f Ar file 72.Op Fl s Ar fileno 73.Op file ... 74.Pp 75.in -\\n(iSu 76(The 77.Bx 4.3 78option syntax is implemented for backward compatibility, but 79is not documented here.) |
45.Sh DESCRIPTION 46The 47.Nm restore 48command performs the inverse function of 49.Xr dump 8 . 50A full backup of a file system may be restored and 51subsequent incremental backups layered on top of it. 52Single files and 53directory subtrees may be restored from full or partial 54backups. 55.Nm Restore 56works across a network; 57to do this see the 58.Fl f 59flag described below. | 80.Sh DESCRIPTION 81The 82.Nm restore 83command performs the inverse function of 84.Xr dump 8 . 85A full backup of a file system may be restored and 86subsequent incremental backups layered on top of it. 87Single files and 88directory subtrees may be restored from full or partial 89backups. 90.Nm Restore 91works across a network; 92to do this see the 93.Fl f 94flag described below. |
60The actions 61of 62.Nm restore 63are controlled by the given 64.Cm key , 65which 66is a string of characters containing 67at most one function letter and possibly 68one or more function modifiers. | |
69Other arguments to the command are file or directory 70names specifying the files that are to be restored. 71Unless the | 95Other arguments to the command are file or directory 96names specifying the files that are to be restored. 97Unless the |
72.Cm h 73key is specified (see below), | 98.Fl h 99flag is specified (see below), |
74the appearance of a directory name refers to 75the files and (recursively) subdirectories of that directory. 76.Pp | 100the appearance of a directory name refers to 101the files and (recursively) subdirectories of that directory. 102.Pp |
77The function portion of 78the key is specified by one of the following letters: | 103Exactly one of the following flags is required: |
79.Bl -tag -width Ds | 104.Bl -tag -width Ds |
80.It Cm r 81Restore (rebuild a file system). 82The target file system should be made pristine with 83.Xr newfs 8 , 84mounted and the 85user 86.Xr cd Ns 'd 87into the pristine file system 88before starting the restoration of the initial level 0 backup. If the 89level 0 restores successfully, the 90.Cm r 91key may be used to restore 92any necessary incremental backups on top of the level 0. 93The 94.Cm r 95key precludes an interactive file extraction and can be 96detrimental to one's health if not used carefully (not to mention 97the disk). An example: 98.Bd -literal -offset indent 99newfs /dev/rrp0g eagle 100mount /dev/rp0g /mnt 101cd /mnt 102 103restore rf /dev/rst8 104.Ed 105.Pp 106Note that 107.Nm restore 108leaves a file 109.Pa restoresymtable 110in the root directory to pass information between incremental 111restore passes. 112This file should be removed when the last incremental has been 113restored. 114.Pp 115.Nm Restore , 116in conjunction with 117.Xr newfs 8 118and 119.Xr dump 8 , 120may be used to modify file system parameters 121such as size or block size. 122.It Cm R 123.Nm Restore 124requests a particular tape of a multi volume set on which to restart 125a full restore 126(see the 127.Cm r 128key above). 129This is useful if the restore has been interrupted. 130.It Cm x 131The named files are read from the given media. 132If a named file matches a directory whose contents 133are on the backup 134and the 135.Cm h 136key is not specified, 137the directory is recursively extracted. 138The owner, modification time, 139and mode are restored (if possible). 140If no file argument is given, 141then the root directory is extracted, 142which results in the entire content of the 143backup being extracted, 144unless the 145.Cm h 146key has been specified. 147.It Cm t 148The names of the specified files are listed if they occur 149on the backup. 150If no file argument is given, 151then the root directory is listed, 152which results in the entire content of the 153backup being listed, 154unless the 155.Cm h 156key has been specified. 157Note that the 158.Cm t 159key replaces the function of the old 160.Xr dumpdir 8 161program. 162.It Cm i | 105.It Fl i |
163This mode allows interactive restoration of files from a dump. 164After reading in the directory information from the dump, 165.Nm restore 166provides a shell like interface that allows the user to move 167around the directory tree selecting files to be extracted. 168The available commands are given below; 169for those commands that require an argument, 170the default is the current directory. 171.Bl -tag -width Fl 172.It Ic add Op Ar arg 173The current directory or specified argument is added to the list of 174files to be extracted. 175If a directory is specified, then it and all its descendents are 176added to the extraction list 177(unless the | 106This mode allows interactive restoration of files from a dump. 107After reading in the directory information from the dump, 108.Nm restore 109provides a shell like interface that allows the user to move 110around the directory tree selecting files to be extracted. 111The available commands are given below; 112for those commands that require an argument, 113the default is the current directory. 114.Bl -tag -width Fl 115.It Ic add Op Ar arg 116The current directory or specified argument is added to the list of 117files to be extracted. 118If a directory is specified, then it and all its descendents are 119added to the extraction list 120(unless the |
178.Cm h 179key is specified on the command line). | 121.Fl h 122flag is specified on the command line). |
180Files that are on the extraction list are prepended with a ``*'' 181when they are listed by 182.Ic ls . 183.It Ic \&cd Ar arg 184Change the current working directory to the specified argument. 185.It Ic delete Op Ar arg 186The current directory or specified argument is deleted from the list of 187files to be extracted. 188If a directory is specified, then it and all its descendents are 189deleted from the extraction list 190(unless the | 123Files that are on the extraction list are prepended with a ``*'' 124when they are listed by 125.Ic ls . 126.It Ic \&cd Ar arg 127Change the current working directory to the specified argument. 128.It Ic delete Op Ar arg 129The current directory or specified argument is deleted from the list of 130files to be extracted. 131If a directory is specified, then it and all its descendents are 132deleted from the extraction list 133(unless the |
191.Cm h 192key is specified on the command line). | 134.Fl h 135flag is specified on the command line). |
193The most expedient way to extract most of the files from a directory 194is to add the directory to the extraction list and then delete 195those files that are not needed. 196.It Ic extract 197All the files that are on the extraction list are extracted 198from the dump. 199.Nm Restore 200will ask which volume the user wishes to mount. 201The fastest way to extract a few files is to 202start with the last volume, and work towards the first volume. 203.It Ic help 204List a summary of the available commands. 205.It Ic \&ls Op Ar arg 206List the current or specified directory. 207Entries that are directories are appended with a ``/''. 208Entries that have been marked for extraction are prepended with a ``*''. | 136The most expedient way to extract most of the files from a directory 137is to add the directory to the extraction list and then delete 138those files that are not needed. 139.It Ic extract 140All the files that are on the extraction list are extracted 141from the dump. 142.Nm Restore 143will ask which volume the user wishes to mount. 144The fastest way to extract a few files is to 145start with the last volume, and work towards the first volume. 146.It Ic help 147List a summary of the available commands. 148.It Ic \&ls Op Ar arg 149List the current or specified directory. 150Entries that are directories are appended with a ``/''. 151Entries that have been marked for extraction are prepended with a ``*''. |
209If the verbose key is set the inode number of each entry is also listed. | 152If the verbose 153flag is set the inode number of each entry is also listed. |
210.It Ic pwd 211Print the full pathname of the current working directory. 212.It Ic quit 213Restore immediately exits, 214even if the extraction list is not empty. 215.It Ic setmodes 216All the directories that have been added to the extraction list 217have their owner, modes, and times set; 218nothing is extracted from the dump. 219This is useful for cleaning up after a restore has been prematurely aborted. 220.It Ic verbose 221The sense of the | 154.It Ic pwd 155Print the full pathname of the current working directory. 156.It Ic quit 157Restore immediately exits, 158even if the extraction list is not empty. 159.It Ic setmodes 160All the directories that have been added to the extraction list 161have their owner, modes, and times set; 162nothing is extracted from the dump. 163This is useful for cleaning up after a restore has been prematurely aborted. 164.It Ic verbose 165The sense of the |
222.Cm v 223key is toggled. 224When set, the verbose key causes the | 166.Fl v 167flag is toggled. 168When set, the verbose flag causes the |
225.Ic ls 226command to list the inode numbers of all entries. 227It also causes 228.Nm restore 229to print out information about each file as it is extracted. 230.El | 169.Ic ls 170command to list the inode numbers of all entries. 171It also causes 172.Nm restore 173to print out information about each file as it is extracted. 174.El |
175.It Fl R 176.Nm Restore 177requests a particular tape of a multi volume set on which to restart 178a full restore 179(see the 180.Fl r 181flag below). 182This is useful if the restore has been interrupted. 183.It Fl r 184Restore (rebuild a file system). 185The target file system should be made pristine with 186.Xr newfs 8 , 187mounted and the user 188.Xr cd Ns 'd 189into the pristine file system 190before starting the restoration of the initial level 0 backup. If the 191level 0 restores successfully, the 192.Fl r 193flag may be used to restore 194any necessary incremental backups on top of the level 0. 195The 196.Fl r 197flag precludes an interactive file extraction and can be 198detrimental to one's health if not used carefully (not to mention 199the disk). An example: 200.Bd -literal -offset indent 201newfs /dev/rrp0g eagle 202mount /dev/rp0g /mnt 203cd /mnt 204 205restore rf /dev/rst8 206.Ed 207.Pp 208Note that 209.Nm restore 210leaves a file 211.Pa restoresymtable 212in the root directory to pass information between incremental 213restore passes. 214This file should be removed when the last incremental has been 215restored. 216.Pp 217.Nm Restore , 218in conjunction with 219.Xr newfs 8 220and 221.Xr dump 8 , 222may be used to modify file system parameters 223such as size or block size. 224.It Fl t 225The names of the specified files are listed if they occur 226on the backup. 227If no file argument is given, 228then the root directory is listed, 229which results in the entire content of the 230backup being listed, 231unless the 232.Fl h 233flag has been specified. 234Note that the 235.Fl t 236flag replaces the function of the old 237.Xr dumpdir 8 238program. 239.ne 1i 240.It Fl x 241The named files are read from the given media. 242If a named file matches a directory whose contents 243are on the backup 244and the 245.Fl h 246flag is not specified, 247the directory is recursively extracted. 248The owner, modification time, 249and mode are restored (if possible). 250If no file argument is given, 251then the root directory is extracted, 252which results in the entire content of the 253backup being extracted, 254unless the 255.Fl h 256flag has been specified. |
|
231.El 232.Pp | 257.El 258.Pp |
233The following characters may be used in addition to the letter 234that selects the function desired. | 259The following additional options may be specified: |
235.Bl -tag -width Ds | 260.Bl -tag -width Ds |
236.It Cm b 237The next argument to 238.Nm restore 239is used as the block size of the media (in kilobytes). | 261.It Fl b Ar blocksize 262The number of kilobytes per dump record. |
240If the 241.Fl b 242option is not specified, 243.Nm restore 244tries to determine the media block size dynamically. | 263If the 264.Fl b 265option is not specified, 266.Nm restore 267tries to determine the media block size dynamically. |
245.It Cm f 246The next argument to | 268.It Fl c 269Normally, |
247.Nm restore | 270.Nm restore |
248is used as the name of the archive instead 249of 250.Pa /dev/rst0 . | 271will try to determine dynamically whether the dump was made from an 272old (pre-4.4) or new format file sytem. The 273.Fl c 274flag disables this check, and only allows reading a dump in the old 275format. 276.It Fl f Ar file 277Read the backup from 278.Ar file ; 279.Ar file 280may be a special device file 281like 282.Pa /dev/rmt12 283(a tape drive), 284.Pa /dev/rsd1c 285(a disk drive), 286an ordinary file, 287or 288.Ql Fl 289(the standard input). |
251If the name of the file is of the form 252.Dq host:file , | 290If the name of the file is of the form 291.Dq host:file , |
292or 293.Dq user@host:file , |
|
253.Nm restore 254reads from the named file on the remote host using 255.Xr rmt 8 . | 294.Nm restore 295reads from the named file on the remote host using 296.Xr rmt 8 . |
256If the name of the file is 257.Ql Fl , 258.Nm restore 259reads from standard input. 260Thus, 261.Xr dump 8 262and 263.Nm restore 264can be used in a pipeline to dump and restore a file system 265with the command 266.Bd -literal -offset indent 267dump 0f - /usr | (cd /mnt; restore xf -) 268.Ed | |
269.Pp | 297.Pp |
270.It Cm h 271.Nm Restore 272extracts the actual directory, | 298.It Fl h 299Extract the actual directory, |
273rather than the files that it references. 274This prevents hierarchical restoration of complete subtrees 275from the dump. | 300rather than the files that it references. 301This prevents hierarchical restoration of complete subtrees 302from the dump. |
276.It Cm m 277.Nm Restore 278will extract by inode numbers rather than by file name. | 303.It Fl m 304Extract by inode numbers rather than by file name. |
279This is useful if only a few files are being extracted, 280and one wants to avoid regenerating the complete pathname 281to the file. | 305This is useful if only a few files are being extracted, 306and one wants to avoid regenerating the complete pathname 307to the file. |
282.It Cm s 283The next argument to 284.Nm restore 285is a number which 286selects the file on a multi-file dump tape. File numbering 287starts at 1. 288.It Cm v | 308.It Fl s Ar fileno 309Read from the specified 310.Ar fileno 311on a multi-file tape. 312File numbering starts at 1. 313.It Fl v |
289Normally 290.Nm restore 291does its work silently. 292The | 314Normally 315.Nm restore 316does its work silently. 317The |
293.Cm v | 318.Fl v |
294(verbose) | 319(verbose) |
295key causes it to type the name of each file it treats | 320flag causes it to type the name of each file it treats |
296preceded by its file type. | 321preceded by its file type. |
297.It Cm y 298.Nm Restore 299will not ask whether it should abort the restore if it gets an error. 300It will always try to skip over the bad block(s) and continue as 301best it can. | 322.It Fl y 323Do not ask the user whether to abort the restore in the event of an error. 324Always try to skip over the bad block(s) and continue. |
302.El 303.Sh DIAGNOSTICS | 325.El 326.Sh DIAGNOSTICS |
304Complaints about bad key characters. 305.Pp | |
306Complaints if it gets a read error. 307If | 327Complaints if it gets a read error. 328If |
308.Cm y | 329.Fl y |
309has been specified, or the user responds 310.Ql y , 311.Nm restore 312will attempt to continue the restore. 313.Pp 314If a backup was made using more than one tape volume, 315.Nm restore 316will notify the user when it is time to mount the next volume. 317If the | 330has been specified, or the user responds 331.Ql y , 332.Nm restore 333will attempt to continue the restore. 334.Pp 335If a backup was made using more than one tape volume, 336.Nm restore 337will notify the user when it is time to mount the next volume. 338If the |
318.Cm x | 339.Fl x |
319or | 340or |
320.Cm i 321key has been specified, | 341.Fl i 342flag has been specified, |
322.Nm restore 323will also ask which volume the user wishes to mount. 324The fastest way to extract a few files is to 325start with the last volume, and work towards the first volume. 326.Pp 327There are numerous consistency checks that can be listed by 328.Nm restore . 329Most checks are self-explanatory or can ``never happen''. --- 56 unchanged lines hidden (view full) --- 386.Xr dump 8 , 387.Xr ft 8 , 388.Xr mount 8 , 389.Xr newfs 8 , 390.Xr rmt 8 391.Sh BUGS 392.Nm Restore 393can get confused when doing incremental restores from | 343.Nm restore 344will also ask which volume the user wishes to mount. 345The fastest way to extract a few files is to 346start with the last volume, and work towards the first volume. 347.Pp 348There are numerous consistency checks that can be listed by 349.Nm restore . 350Most checks are self-explanatory or can ``never happen''. --- 56 unchanged lines hidden (view full) --- 407.Xr dump 8 , 408.Xr ft 8 , 409.Xr mount 8 , 410.Xr newfs 8 , 411.Xr rmt 8 412.Sh BUGS 413.Nm Restore 414can get confused when doing incremental restores from |
394dump that were made on active file systems. | 415dumps that were made on active file systems. |
395.Pp 396A level zero dump must be done after a full restore. 397Because restore runs in user code, 398it has no control over inode allocation; 399thus a full dump must be done to get a new set of directories 400reflecting the new inode numbering, 401even though the contents of the files is unchanged. 402.Pp 403To do a network restore, you have to run restore as root. This is due 404to the previous security history of dump and restore. (restore is 405written to be setuid root, but we are not certain all bugs are gone 406from the restore code - run setuid at your own risk.) 407.Sh HISTORY 408The 409.Nm restore 410command appeared in 411.Bx 4.2 . | 416.Pp 417A level zero dump must be done after a full restore. 418Because restore runs in user code, 419it has no control over inode allocation; 420thus a full dump must be done to get a new set of directories 421reflecting the new inode numbering, 422even though the contents of the files is unchanged. 423.Pp 424To do a network restore, you have to run restore as root. This is due 425to the previous security history of dump and restore. (restore is 426written to be setuid root, but we are not certain all bugs are gone 427from the restore code - run setuid at your own risk.) 428.Sh HISTORY 429The 430.Nm restore 431command appeared in 432.Bx 4.2 . |