summaryrefslogtreecommitdiff
path: root/sag-0.6.1-www/sag-0.6.1.html/x2240.html
blob: da40352ab6bceabc282616a4cb7f5bf0109f384b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
<!DOCTYPE HTML PUBLIC "-//Norman Walsh//DTD DocBook HTML 1.0//EN">
<HTML
><HEAD
><TITLE
>Simple backups</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet"><LINK
REL="HOME"
TITLE="The Linux System Administrators' Guide"
HREF="book1.html"><LINK
REL="UP"
TITLE="Backups"
HREF="c2187.html"><LINK
REL="PREVIOUS"
TITLE="Selecting the backup tool"
HREF="x2216.html"><LINK
REL="NEXT"
TITLE="Multilevel backups"
HREF="x2315.html"></HEAD
><BODY
BGCOLOR="#FFFFFF"
TEXT="#000000"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>The Linux System Administrators' Guide</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="x2216.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 10. Backups</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x2315.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN2240"
>Simple backups</A
></H1
><P
> A simple backup scheme is to back up everything once,
	then back up everything that has been modified since the
	previous backup.  The first backup is called a <I
CLASS="GLOSSTERM"
>full
	backup</I
>, the subsequent ones are <I
CLASS="GLOSSTERM"
>incremental
	backups</I
>.  A full backup is often more laborius
	than incremental ones, since there is more data to write to the
	tape and a full backup might not fit onto one tape (or floppy).
	Restoring from incremental backups can be many times more work
	than from a full one.  Restoration can be optimized so that
	you always back up everything since the previous full backup;
	this way, backups are a bit more work, but there should never
	be a need to restore more than a full backup and an incremental
	backup.  </P
><P
> If you want to make backups every day and have six
	tapes, you could use tape~1 for the first full backup (say, on
	a Friday), and tapes 2 to 5 for the incremental backups (Monday
	through Thursday).  Then you make a new full backup on tape 6
	(second Friday), and start doing incremental ones with tapes 2
	to 5 again.  You don't want to overwrite tape 1 until you've got
	a new full backup, lest something happens while you're making
	the full backup.  After you've made a full backup to tape 6,
	you want to keep tape 1 somewhere else, so that when your other
	backup tapes are destroyed in the fire, you still have at least
	something left.  When you need to make the next full backup,
	you fetch tape 1 and leave tape 6 in its place.  </P
><P
> If you have more than six tapes, you can use the extra
	ones for full backups.	Each time you make a full backup, you
	use the oldest tape.  This way you can have full backups from
	several previous weeks, which is good if you want to find an old,
	now deleted file, or an old version of a file.	</P
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN2247"
>Making backups with <B
CLASS="COMMAND"
>tar</B
></A
></H2
><P
>	A full backup can easily be made with <B
CLASS="COMMAND"
>tar</B
>:

<PRE
CLASS="SCREEN"
><TT
CLASS="PROMPT"
>#</TT
> <TT
CLASS="USERINPUT"
><B
>tar --create --file /dev/ftape /usr/src</B
></TT
>
<TT
CLASS="COMPUTEROUTPUT"
>tar: Removing leading / from absolute path names in the archive</TT
>
<TT
CLASS="PROMPT"
>#</TT
></PRE
>

	The example above uses the GNU version of <B
CLASS="COMMAND"
>tar</B
>
	and its long option names.  The traditional version of
	<B
CLASS="COMMAND"
>tar</B
> only understands single character
	options.  The GNU version can also handle backups that don't
	fit on one tape or floppy, and also very long paths; not all
	traditional versions can do these things.  (Linux only uses
	GNU <B
CLASS="COMMAND"
>tar</B
>.)  </P
><P
> If your backup doesn't fit on one tape, you need to use
	the <SPAN
CLASS="OPTION"
>--multi-volume</SPAN
> (<SPAN
CLASS="OPTION"
>-M</SPAN
>) option:

<PRE
CLASS="SCREEN"
><TT
CLASS="PROMPT"
>#</TT
> <TT
CLASS="USERINPUT"
><B
>tar -cMf /dev/fd0H1440 /usr/src</B
></TT
>
<TT
CLASS="COMPUTEROUTPUT"
>tar: Removing leading / from absolute path names in the archive
Prepare volume \#2 for /dev/fd0H1440 and hit return:</TT
>
<TT
CLASS="PROMPT"
>#</TT
></PRE
>

	Note that you should format the floppies before you begin the
	backup, or else use another window or virtual terminal and do
	it when <B
CLASS="COMMAND"
>tar</B
> asks for a new floppy.  </P
><P
> After you've made a backup, you should check that it is OK,
	using the <SPAN
CLASS="OPTION"
>--compare</SPAN
> (<SPAN
CLASS="OPTION"
>-d</SPAN
>) option:

<PRE
CLASS="SCREEN"
><TT
CLASS="PROMPT"
>#</TT
> <TT
CLASS="USERINPUT"
><B
>tar --compare --verbose -f /dev/ftape</B
></TT
>
<TT
CLASS="COMPUTEROUTPUT"
>usr/src/
usr/src/linux
usr/src/linux-1.2.10-includes/
....</TT
>
<TT
CLASS="PROMPT"
>#</TT
></PRE
>

	Failing to check a backup means that you will not notice that your
	backups aren't working until after you've lost the original data.
	</P
><P
> An incremental backup can be done with
	<B
CLASS="COMMAND"
>tar</B
> using the <SPAN
CLASS="OPTION"
>--newer</SPAN
>
	(<SPAN
CLASS="OPTION"
>-N</SPAN
>) option:

<PRE
CLASS="SCREEN"
><TT
CLASS="PROMPT"
>#</TT
> <TT
CLASS="USERINPUT"
><B
>tar --create --newer '8 Sep 1995' --file /dev/ftape /usr/src --verbose</B
></TT
>
<TT
CLASS="COMPUTEROUTPUT"
>tar: Removing leading / from absolute path names in the archive
usr/src/
usr/src/linux-1.2.10-includes/
usr/src/linux-1.2.10-includes/include/
usr/src/linux-1.2.10-includes/include/linux/
usr/src/linux-1.2.10-includes/include/linux/modules/
usr/src/linux-1.2.10-includes/include/asm-generic/
usr/src/linux-1.2.10-includes/include/asm-i386/
usr/src/linux-1.2.10-includes/include/asm-mips/
usr/src/linux-1.2.10-includes/include/asm-alpha/
usr/src/linux-1.2.10-includes/include/asm-m68k/
usr/src/linux-1.2.10-includes/include/asm-sparc/
usr/src/patch-1.2.11.gz</TT
>
<TT
CLASS="PROMPT"
>#</TT
></PRE
>

	Unfortunately, <B
CLASS="COMMAND"
>tar</B
> can't notice when a file's
	inode information has changed, for example, that it's permission
	bits have been changed, or when its name has been changed.
	This can be worked around using <B
CLASS="COMMAND"
>find</B
> and
	comparing current filesystem state with lists of files that have
	been previously backed up.  Scripts and programs for doing this
	can be found on Linux ftp sites.  </P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN2288"
>Restoring files with <B
CLASS="COMMAND"
>tar</B
></A
></H2
><P
> The <SPAN
CLASS="OPTION"
>--extract</SPAN
> (<SPAN
CLASS="OPTION"
>-x</SPAN
>)
	option for <B
CLASS="COMMAND"
>tar</B
> extracts files:

<PRE
CLASS="SCREEN"
><TT
CLASS="PROMPT"
>#</TT
> <TT
CLASS="USERINPUT"
><B
>tar --extract --same-permissions --verbose --file /dev/fd0H1440</B
></TT
>
<TT
CLASS="COMPUTEROUTPUT"
>usr/src/
usr/src/linux
usr/src/linux-1.2.10-includes/
usr/src/linux-1.2.10-includes/include/
usr/src/linux-1.2.10-includes/include/linux/
usr/src/linux-1.2.10-includes/include/linux/hdreg.h
usr/src/linux-1.2.10-includes/include/linux/kernel.h
...</TT
>
<TT
CLASS="PROMPT"
>#</TT
></PRE
>

	You also extract only specific files or directories (which
	includes all their files and subdirectories) by naming on the
	command line:

<PRE
CLASS="SCREEN"
><TT
CLASS="PROMPT"
>#</TT
> <TT
CLASS="USERINPUT"
><B
>tar xpvf /dev/fd0H1440 usr/src/linux-1.2.10-includes/include/linux/hdreg.h</B
></TT
>
<TT
CLASS="COMPUTEROUTPUT"
>usr/src/linux-1.2.10-includes/include/linux/hdreg.h</TT
>
<TT
CLASS="PROMPT"
>#</TT
></PRE
>

	Use the <SPAN
CLASS="OPTION"
>--list</SPAN
> (<SPAN
CLASS="OPTION"
>-t</SPAN
>) option,
	if you just want to see what files are on a backup volume:

<PRE
CLASS="SCREEN"
><TT
CLASS="PROMPT"
>#</TT
> <TT
CLASS="USERINPUT"
><B
>tar --list --file /dev/fd0H1440</B
></TT
>
<TT
CLASS="COMPUTEROUTPUT"
>usr/src/
usr/src/linux
usr/src/linux-1.2.10-includes/
usr/src/linux-1.2.10-includes/include/
usr/src/linux-1.2.10-includes/include/linux/
usr/src/linux-1.2.10-includes/include/linux/hdreg.h
usr/src/linux-1.2.10-includes/include/linux/kernel.h
...</TT
>
<TT
CLASS="PROMPT"
>#</TT
></PRE
>

	Note that <B
CLASS="COMMAND"
>tar</B
> always reads the backup volume
	sequentially, so for large volumes it is rather slow.  It is not
	possible, however, to use random access database techniques when
	using a tape drive or some other sequential medium.  </P
><P
> <B
CLASS="COMMAND"
>tar</B
> doesn't handle deleted files
	properly. If you need to restore a filesystem from a full and
	an incremental backup, and you have deleted a file between
	the two backups, it will exist again after you have done the
	restore. This can be a big problem, if the file has sensitive
	data that should no longer be available.  </P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="x2216.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="book1.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="x2315.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Selecting the backup tool</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="c2187.html"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Multilevel backups</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>