# How to take and restore backup with an LTO tape drive in RedHat?

I can take a backup with an IBM LTO tape drive in RedHat 5 using mt and tar, but I can't restore it. I can't see previous backup content. Whenever I try to take a backup, I think that the new backup overwrites the one on tape every time.

mt command does not work to rewind the tape.

Can someone explain how I should restore and list backup contents from the tape drive?

• Please create one question per topic. – Jonas Stein Jan 2 '20 at 0:22

If you want to store more than one archive file on a tape, you can do so by using the nonrewinding tape device filename.

For example:

tar cvlpf /dev/nst0 /home
tar cvlpf /dev/nst0 /


That should write the /home and the / into 2 separate files in the tape device.

To access each files after you have created them in the tape, you should use mt as mt take the following syntax:

mt -f device operation [count] [arguments]


You should put fsf and a number in the [count] in order to go to that number file. bsf and number is backwards.

So suppose you have written already one file to the tape drive with the above tar command, now you should do #mt -f /dev/tapeDev fsf 1 then issue the second tar command (for example you could use the mentioned above command), then #mt -f /dev/tapeDev offline in order to rewind and unload the tape.

Always it is good idea to issue the #mt -f /dev/tapeDev rewind command before you write anything to it, so that you make sure that you start to write to the start of the tape drive.