How To:Backup to Virtual Tapes on a non-UNIX Filesystem

From wiki.zmanda.com
Jump to navigation Jump to search

Introduction

Amanda has the ability to use a harddisk to store the contents of backups onto virtual tapes (vtapes) using the File driver. The vtapes can be located on any filesystem, even a remote one. Here we are using CIFS to store out vtapes on a Windows machine. This is not specific to Windows, many NAS devices support CIFS. The example here is a W2K machine (tapeserver) to store the tapes and a RedHat Enterprise Linux 4 machine running Amanda.

Setup

The setup of Amanda is covered in the article on File driver, there are only a couple of extra steps to perform. We choose a setup with chg-disk.

Firstly, you need to create some vtapes on your CIFS device. Where possible it is probably best to keep them all under a single directory, with the config name inside it. For example if your config name is Daily, you might create several directories called slot1 to slotN in D:\AmandaTapes\Daily\.

Each virtual tape needs to be shared separately due to the way chg-disk works. It maintains a symlink called "data" which points to the currently 'loaded' slot. CIFS does not support symlinks, so sharing each tape allows the symlink to live on the local filesystem. On a Windows machine, sharing is quickly achieved from Windows Explorer, or by using the "net share" command. Share names like "AmandaTapes-daily-slot1" help to make sure your share names are not ambiguous across configs, or confused with other shares.

As alternative, you can choose a setup with chg-multi instead of chg-disk: that implementation does not use a symlink, and there you can use one toplevel share. See more in the article about the File driver.

Now that the vtapes are created, they need to be mounted on our Amanda server. This is done using mount.cifs from the Samba software suite. It requires a credentials file that you supply a valid Windows username and password for connecting to the share. Here we use /etc/amandatapecredentials. The format of this is specified in the Samba documentation, and the Amanda documentation where a similar file is used for connecting to Windows clients. Make sure the permissions are sufficiently tight on this file so that only root can access the file.

We also need to decide where to mount these tapes on our filesystem. Here we have gone for /amandatapes/Daily. So we have executed the following as root:

$ mkdir -p /amandatapes/Daily/slot1
...
$ mkdir -p /amandatapes/Daily/slotN
$ chown -R amanda:amanda /amandatapes

It is useful to have the vtapes mounted as soon as the Amanda server boots. On our example Linux server this is done by editing /etc/fstab to include new entries for our vtapes. These look something like the following:

//tapeserver/AmandaTapes-daily-slot1 /amandatapes/daily/slot1 cifs credentials=/etc/amandatapecredentials,uid=amanda,gid=amanda,rw 0 0
...
//tapeserver/AmandaTapes-daily-slotN /amandatapes/daily/slotN cifs credentials=/etc/amandatapecredentials,uid=amanda,gid=amanda,rw 0 0

We can mount them using

mount /amandatapes/daily/slot1
...
mount /amandatapes/daily/slotN

or even with

mount -a -t cifs

if we want to mount all the CIFS-filesystems at once.

Now the vtapes need to be labeled using amlabel in the normal way. See the article File driver for examples.

Performance

Performance using CIFS via Samba is known to be poorer than protocols such as FTP, HTTP and even CIFS on Windows. This is apparently due to Samba not using delayed writes so each write has to be acknowledged by the server before the next one can take place.

Before deciding to use CIFS it would be advisable to test the speed of a transfer to a CIFS mount from your amanda server. Although bandwidth is an issue, latency also plays a big part.

More research on increasing performance is done and the results will be posted here.