Sometimes you may with to add files to an existing backup; if you issue a command like:
tar -cvf /dev/st0 backupfiles
…and the tape is not already set to the end of the previous archive you will over-write any data from the position on the tape. Use the “eom” command to move the tape to the end of the alread-recorded files like so:
mt -f /dev/[path-to-tape] eom
mt -f /dev/st0 eom
Now you can use tar to add a file to the tape without over-writing the existing data.
If you have compressible data you may save space on you tapes by using compression; this comes at a cost of CPU cycles to do the compressing, which can often be a worthwhile tradeoff for a long-term backup. To do this is quite simple – add in the -z switch to your tar command.
tar -cvzf /dev/[tape-device] [folder or files to back up]
tar -cvzf /dev/st0 /opt/movies
For some file types – e.g. movies, mp3s, compressed picture files and the like you probably won’t see a great deal of space saved – though if it enough to save you from using two tapes instead of one, it may be worth it even so. Text and other file types may compress more easily and you may see more of a savings – it will vary greatly depending on your dataset. Try it and see!
Sometimes you may see people using the -j switch instead – this uses the bzip2 algorithm rather than the gzip algorithm (the -z switch). You will probably find that gzip is slightly better supported and bzip2 sometimes provides slightly better compression but takes longer. If you are chasing better compression it may be worth replacing the z switch with j to see if it helps.
Following on from the article on writing files to a tape backup
, what happens if you want to back up more than what fits on a single tape? Here we want to use the –multi-volume switch, or -M. Use it so:
tar -cvMf /dev/[path-to-tape] [backup folder or files]
As a working example:
tar -cvMf /dev/st0 /opt/movies
Once the first tape is full, tar will prompt you to insert another:
Prepare volume #2 for `/dev/st0′ and hit return:
Make sure you replace the tape with another before hitting return or else it will over-write the just-finished tape!
With the exception of a file which sits across multiple tapes (think of a file which starts at the end of one tapes and finishes at the start of the next) you don’t need a first tape to restore the files on the second. You also cannot use compression for multi-volume archives.
With used tape drives falling in price they are now finding their ways into the hands of more home storage enthusiasts; one should be wary about purchasing a tape drive in unknown condition, though, as there’s a good chance that it may be faulty or require servicing. One way to check the status of the tape drive for HP units is their Library and Tape Tools software – currently available from here:
To run a test, open L&TT and click on the Test tab:
Insert a tape into the drive that is blank (or has data you don’t mind being over-written), click on Options:
Click (or double click) on Allow Overwrite and change it to True, then click OK. You will be returned to the previous screen. Click “Start Test”.
What you don’t really want to see is a pop-up a couple of minutes later like this:
Time to look at the Test/Utility Results tab:
From here we can expand the Analysis Results to see what has happened:
Another possible result is an incomplete test:
This can sometimes happen because the drive needs cleaning – if you open the Analysis Results you will see a request for cleaning if this is the case:
Hopefully, though, you get a passed test with no issues such as these! To get a detailed report of the drive status we can use the Report Viewer – click on the Support tab at the top, then Refresh Device Data, then View Support Ticket. You should see a report with expandable headings which provides a great deal of information, e.g.:
There is a wealth of information here, covering both the drive and the tape inside. Worth checking over for any anomalies if you have just received a new drive!
The quickest and easiest way of updating the firmware is through HP’s Library and Tape Tools – at the time of writing it is available here:
Click on the “Link to free download” link to acquire the software. Assuming you have the correct drivers for your setup (SCSI/SAS/etc card), the tape drive is connected and powered on you will be able to detect it using LTT. Click on “Firmware” at the top:
Now click “Get Files From Web”, then select your tape drive/firmware and click Download:
Once it has download, exit that screen and click on Firmware again:
You should be looking at the Update Firmware tab by default, if not select it and you should see the above screen. To update the firmware now (once checking that all of the numbers look as they should!) click Start Update. You will see the following warning message:
After that, you should see:
We find that the Time Remaining is usually reasonably pessimistic and that it generally finishes early. Once the update is complete you will get the following popup:
Once LTT comes back to life, your update should be completed and you can check it through the Health tab, which should pop up the Report Viewer:
There’s plenty of info in there so it’s well worth checking to see how much life is remaining on the drive.
This is just like extracting a regular tar archive:
tar -xvf /dev/[path to tape] [directory or file to restore]
tar -xvf /dev/st0 backups
This will restore the “backups” file/folder to the current working directory. To check your current directory, you can use:
to make sure that you are restoring your files to the correct location!
To check the contents of a tape, insert the tape and run the following:
tar -tf /dev/[path to tape device]
tar -tf /dev/st0
Note that typically it’s a zero, not a letter o, at the end.
To put files onto a tape, run the following:
tar -cvf /dev/[path to tape] [file or directory] [file or directory] [file or directory]
An example would be:
tar -cvf /dev/st0 /home/bob
This will back up the user bob’s home directory to the tape, here located at /dev/st0 (a typical location – note the zero, not the letter o).
If you want to use compression in your backup, use the z flag in addition to the other tar flags, such as:
tar -cvfz /dev/st0 /home/bob
This is another nice and easy one, though it may take a while depending on the size/speed of the tape:
sudo mt -f [/path/to/tape] erase
sudo mt -f /dev/st0 erase
That’s /dev/st(zero) not /dev/st(letter o), in case it’s not clear from the font. This will likely take some time as the tape is erased from end-to-end – once it is done you will be returned to a prompt.
This again uses the mt command, and is nice and easy:
sudo mt -f [path/to/tape/drive] rewind
A common example would be:
sudo mt -f /dev/st0 rewind
Easy done! In the above example it’s st (zero) not st (letter o) – in case it’s not clear from the font.