Difference between revisions of "CentOS 7.x mt"

From Notes_Wiki
(Created page with "<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...")
 
m
 
Line 1: Line 1:
<yambe:breadcrumb self="mt">CentOS_7.x_command_line_tools_and_utilities|Command line tools and utilities</yambe:breadcrumb>
[[Main Page|Home]] > [[CentOS]] > [[CentOS 7.x]] > [[CentOS 7.x command line tools and utilities|Command line tools and utilities]] > [[CentOS 7.x mt]]
=CentOS 7.x mt=
 
 
It is possible to use magnetic tape drive directly from Linux command line using '<tt>mt</tt>' command.  There is similar st command for SCSI tape drives.
It is possible to use magnetic tape drive directly from Linux command line using '<tt>mt</tt>' command.  There is similar st command for SCSI tape drives.


Line 82: Line 83:




<yambe:breadcrumb self="mt">CentOS_7.x_command_line_tools_and_utilities|Command line tools and utilities</yambe:breadcrumb>
[[Main Page|Home]] > [[CentOS]] > [[CentOS 7.x]] > [[CentOS 7.x command line tools and utilities|Command line tools and utilities]] > [[CentOS 7.x mt]]

Latest revision as of 09:09, 25 August 2022

Home > CentOS > CentOS 7.x > Command line tools and utilities > 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:


Home > CentOS > CentOS 7.x > Command line tools and utilities > CentOS 7.x mt