I recently got my hands on an LTO tape drive. Finding useful information was quite tricky and it took a lot of trial and error to find a starting point.
Since useful information is very scattered, I've collected things together in a little guide, maybe it's helpful for someone:
Create a jail using the "Advanced Jail Creation". Under Jail Properties set `devfs_ruleset` to `0`, enable `allow_mount` and select `allow_mount_devfs` under the `allow_mount_*` dropdown.
Then create and start the jail.
As root on TrueNAS enter the jail using `iocage console <your jail name>`.
Check you can access the tape drive from your jail using `mt status`.
The output should look like this:
# Basic setup
Then type `pkg info` to install the package manager.<br/>
Then install the necessary software:
Enable inetd to run the Amanda service later
Then restart the jail to apply those changes and log back in.
Create and empty `/etc/fstab` as Amanda requires the file to be there, also the hosts configuration file.
pkg already created an `amanda` user/group. To later use it we need to assign a login shell:
Prepare config and var directories:
and restart inetd:
If you don't find a predefined `tapetype` for your drive you need to run `amtapetype` to test the speed, size etc of the tape.
This can run for a couple of hours. You may need to give it size hint for it to complete in reasonable time, see amtapetype(8).
This should give out the `tapetype` definition of our tape drive looking like:
Then let amanda create our backup configuration, see amserverconfig(8).
Edit the generated `/usr/local/etc/amanda/sample-backup/amanda.conf` and add the `define tapetype` block from above and adapt the `tapetype` to it.
Next copy the `/usr/local/share/amanda/example/amanda-client.conf` to `/usr/local/etc/amanda` and adapt it:
`amrecover` will use this to initialize.
Prepare localhost access by creating the file `/var/db/amanda/.amandahosts` to allow connections from localhost:
Then fix permissions of etc folder as root again (Amanda client requires /usr/local/etc/amanda to belong to root)
as well as the `.amandahosts` file which must belong to `amanda` user and be accessible by the user only.
Run the integrated check as amanda user:
There should be no errors besides mentioning tape labels.
Next we set up the disk list to quickly back something up in `/usr/local/etc/amanda/sample-backup/disklist`:
If the tape drive is using hardware compression, root-tar should be a good fit. See `/usr/local/etc/amanda/template.d/dumptypes` and disklist(5).
We need to label a tape for Amanda to backup to it, matching our `labelstr` defined in the `amanda.conf`:
Then write our first backup:
To test recover, we need to run `amrecover` as `root`:
`amrecover` will note which tape to insert and continue to extract the selected file into `/tmp/test` . You can quit `amrecover` with `exit`.
To clean up our test run, delete the tape as `amanda` user again:
Since useful information is very scattered, I've collected things together in a little guide, maybe it's helpful for someone:
Creating jail
First we need to create a jail with access to the tape drive.Create a jail using the "Advanced Jail Creation". Under Jail Properties set `devfs_ruleset` to `0`, enable `allow_mount` and select `allow_mount_devfs` under the `allow_mount_*` dropdown.
Then create and start the jail.
As root on TrueNAS enter the jail using `iocage console <your jail name>`.
Check you can access the tape drive from your jail using `mt status`.
The output should look like this:
Code:
Drive: sa0: <TANDBERG LTO-6 HH 3329> --------------------------------- Mode Density Blocksize bpi Compression Current: 0x5a:LTO-6 variable 384607 enabled (0x1) --------------------------------- Current Driver State: at rest. --------------------------------- Partition: 0 Calc File Number: 0 Calc Record Number: 0 Residual: 0 Reported File Number: 0 Reported Record Number: 0 Flags: BOP
# Basic setup
Then type `pkg info` to install the package manager.<br/>
Then install the necessary software:
Code:
pkg install amanda-server amanda-client aespipe
Enable inetd to run the Amanda service later
Code:
echo 'inetd_enable="YES"' >> /etc/rc.conf
Then restart the jail to apply those changes and log back in.
Create and empty `/etc/fstab` as Amanda requires the file to be there, also the hosts configuration file.
Code:
touch /etc/fstab
pkg already created an `amanda` user/group. To later use it we need to assign a login shell:
Code:
chsh -s /bin/csh amanda
Prepare config and var directories:
Code:
chown amanda:amanda /usr/local/etc/amanda mkdir -p /var/lib/amanda chown amanda:amanda /var/lib/amanda
Configure Amanda Server
First configure the Amanda server by appending in `/etc/inted.conf`:Code:
amanda stream tcp nowait amanda /usr/local/libexec/amanda/amandad amandad -auth=bsdtcp amdump amindexd amidxtaped
and restart inetd:
Code:
service inetd restart
If you don't find a predefined `tapetype` for your drive you need to run `amtapetype` to test the speed, size etc of the tape.
This can run for a couple of hours. You may need to give it size hint for it to complete in reasonable time, see amtapetype(8).
Code:
amtapetype -f /dev/sa0
This should give out the `tapetype` definition of our tape drive looking like:
Code:
define tapetype tandberg-lto6hh { comment "Tandberg LTO-6 HH; compression enabled" length 2442932512 kbytes filemark 1065 kbytes speed 137420 kps blocksize 32 kbytes }
Then let amanda create our backup configuration, see amserverconfig(8).
Code:
su - amanda amserverconfig sample-backup --template single-tape --tapedev /dev/sa0 --mailto admin@example.local
Edit the generated `/usr/local/etc/amanda/sample-backup/amanda.conf` and add the `define tapetype` block from above and adapt the `tapetype` to it.
Next copy the `/usr/local/share/amanda/example/amanda-client.conf` to `/usr/local/etc/amanda` and adapt it:
Code:
conf "sample-backup" # your config name index_server "localhost" # your amindexd server tape_server "localhost" # your amidxtaped server tapedev "tape:/dev/sa0" # your tape device auth "bsdtcp" ssh_keys "" # your ssh keys file if you use ssh auth
`amrecover` will use this to initialize.
Prepare localhost access by creating the file `/var/db/amanda/.amandahosts` to allow connections from localhost:
Code:
localhost amanda amdump localhost root amindexd amidxtaped
Then fix permissions of etc folder as root again (Amanda client requires /usr/local/etc/amanda to belong to root)
as well as the `.amandahosts` file which must belong to `amanda` user and be accessible by the user only.
Code:
chown root:wheel /usr/local/etc/amanda touch /var/db/amanda/.amandahosts chmod 600 /var/db/amanda/.amandahosts chown amanda:amanda /var/db/amanda/.amandahosts
Testing backup
With our completed configuration we can go on and test our setup and do a simple backup/restore.Run the integrated check as amanda user:
Code:
amcheck sample-backup
There should be no errors besides mentioning tape labels.
Next we set up the disk list to quickly back something up in `/usr/local/etc/amanda/sample-backup/disklist`:
Code:
localhost /etc root-tar
If the tape drive is using hardware compression, root-tar should be a good fit. See `/usr/local/etc/amanda/template.d/dumptypes` and disklist(5).
We need to label a tape for Amanda to backup to it, matching our `labelstr` defined in the `amanda.conf`:
Code:
amlabel -f sample-backup sample-backup-0
Then write our first backup:
Code:
amdump sample-backup
To test recover, we need to run `amrecover` as `root`:
Code:
mkdir /tmp/test cd /tmp/test amrecover sample-backup amrecover> sethost localhost amrecover> setdisk /etc amrecover> ls amrecover> add resolv.conf amrecover> extract
`amrecover` will note which tape to insert and continue to extract the selected file into `/tmp/test` . You can quit `amrecover` with `exit`.
To clean up our test run, delete the tape as `amanda` user again:
Code:
amrmtape sample-backup sample-backup-0