P. 1
Webmin User Guide

Webmin User Guide

4.75

|Views: 17,647|Likes:
Published by Abe Li
A linux server admin Tool by remote web interface. Easy to use, especially for that not very familiar with cmd mode in Linux console.
A linux server admin Tool by remote web interface. Easy to use, especially for that not very familiar with cmd mode in Linux console.

More info:

Published by: Abe Li on Jun 17, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

08/16/2013

pdf

text

original

his chapter explains how to backup and restore files with the dump
command, using Webmin’s Filesystem Backup module.

14.1 Introduction to Backups with Dump

There are many ways of backing up a UNIX system—you can just copy files to another direc-
tory, use the tar command to create an archive file or write to a tape device, or use the dump
family of commands. Although copying or using tar is easier, only dump can preserve all file
types (such as named pipes and symbolic links) and file information (such as ACLs and
attributes). It can do this because it has a more sophisticated knowledge of the underlying file-
system than other backup programs.
Another unique advantage of the dump program is its support for backup levels. If you are
regularly backing up the same directory, instead of writing all files to the backup device every
time, you can choose to save only those files that have changed since the last backup of a lower
level. For example, you could do a full backup (level 0) every week, and a much faster partial
backup (level 9) each day. The only down side is that if data needed to be restored, the weekly
backup and all the daily backups for the week so far would need to be read.
Using dump to make backups has some problems that other backup tools do not. The data
that it writes to a file or tape device is not compressed, although this is not a problem with most
tape drives as they compress data automatically. Another problem is that it cannot backup files
mounted via NFS from another server, as it reads directly from the disk, unlike the tar and cp
commands.

14.2 The Filesystem Backup Module

This module allows you to backup directories on your local filesystems, either on demand or on
a fixed schedule. The appropriate command for the filesystem type being backed up is used—for

T

122

Chapter14 • Filesystem Backups

example, xfsdump on xfs filesystems or dump on ext2 or ext3. The module also supports the
restoration of backups, either to their original location or to a different path.
When you enter the module from the System category, the main page will display all back-
ups that you currently have configured, as shown in Figure14.1. Of course, if this is the first
time you have used the module there will be none to display.
If Webmin detects that you do not have any of the necessary backup commands installed on
your system, an error message will be displayed on the main page instead. All Linux distribu-
tions should include a package containing the dump program on their CD or website.

14.3 Adding a New Backup

If you want to backup a directory, either just occasionally or on a regular schedule, you first need
to add a new backup configuration. This specifies a directory to backup, a set of options to use,
and the times at which it should be scheduled to run. The steps to follow to create a new config-
uration are:

1.On the main page of the module, enter the path to the directory that you want to backup
into the field next to the Add a new backup of directory button. When you click the
button, Webmin will determine what type of filesystem the directory is in (ext2, ext3,
or xfs) and display a backup creation form with options for that filesystem type.
Figure14.2 shows the form for an ext2 or ext3 backup.

Figure14.1 The Filesystem Backup module main page.

Adding a New Backup

123

2.The path you entered will appear in the Directory to backup field. You can still change
it if you wish, as long as the new directory that you enter is still on the same filesystem.
3.If backing up to a local file, set the Backup to field to the File or tape device option and
enter the file that you want the backup written to into the text field next to it.
Backing up to a tape drive is similar to writing to a file, but instead of entering a filename
into the File or tape device field you must enter the device file for the tape drive. For
example, /dev/st0 would be the device file for the first SCSI tape drive on your
system.

If backing up to another server, you must select the Host option for the Backup to field
and enter a hostname, remote username, and file or device name on the remote server.
The server must have the shell service enabled in its Internet Services module, as
explained in Chapter15. An appropriate .rhosts file must also be set up for the target
user, to allow the dump command to connect without needing to supply a password.
4.If your backup is being written to a local file that you do not want to be larger than a cer-
tain size, set the Split across multiple files? option to Yes and enter the maximum size
in kilobytes into the Tape size field. This can be useful if the backup is going to be later
saved to multiple CDs or Zip disks.
5.If you are doing multiple backups at different levels as explained in the introduction,
change the Dump level field to something other than Full backup. However, if you want
each backup to contain all files in the source directory, leave it unchanged at level 0.
6.If you are backing up to a tape, it is a good idea to set the Tape size field to the number of
kilobytes that can fit on your tape. Otherwise, the dump command may underestimate the
amount of data that can be written and fail to complete the backup.
7.The chattr command can be used to mark a file to be skipped when making backups,
which can be useful if the directory contains huge and useless files that you would rather
not save. However, when doing a level 0 backup such files will be included, unless the
Always exclude marked files? field is set to Yes.
8.If you are familiar with the dump command used on your operating system, the Extra
command-line parameters
field can be used to enter extra options to be passed to the
program, such as –A /tmp/archive. Otherwise, leave it blank.
9.To have commands run before and after the dump command is executed, fill in the Com-
mand to run before backup
and Command to run after backup fields. These com-
mands will be run as root when the backup is made, either as scheduled or manually
through Webmin. They can be useful for loading and unloading tapes, or copying files
into the backup directory before it is saved.
10.If you want the backup to be run on a regular schedule, set the Scheduled backup
enabled?
option to Enabled and select the times and days for it to run from the lists at
the bottom of the page. The user interface for date and time selection is exactly the same
as the one used by the Scheduled Cron Jobs module, explained in Chapter10.
11.To have a status report of the scheduled backup emailed to you, enter your email address
into the Email scheduled output to field.
12.By default, the subject of the backup email will be something like Dump of /etc. If you
are using this module on multiple systems, you may want to customize the subject line so
that the host the email is coming from and the data that has been backed up is more obvi-

124

Chapter14 • Filesystem Backups

ous. To do this, de-select the Default option for the Email message subject field, and
enter a new subject line into the text field next to it.
13.Finally, click the Create button to save the details of the new backup configuration. If
there are no errors in the form, you will be returned to the modules main page.

Alternatively, you can begin a backup immediately by clicking Create and Backup
Now
. This will take you to the page showing its progress, as explained in Section 14.4
“Making a Backup”.

Apart from ext2 and ext3, the only other filesystem type that has a similar backup command is
xfs. Because its xfsdump command has slightly different options, the fields on the new backup
form are not quite the same as described above. One important difference is that the Directory
to backup
must be the mount point of a filesystem, not just any directory within it.

14.4 Making a Backup

Once you have created a backup configuration that appears on the main page of the module, you
can use Webmin to manually execute it at any time. To do this, the steps to follow are:

1.From the list of configurations on the module’s main page, click on the directory you want
to backup. This will take you to a form showing all the details of the backup configuration.
2.Click the Backup Now button at the bottom of the page. Webmin will execute the appro-
priate dump command and display its output as it writes to the backup file or tape device.
The output from any commands that are run before or after the backup will be shown as well.

Figure14.2 The new backup configuration form.

Editing or Deleting a Backup

125

3.If all goes well, the message backup complete will be displayed at the bottom of the
page. However, if something goes wrong, backup failed will be displayed instead—
check the output of the dump command to see exactly what the problem was.

One limitation of the Filesystem Backup module is that it cannot create backups that span multi-
ple tapes. Usually the dump command would prompt the user to load a new tape when necessary,
but that is not possible when it is being run from Webmin.

14.5 Editing or Deleting a Backup

The backup configurations shown on the module’s main page can be edited at any time. To
change one, do the following:

1.Click on the directory of the backup configuration that you want to change. This will
take you to the editing form, which is similar to the creation form shown in Figure14.2.
2.Change any of the options, including the directory to backup, destination, or schedule.
You cannot change the directory to a path on a different type of filesystem though, as it
may have different options or not be supported at all.
3.Click the Save button to record your changes, or click Save and Backup Now to imme-
diately begin a backup with the new options.

To delete an existing backup configuration, the steps to follow are:

1.On the main page, click on the directory of the backup configuration that you want to
delete, which will take you to the editing form.
2.Click the Delete button at the bottom of the page. The backup configuration will be
immediately removed and you will be returned to the main page of the module. The
actual backup files created by the configuration will not be touched though.

14.6 Restoring a Backup

Backups made using Webmin (or by running the dump command manually) can be restored
using this module as well. If you have been creating backups of different levels, they must be
restored in ascending level order starting with the complete backup (level 0). A backup can be
restored to any directory, not just the one that it was originally saved from. However, some file
information such as ACLs and attributes will be lost if the restore directory’s filesystem does not
support them.

To restore a backup, the steps to follow are:

1.On the main page of the Filesystem Backup module, select the type of filesystem that the
backup was made from, using the list next to the Restore backup of filesystem type but-
ton. Because there are different programs for restoring different types of filesystems, the
restore options will vary depending on the type you choose.
2.Click the Restore backup of filesystem type button, which will take you to the restore
options page. Figure14.3 shows the page for restoring an ext2 or ext3 filesystem
backup.

126

Chapter14 • Filesystem Backups

3.If restoring from a local file, set the Restore from file or device field to the File or tape
device
option and enter the file that you want the backup read from into the text field
next to it.

Restoring from a tape drive is similar to reading from a file, but instead of entering a
filename into the File or tape device field you must enter the device file for the tape
drive: /dev/st0, for example.

If restoring from another server, you must select the Host option and enter a hostname,
remote username, and file or device name on the remote server. As explained in Section
14.3 “Adding a New Backup”, the server must have been configured correctly to allow
remote access.
4.By default, everything in the backup will be restored. To extract only some files, set the
Files to restore option to Listed files and enter paths to the files you want to restore into
the field next to it. To restore multiple files, the filenames must be separated by spaces.

Because the paths used in the backup are sometimes relative to the mount point of the
filesystem that they were originally on, it is often a good idea to use the Only show files
in backup?
option to see what the correct filenames are.
5.In the Restore to directory field, enter the base directory under which you want the
restored files to be saved.
6.If the original backup spanned multiple files, set the Backup is split across multiple
files?
option to Yes.
7.If you just want to view the contents of the backup without extracting any files, set the
Only show files in backup? option to Yes.
8.If you are familiar with the restore command used on your operating system, the
Extra command-line parameters field can be used to enter extra options to be passed
to the program, such as –A /tmp/archive. Otherwise, leave it blank.
9.When you are ready to restore, click the Restore Backup Now button. If extracting files
for real, a page showing the output of the appropriate restore command will be dis-
played. If you chose to just view the files in the backup, the page will display a list pro-
duced by the restore command instead.

When restoring a backup from an xfs filesystem, different options are available on the restore
form. The Files to restore option does not exist, so all files in the backup will be extracted.
However, there is an Overwrite existing files option that can be set to Never to protect existing
files, or Unless newer than backup to protect files that have been modified since the backup
was made.

One problem with using Webmin to restore is that it cannot cope with backups that span
multiple tapes. Normally the restore command would prompt the user to eject the first tape
and insert the second, but that is not possible when it is being run by Webmin.

14.7 Configuring the Filesystem Backup Module

Clicking on the Module Config link in the top-left corner of this module’s main page will bring
up a form for setting options that control how it behaves. The available settings and their mean-
ings are see in Table14.1.

Configuring the Filesystem Backup Module

127

Figure14.3 The backup restoration form.

Table14.1 Module Configuration Options

Do strftime substitution of
backup destinations?

If Yes is selected in this field, the backup destination path will have
any special codes starting with % replaced with components of the
current time and date. For example, %m will be replaced with month
number, %d with the day of the month and %y with the year. These are
the same substations that the standard UNIX strftime function uses.
This option is useful if you want the backup to be written to a different
file each day, instead of over-writing the same file every time.

The default option is No, which turns off this behavior.

Send mail via SMTP server

When Local sendmail executable is selected, the output from
scheduled backups will be sent by running the sendmail com-
mand on your system, the path to which is taken from the Sendmail
Configuration module. However, you can tell the module to send
email by making an SMTP connection to some other host instead,
which may be necessary if your system does not run a mail server
at all, or runs one other that Sendmail. Just select the second radio
button and enter a hostname into the text box.

128

Chapter14 • Filesystem Backups

14.8 Other Operating Systems

Many UNIX operating systems have similar dump and restore commands to Linux, and several
of them are supported by this Webmin module. However, the options available differ slightly, so
the backup and restore forms on different systems will not be exactly the same as Linux.
The currently supported systems and their differences are:

Sun SolarisOn Solaris, ufs filesystems can be backed up and restored using the
ufsdump and ufsrestore commands. When creating a backup, the Split across
multiple files?
and Tape size options are not available—instead, there are Verify
data after backup?
and Eject tape after backup? options whose meanings should
be obvious. Solaris also supports the backing up of multiple directories at once, by
entering multiple paths separated by spaces into the Directory to backup field.

For restoring on Solaris, the options are essentially the same as on Linux.

FreeBSD and Apple MacOS XBoth these operating systems have almost
identical dump commands and available options in Webmin, due to the BSD
ancestry of MacOS X. When making a backup, the Split across multiple files? and
Dump label fields are not available, but Tape size is. The only filesystem type that
can be backed up is ufs and a backup must be of an entire filesystem, not just any
directory. Unfortunately, on MacOS X almost all filesystems are in Apple’s native
hfs format.

When restoring, the only difference is an additional Just test backup? option which
when set causes the restore command to do everything except write to disk.

SGI IrixOn Irix, the only filesystem type that can be backed up with Webmin is
xfs, even though there is a dump command for older efs filesystems. As with the

xfs filesystem on Linux, only entire filesystems can be backed up, not arbitrary
directories. The Tape size option is not available, but instead you can limit the size
of files to include with the Maximum file size to include option, and turn off the
backing up of attributes with the Include file attributes? option.

When restoring a backup on Irix, there is no option to specify which files to
extract—instead, everything in the backup will be restored. However, there is an
Overwrite existing files? option to protect existing files, or existing files that are
newer than the backup, from being overwritten.

Due to the low-level nature of backups made using the dump family of commands, a backup cre-
ated on one operating system will not be restorable on any other.

14.9 Summary

After reading this chapter, you should be able to use Webmin to create backups of data on your
system’s local hard disks, and restore those backups if needed. You should also understand the
difference between the dump backup format used by the module covered here, and those created
by commands like tar and cpio. On a system running important servers or hosting vital data,
proper backups are vital—and Webmin can help you create them.

129

CHAPTER

15

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->