Pages

Using Dump Backup and Restore Linux OS

dump and restore
The dump tool works by making a copy of an entire file system. The restore tool can then
take this copy and pull any and all files from it.
To support incremental backups, dump uses the concept of dump levels. A dump level of 0 means a full backup. Any dump level above 0 is an incremental relative to the last time a dump with a lower dump level occurred. For example, a dump level of 1 covers all the changes to the file system since the last level 0 dump, a dump level of 2 covers all of the changes to the file system since the last level 1 dump, and so on—all the way through dump level 9. Consider a case in which you have three dumps: the first is a level 0, the second is a level 1, and the third is also a level 1. The first dump is, of course, a full backup. The second dump (level 1) contains all the changes made since the first dump. The third dump (also a level 1) also has all the changes.

The dump utility stores all the information about its dumps in the /etc/dumpdates file.
This file lists each backed-up file system, when it was backed up, and at what dump level.
Given this information, you can determine which tape to use for a restore. For example, if you
perform level 0 dumps on Monday, level 1 incrementals on Tuesday and Wednesday, and then
level 2 incrementals on Thursday and Friday, a file that was last modified on Tuesday but got
accidentally erased on Friday can be restored from Tuesday night’s incremental backup.
A file that was last modified during the preceding week will be on Monday’s level 0 tape.


Using dump
The dump tool is a command-line utility. It takes many parameters, but the most relevant are
as shown in Table 21-2.
For example, here is the command to perform a level 0 dump to /dev/st0 of the /dev/hda1
file system:

[root@scribe /root]# dump -0 -f /dev/st0 /dev/hda1


dump Parameter Description
– n Specifies the dump level, where n is a number between 0 and 9. For
example, –0 would perform a full backup.

–b blocksize Sets the dump block size to blocksize, which is measured in kilobytes. If you
are backing up many large files, using a larger block size will increase
performance. You may need to carefully adjust this to match the capabilities
of your tape system.

–B count Specifies a number ( count) of records per tape to be dumped. If there is
more data to dump than there is tape space, dump will prompt you to insert
a new tape.

–f filename Specifies a location ( filename) for the resulting dump file. You can make the
dump file a normal file that resides on another file system, or you can write
the dump file to the tape device. The SCSI tape device is /dev/st0.

–u Updates the /etc/dumpdates file after a successful dump.

–d density Specifies the density of the tape in bits per inch.

–s size Specifies the size of the tape in feet.

–a Bypasses all tape-length calculations and writes until an end-of-media signal
is returned. This works best for most modern tape drives and is particularly
useful for appending data to existing tapes. This is the default mode.

–z or –j Compresses each data block. The –z parameter uses zlib compression, while

–j uses bzlib. Either option can be immediately followed with a number, if
you want to specify the compression level, or white space, if you want to
accept the default compression level of 2. Your tape drive must be able to
support variable-length blocks to be able to use this feature. If your tape
system has hardware compression built in, don’t use both the hardware
compression and this option together, or your files will likely increase in size.

Using dump to Back Up an Entire System
The dump utility works by making an
archive of one file system. If your entire system comprises multiple file systems, you need to
run dump for every file system. Since dump creates its output as a single, large file, you can
store multiple dumps to a single tape by using a nonrewinding tape device.
Assuming we’re backing up to a SCSI tape device, /dev/nst0, we must first decide which
file systems we’re backing up. This information is in the /etc/fstab file. Obviously, we don’t
want to back up files such as /dev/cdrom, so we skip those. Depending on our data, we may or
may not want to back up certain partitions (such as swap and /tmp).


Let’s assume this leaves us with /dev/hda1, /dev/hda3, /dev/hda5, and /dev/hda6. To
back up these to /dev/nst0, compressing them along the way, we would issue the following
series of commands:
[root@scribe /root]# mt -f /dev/nst0 rewind
[root@scribe /root]# dump -0uz -f /dev/nst0 /dev/hda1
[root@scribe /root]# dump -0uz -f /dev/nst0 /dev/hda3
[root@scribe /root]# dump -0uz -f /dev/nst0 /dev/hda5
[root@scribe /root]# dump -0uz -f /dev/nst0 /dev/hda6
[root@scribe /root]# mt -f /dev/nst0 rewind
[root@scribe /root]# mt -f /dev/nst0 eject

Forex Trading