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
|
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<!--Converted with LaTeX2HTML 96.1-h (September 30, 1996) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds -->
<HTML>
<HEAD>
<TITLE>Making backups with tar</TITLE>
<META NAME="description" CONTENT="Making backups with tar">
<META NAME="keywords" CONTENT="sag">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<LINK REL=STYLESHEET HREF="sag.css">
</HEAD>
<BODY LANG="EN" >
<A NAME="tex2html1591" HREF="node102.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="./next_motif.gif"></A> <A NAME="tex2html1589" HREF="node100.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="./up_motif.gif"></A> <A NAME="tex2html1583" HREF="node100.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="./previous_motif.gif"></A> <A NAME="tex2html1593" HREF="node1.html"><IMG WIDTH=65 HEIGHT=24 ALIGN=BOTTOM ALT="contents" SRC="./contents_motif.gif"></A> <A NAME="tex2html1594" HREF="node114.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="./index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME="tex2html1592" HREF="node102.html">Restoring files with tar</A>
<B>Up:</B> <A NAME="tex2html1590" HREF="node100.html">Simple backups</A>
<B> Previous:</B> <A NAME="tex2html1584" HREF="node100.html">Simple backups</A>
<BR> <P>
<A NAME="3054"> </A><H2><A NAME="SECTION001141000000000000000">Making backups with <tt>tar</tt></A></H2>
<P>
A full backup can easily be made with <tt>tar</tt><A NAME="3056"> </A>:
<BLOCKQUOTE> <TT>
# tar -create -file /dev/ftape /usr/src <BR>
tar: Removing leading / from absolute path names in the archive <BR>
#
</TT></BLOCKQUOTE>
The example above uses the GNU version of <tt>tar</tt><A NAME="3058"> </A> and its long option
names. The traditional version of <tt>tar</tt><A NAME="3060"> </A> 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 <tt>tar</tt><A NAME="3062"> </A>.)
<P>
If your backup doesn't fit on one tape, you need to use the
<tt>-multi-volume</tt> (<tt>-M</tt>) option:
<BLOCKQUOTE> <TT>
# tar -cMf /dev/fd0H1440 /usr/src <BR>
tar: Removing leading / from absolute path names in the archive <BR>
Prepare volume #2 for /dev/fd0H1440 and hit return: <BR>
#
</TT></BLOCKQUOTE>
Note that you should format the floppies before you begin the backup,
or else use another window or virtual terminal and do it when <tt>tar</tt><A NAME="3064"> </A>
asks for a new floppy.
<P>
After you've made a backup, you should check that it is OK, using
the <tt>-compare</tt> (<tt>-d</tt>) option:
<BLOCKQUOTE> <TT>
# tar -compare -verbose -f /dev/ftape <BR>
usr/src/ <BR>
usr/src/linux <BR>
usr/src/linux-1.2.10-includes/ <BR>
.... <BR>
#
</TT></BLOCKQUOTE>
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>
An incremental backup can be done with <tt>tar</tt><A NAME="3066"> </A> using the
<tt>-newer</tt> (<tt>-N</tt>) option:
<BLOCKQUOTE> <TT>
# tar -create -newer '8 Sep 1995' -file /dev/ftape /usr/src -verbose <BR>
tar: Removing leading / from absolute path names in the archive <BR>
usr/src/ <BR>
usr/src/linux-1.2.10-includes/ <BR>
usr/src/linux-1.2.10-includes/include/ <BR>
usr/src/linux-1.2.10-includes/include/linux/ <BR>
usr/src/linux-1.2.10-includes/include/linux/modules/ <BR>
usr/src/linux-1.2.10-includes/include/asm-generic/ <BR>
usr/src/linux-1.2.10-includes/include/asm-i386/ <BR>
usr/src/linux-1.2.10-includes/include/asm-mips/ <BR>
usr/src/linux-1.2.10-includes/include/asm-alpha/ <BR>
usr/src/linux-1.2.10-includes/include/asm-m68k/ <BR>
usr/src/linux-1.2.10-includes/include/asm-sparc/ <BR>
usr/src/patch-1.2.11.gz <BR>
#
</TT></BLOCKQUOTE>
Unfortunately, <tt>tar</tt><A NAME="3068"> </A> 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 <tt>find</tt><A NAME="3070"> </A> 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>
<HR><A NAME="tex2html1591" HREF="node102.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="./next_motif.gif"></A> <A NAME="tex2html1589" HREF="node100.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="./up_motif.gif"></A> <A NAME="tex2html1583" HREF="node100.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="./previous_motif.gif"></A> <A NAME="tex2html1593" HREF="node1.html"><IMG WIDTH=65 HEIGHT=24 ALIGN=BOTTOM ALT="contents" SRC="./contents_motif.gif"></A> <A NAME="tex2html1594" HREF="node114.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="./index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME="tex2html1592" HREF="node102.html">Restoring files with tar</A>
<B>Up:</B> <A NAME="tex2html1590" HREF="node100.html">Simple backups</A>
<B> Previous:</B> <A NAME="tex2html1584" HREF="node100.html">Simple backups</A>
<P><ADDRESS>
<I>Lars Wirzenius <BR>
Sat Nov 15 02:32:11 EET 1997</I>
</ADDRESS>
</BODY>
</HTML>
|