Posted by Pavel | Posted in Linux Administration | Posted on 11-07-2012
After getting to my office and check my email, I found a message with a short and interesting question about how to make backups in tape devices.
To keep it short, the command used to manage tape devices is called ‘mt‘. It is this tool that allows us to control tape devices.
I am assuming that after attaching the tape, it is accessible through /dev/sr0.
Before starting, you might want to check the tape status to get information about the tape unit (this step is optional):
If you we to see in which block we are:
Creating your backup:
First, let us rewind the tape
Now, assuming we want to backup a directory called important_data , we do the following:
After it have completed, we can list the written files with this command
Restoring your backup
Assuming we want to restore our backup in the root (‘/’) directory, we would type the following
# mt -f /dev/sr0 rewind
# tar xzf /dev/sr0 important_data
Now, let us rewind the tape and, if applicable, unload it.
If we want to delete the information in the tape device, we type
And that’s basically how you do it. You might also want to check the man page of the ‘mt’ command in order to learn about a few more options that might come in handy while managing tape devices.