CentOS 7.x mt
<yambe:breadcrumb self="mt">CentOS_7.x_command_line_tools_and_utilities|Command line tools and utilities</yambe:breadcrumb>
CentOS 7.x mt
It is possible to use magnetic tape drive directly from Linux command line using 'mt' command. There is similar st command for SCSI tape drives.
Erase tape
To erase tape and make it completely blank for new use:
mt -f /dev/st0 erase
Rewind tape
To rewind tape use:
mt -f /dev/st0 rewind
Add data to tape
In quick experiments it looked like storing multiple objects and using tape forward, backward, etc. may not work. In this case to store multiple objects we can use Linux tar command to convert folder/sub-folders and files to a single archive. However, unless required avoid compression so that selectively files can be listed, extracted, etc. without requiring decompression of entire archive.
To add directory to tape after appropriate erase, rewind use:
tar -cf /dev/st0 /etc
For compression add 'z' or 'j' to tar options appropriately.
List contents of tape
To list contents use:
tar -tf /dev/st0
This might require rewind to again point to start of tape.
Extract contents
To extract contents use:
tar -xf /dev/st0 [<file-or-folder-to-extract>]
This might require rewind to again point to start of tape.
Check tape status
To check tape status use:
mt -f /dev/st0 status
Eject or remove tape
To eject or remote tape use:
mt -f /dev/st0 offline
Move record-wise
It is possible to use entire tape for a single tar archive as suggested before. However, for multiple data store / retrieval there is option to move forward/backward in records.
Go to previous record
To go to previous record use:
mt -f /dev/nst0 bsfm 1
Note use of nst0 instead of st0
Go to next record
To go to next record use:
mt -f /dev/nst0 fsf 1
Note use of nst0 instead of st0
Refer:
- https://access.redhat.com/solutions/68115
- https://www.cyberciti.biz/faq/linux-tape-backup-with-mt-and-tar-command-howto/
<yambe:breadcrumb self="mt">CentOS_7.x_command_line_tools_and_utilities|Command line tools and utilities</yambe:breadcrumb>