/[ddp]/manuals/trunk/system-administrator/backup.sgml
ViewVC logotype

Contents of /manuals/trunk/system-administrator/backup.sgml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 729 - (hide annotations) (download) (as text)
Fri Nov 20 20:02:10 1998 UTC (14 years, 6 months ago) by talehton
File MIME type: text/x-sgml
File size: 14863 byte(s)
Just wrote more text, High Density Floppies.
1 olly 670 <!-- Debian System Administrator's Manual - Backup and Restore -->
2    
3     <chapt id="sysadmin-backup">
4    
5     <heading>Backup and Restore</heading>
6    
7     <p>
8 talehton 688 author = Tapio Lehtonen
9 olly 670 </p>
10    
11     <p>
12 talehton 697 topics = why backup, what to backup, how to backup, backup
13     devices and media </p
14 olly 670
15     <sect>
16 talehton 688 <heading>Why backup?</heading>
17 talehton 708 <p>Backups are needed in case a file or a group of files is lost. The
18 talehton 697 reasons for losing files include
19     <list>
20     <item>Hardware failure like disk breaking,
21     <item>computer being stolen and
22     <item>accidentally deleting wrong file.
23     </list>
24     </p>
25    
26 talehton 708 <p>Backups help in all the above situations. In addition, it may be
27     good to have access to older versions of files, for example a
28     configuration file worked a week ago, but since then it has been
29 talehton 697 changed and nobody remembers how, its just not working anymore.
30     </p>
31    
32     <p>There are other solutions, and they are good to have if you can
33     afford them. These include
34     <list>
35     <item>redundant disks (RAID 1 or 5), so that one disk can break
36     without loss of data,
37     <item>locking up computers,
38     <item>using an undelete system (or not making mistakes when deleting
39     files :-)
40     </list>
41     These help, but if there is anything you do not want to lose on the
42     computer, <strong>make sure there are backups and they can be
43     restored.</strong>
44    
45 talehton 688 </sect>
46    
47     <sect>
48 talehton 697 <heading>What to backup?</heading>
49    
50     <p>If there is room on the backup media, and time limits permit
51     running backups long enough, it probably is wisest to back up
52     everything. You may skip <prgn>/tmp</prgn> or other places where it is
53 talehton 708 known there are only temporary files that nobody wants to
54 talehton 697 backup. </p>
55    
56 talehton 708 <p>If space or time limits place restrictions, consider not backing up
57 talehton 697 the following:
58     <list>
59     <item>Files that come directly from a CD or other removable media. It
60 talehton 729 may even be faster to copy them again from CD than restoring from
61 talehton 697 backup media.
62     <item>Files that can be regenerated easily. For example, object files
63     that can be made with <prgn>make</prgn>. Just make sure all the source
64     files and compilers are backed up.
65     <item>If the Internet connection is fast, it may be easy enough to
66     download files again. Just keep a list of the files and where to
67     download them from.
68     </list></p>
69    
70     <p> </p>
71    
72    
73 talehton 688 </sect>
74    
75     <sect>
76 talehton 708 <heading>Backup devices and media</heading>
77    
78 talehton 725 <p>Meta: Floppy (tar gz /etc), zip-drive and LS-120
79 talehton 708 CD-R and CD-RW, floppy tape, SCSI tape, hardware compression</p>
80    
81     <p>You need some media to store the backups. It is preferable to use
82     removable media, to store the backups away from the computer and to
83     get "unlimited" storage for backups. </p>
84    
85     <p>If the backups are on-line, they can be wiped out by mistake. If
86     the backups are on the same disk as the original data, they do not
87     help at all if the disk fails and is not readable anymore. If the
88     backup media is cheap, it is possible to take a backup every day and
89     store them indefinitely. </p>
90    
91     <sect1>
92     <heading>Floppy</heading
93    
94     <p>Floppy disks are cheap, and on PC computers there usually is a
95     floppy disk drive. On the other hand, it is not very fast to write to
96 talehton 725 a floppy, and the capacity of 1.4MBytes is not very much. If the
97 talehton 708 backup does not fit on one media, taking backups becomes an arduous
98     task, what with having to stand by and change the media every now and
99     then. </p>
100    
101     <p>However, if the data to be backed up fits in one floppy, they are a
102     reasonable alternative. Compressing the data usually means it uses
103     about 50% of the original size. Thus, you can expect to get almost
104     3MBytes to one 1.4M floppy disk with compression. </p>
105    
106 talehton 725 <p>There are different ways to use the floppy with tar:
107     <list>
108     <item>write directly to the device <prgn>/dev/fd0</prgn>,
109     <item>use the floppy with DOS file system, and copy the tar file there
110     with <prgn>mcopy</prgn> (see info file mtools with command <prgn>info
111     mtools</prgn>) and
112     <item>Create a Linux filesystem on the floppy, mount, write like to
113     any Linux disk and unmount the floppy.
114     </list>
115    
116 talehton 708 <p>Here is an example to backup the <prgn>/etc</prgn> directory tree
117     to floppy. First check how large the directory tree is:
118     <example>
119     dilbert# du --summarize --kilobytes /etc
120     2515 /etc
121     dilbert#
122     </example>
123     This shows 2.5MBytes, so it should fit on one floppy if the data is
124     compressed. </p>
125    
126 talehton 725 <p>The first example below uses the floppy as removable media with Linux filesystem. </p>
127 talehton 708
128 talehton 729 <p>Now an EXT2 filesystem is created on the floppy. This is the
129 talehton 708 filesystem Linux uses on hard disk partitions, but it is possible to
130     format all disk media to EXT2. Note, that all data on the media is
131     lost when it is formatted. The first floppy drive is device
132     <prgn>/dev/fd0</prgn>.
133     <example>
134     dilbert# mkfs -t ext2 /dev/fd0 1440
135     mke2fs 1.12, 9-Jul-98 for EXT2 FS 0.5b, 95/08/09
136     Linux ext2 filesystem format
137     Filesystem label=
138     360 inodes, 1440 blocks
139     72 blocks (5.00%) reserved for the super user
140     First data block=1
141     Block size=1024 (log=0)
142     Fragment size=1024 (log=0)
143     1 block group
144     8192 blocks per group, 8192 fragments per group
145     360 inodes per group
146    
147     Writing inode tables: done 1
148     Writing superblocks and filesystem accounting information: done
149     dilbert#
150     </example>
151     </p>
152    
153 talehton 729 <p>Now the floppy disk is mounted and backup is run and tested. Note,
154     that the mount point <prng>/A</prgn> must already exist (see <manref
155     name="mount" sect="8">
156 talehton 708 <example>
157     dilbert# mount -t ext2 /dev/fd0 /A
158     dilbert# df -h
159     Filesystem Size Used Avail Capacity Mounted on
160     /dev/sda5 99M 14M 80M 15% /
161     /dev/sda6 964M 540M 374M 59% /usr
162     /dev/sda7 190M 32M 148M 18% /var
163     /dev/sda8 2.7G 1.2G 1.4G 46% /export
164     /dev/sdb2 3.8G 2.3G 1.4G 62% /export2
165     dilbert:/export/home 2.7G 1.2G 1.4G 46% /amd/dilbert/export/home
166     /dev/fd0 1.4M 13K 1.3M 1% /A
167     dilbert# cd /
168     dilbert# tar czf /A/etc.tgz ./etc
169     dilbert# df -h
170     Filesystem Size Used Avail Capacity Mounted on
171     /dev/sda5 99M 14M 80M 15% /
172     /dev/sda6 964M 540M 374M 59% /usr
173     /dev/sda7 190M 32M 148M 18% /var
174     /dev/sda8 2.7G 1.2G 1.4G 46% /export
175     /dev/sdb2 3.8G 2.3G 1.4G 62% /export2
176     dilbert:/export/home 2.7G 1.2G 1.4G 46% /amd/dilbert/export/home
177     /dev/fd0 1.4M 483K 835K 37% /A
178     dilbert# ls -l /A
179     total 482
180     -rw-r--r-- 1 root root 477376 Nov 12 22:15 etc.tgz
181     drwxr-xr-x 2 root root 12288 Nov 12 21:54 lost+found
182     dilbert#
183    
184     </example>
185     </p>
186    
187     <p>Here we change working directory to <prgn>/tmp</prgn>, and restore
188     the backup to <prgn>/tmp/etc</prgn>.
189     <example>
190     dilbert# cd /tmp
191     dilbert# ls -l
192     total 252
193     -r--r--r-- 1 tale tale 98774 Nov 9 23:01 Packages
194     drwxr-xr-x 6 tale tale 1024 Nov 8 21:13 nscomm40-tale
195     -rw------- 1 tale tale 153107 Nov 10 23:51 nsmail3648B5740C333F2
196     drwx------ 2 tale tale 1024 Nov 8 20:51 orbit-tale
197     drwx------ 2 vieras vieras 1024 Nov 7 17:52 orbit-vieras
198     dilbert# tar xzf /A/etc.tgz
199     dilbert# ls -l
200     total 257
201     -r--r--r-- 1 tale tale 98774 Nov 9 23:01 Packages
202     drwxr-xr-x 59 root root 5120 Nov 12 22:13 etc
203     drwxr-xr-x 6 tale tale 1024 Nov 8 21:13 nscomm40-tale
204     -rw------- 1 tale tale 153107 Nov 10 23:51 nsmail3648B5740C333F2
205     drwx------ 2 tale tale 1024 Nov 8 20:51 orbit-tale
206     drwx------ 2 vieras vieras 1024 Nov 7 17:52 orbit-vieras
207     dilbert# du --summarize --kilobytes /tmp/etc
208     2509 /tmp/etc
209     dilbert# umount /A
210     dilbert#
211     </example>
212     </p>
213    
214     <p>It looks like the backup is on the floppy and we could even read it
215     back. The last command in the previous example unmounts the
216     floppy. This is <strong>very important!</strong>. If you mount a
217     removable media, it <strong>must be unmounted</strong> before it is
218     removed from the drive. </p>
219    
220     <p>As another example, we write the backup directly to the
221     <prgn>/dev/fd0</prgn> device:
222     <example>
223     dilbert# cd /
224     dilbert# tar czf /dev/fd0 ./etc
225     dilbert# tar tzf /dev/fd0 | head
226     ./etc/
227     ./etc/modules
228     ./etc/xemacs/
229     ./etc/xemacs/site-start-19.d/
230     ./etc/xemacs/site-start-19.d/50dpkg-dev.el
231     ./etc/init.d/
232     ./etc/init.d/network
233     ./etc/init.d/modutils
234     ./etc/init.d/kerneld
235     ./etc/init.d/kdm
236     Broken pipe
237     dilbert#
238     </example>
239     </p>
240    
241     <p>We could read the listing (option <prgn>t</prgn> for
242     <prgn>tar</prgn>) from the floppy, so we can assume the backup is
243     OK. Note, that if you plan to read this floppy back later,
244     <strong>make sure you remember how the floppy was written</strong>. If
245     you forget it was written with <prgn>tar</prgn> and with compression,
246     you spend a lot of time figuring it out. This same applies to all
247     media that you store for any longer period of time, and especially if
248     you send the media to someone else. </p>
249    
250     <p>The above method is usable also with tape drives. Replace the
251     device name <prgn>/dev/fd0</prgn> with device name for the tape drive,
252     and you can use <prgn>tar</prgn> as Tape ARchiver. </p>
253    
254     </sect1>
255    
256     <sect1>
257     <heading>High Capacity Floppies</heading>
258    
259     <p>High capacity floppies are
260     <list>
261     <item><url id="http://www.iomega.com/product/zip" name="Iomega Zip-drive">,
262     <item><url id="http://www.superdisk.com/" name="LS-120">, <url id="http://www.winstation.com/main.html"
263 talehton 725 name="LS-120">,
264     <item><url id="http://www.sony.com/HiFD" name="Sony HiFD">,
265     <item><url id="http://www.syquest.com/" name="SyQuest EZFlyer"> and
266     <item><url id="SyQuest" name="SyQuest SparQ">
267 talehton 708 </list>
268     </p>
269    
270 talehton 725 <p>All of these are about floppy disk size, store 100MBytes to
271     200MBytes (SparQ about 1.0GBytes) and are faster and more expensive
272     than floppy drives. They are connected to EIDE port, Parallel port,
273     SCSI or USB. LS-120 and Sony SuperFloppy can read and write ordinary
274     1.4MByte floppy disks.
275 talehton 708
276 talehton 729 <p>You can use these things like in the above examples where a floppy
277     disk was used, but you have to
278 talehton 725 install the devices and the device driver software before they can be
279 talehton 708 used. Then the device name depends on what kind of connection the
280     thing uses. </p>
281    
282 talehton 725 <p>There is more info on using the above high capacity floppies on Linux in the
283 talehton 708 HOWTO documents. (reference to HOWTOs???)</p>
284    
285    
286    
287     <p><strong>Somebody with experience from the above devices: please confirm my
288     guessing above or send info on how they can be used.</strong></p>
289    
290     </sect1>
291    
292     <sect1>
293     <heading>CD-R and CD-RW</heading>
294    
295 talehton 725 <p>Meta: Capacity <= 640MBytes, speed 150 -- 600KBits/sek. Special software
296 talehton 729 needed to burn the CD. DVD-RAM</p>
297 talehton 725
298 talehton 729 <p>CD writers can be used as backup devices. Writable CD media is
299     either writable exactly once (CD-R), or erasable and rewritable
300     (CD-RW). CD-R disks can be read on ordinary CD drives, but CD-RW disks
301     need Multi-Read capability from the reader. This is good to know if
302     you plan to read the CD back on some other computer.</p>
303 talehton 725
304 talehton 729 <p>Assuming the CD writer is installed and configured correctly, and
305     you have the necessary software to write to the CD, taking backups is
306     best done with the first method in the floppy disk example above,
307     i.e. creating a Linux file system on the CD. Since the CD is a disk,
308     i.e. a random access device, using it this way is easy. Just mount it
309     and copy files or whole directory trees there.</p>
310    
311     <p>Restoring is also straightforward, since the CD can be examined
312     with ordinary file system commands like <prgn>ls</prng>, and it is
313     easy to copy a single file back. You can also compare the files in the
314     backup to files in hard disk with <prgn>diff</prgn> for example. </p>
315    
316     <p>Problems with CD-R are their write once -nature. They need to be
317     written all in one go, and then closed. After closing, it is not
318     possible to modify the CD, so if there is something wrong there it has
319     to be thrown away. </p>
320    
321     <p>CD-RW can be erased, but my understanding is the whole disk must be
322     erased. In addition, looks like formatting a CD-RW takes about one
323     hour. </p>
324    
325    
326 talehton 708 </sect1>
327    
328     <sect1>
329     <heading>Tapes</heading>
330    
331 talehton 725 <p>Meta: Popular backup media. Wide range of speeds, capacities and cost. </p>
332 talehton 729
333     <p>Tape drives are popular backup devices. The media is relatively
334     cheap per gigabyte, and tape capacities go up to several tens of
335     gigabytes. On the other hand, the tape drives may be expensive and
336     write speeds slower than disks.</p>
337    
338     <p></p>
339    
340     <p></p>
341    
342     <p></p>
343    
344     <p></p>
345    
346     <p></p>
347    
348 talehton 708 </sect1>
349    
350     </sect>
351    
352    
353     <sect>
354 talehton 688 <heading>Backup methods and software</heading>
355 talehton 708 <p>Backup methods include simply copying files to another media, using
356     dd, tar or similar program to create an archive and using special backup
357     programs.
358 talehton 688
359     <sect1><heading>Network backups</heading>
360 talehton 725 <p>Meta: Enterprise environment, Legato Networker, HP Omniback, etc. Linux clients.
361 talehton 708
362     <p>In an enterprise environment there may be a backup server running
363     some network backup software. If there are Linux clients available for
364     that software, its possible to install the Linux client, configure the
365     client machine on the backup server and start taking backups over the
366     LAN.</p>
367    
368     <p>This is a low cost solution. If the backup server is already there,
369     Linux clients usually are free to download. Legato Networker and HP
370     Omniback have Linux clients available, but no technical support is
371     available from the vendor.
372    
373    
374     <taglist compact>
375     <tag>Legato
376 talehton 725 <item><url id="http://www.legato.com/exchange/documents/NetWorker/CG-SW.html" name="Legato Networker">
377 talehton 708
378     <tag>HP Omniback
379 talehton 725 <item><url id="http://www.hp.com/openview/products/omniback.html" name="HP Omniback">
380 talehton 708 </taglist>
381     </p>
382 talehton 688 </sect1>
383    
384     <sect1><heading>Tar et al</heading>
385 talehton 725 <p>Meta: Tar, dump, dd</p>
386 talehton 688
387 talehton 708 <p>Now for some examples. </p>
388    
389     <p>In Debian GNU/Linux the <prgn>tar</prgn>
390     program is GNU tar, which has several extra features. Among them is
391     support for compressing the tar file while it is created. On the
392     average, compression squeezes the file to about 50% of the
393     uncompressed size. Your mileage may vary: files that are already
394     compressed, like *.zip and *.gif files do not compress at all, and
395     some file compress especially well, C source code files can go to 25%
396     of the uncompressed size.</p>
397    
398     <p>Taking a compressed tar file from /export/home partition goes like
399     this:
400     <example>
401     cd /export
402     tar czf /tmp/home.tgz ./home
403     </example>
404     </p>
405    
406     <p></p>
407    
408 talehton 688 </sect1>
409    
410    
411     <sect1><heading>Backup software</heading>
412 talehton 725 <p>Meta: amanda, other backup software in Debian
413 talehton 688
414    
415     </sect1>
416    
417    
418    
419     </sect>
420    
421    
422    
423    
424     <sect>
425 olly 670 <heading>Types of backup</heading>
426 talehton 725 <p>Meta: Full, incremental, differential, network, dump, level 0--9, </p>
427 talehton 729
428     <p>Meta: Check the backup can be restored, with original file owners and permissions.</p>
429    
430 olly 670 </sect>
431    
432     </chapt>
433    
434     <!-- Keep this comment at the end of the file
435     Local variables:
436     mode: sgml
437     sgml-omittag:t
438     sgml-shorttag:t
439     sgml-minimize-attributes:nil
440     sgml-always-quote-attributes:t
441     sgml-indent-step:2
442     sgml-indent-data:t
443     sgml-parent-document:"system-administrator.sgml chapt sect"
444     sgml-exposed-tags:nil
445     sgml-local-catalogs:"/usr/lib/sgml/catalog"
446     sgml-local-ecat-files:nil
447     End:
448     -->

  ViewVC Help
Powered by ViewVC 1.1.5