- Red Hat Enterprise Linux 5 (RHEL5)
- Red Hat Enterprise Linux 6 (RHEL6)
- Red Hat Enterprise Linux 7 (RHEL7)
- Red Hat Enterprise Linux 8 (RHEL8)
- A tape device is attached and can be seen in the output from
- An example device name could be /dev/st0 or /dev/nst0
- How to use mt ( Magnetic Tape) command to control the magnetic tape drive operation ?
- How do we check whether the tape drive is online or not in RHEL5 ? is it still with "mt" command or something else ?
The mt command provides several features that can query and control the tape drives including:
- Rewind tape drive:
# mt -f /dev/st0 rewind
- Backup directory /etc with tar command (with z compression):
# tar -czf /dev/st0 /etc
- Display list of all files on tape:
# tar -tzf /dev/st0
- Restore /etc directory:
# cd / # mt -f /dev/st0 rewind # tar -xzf /dev/st0 etc
- Unload the tape:
# mt -f /dev/st0 offline
- status information about the tape :
# mt -f /dev/st0 status
- Erase the tape:
# mt -f /dev/st0 erase
- Go to end of data:
# mt -f /dev/nst0 eod
- Goto previous record:
# mt -f /dev/nst0 bsfm 1
- Forward record:
# mt -f /dev/nst0 fsf 1
- Restore /home from tape in case of data loss or hard disk failure:
# tar -xlpMzvf /dev/st0 /home
- More commands can be found on the mt man page:
# man mt
The mt command (short for "Magnetic Tape") is used to query and control tape drives.
This article may apply to your system if the following symptoms match:
- a tape drive is attached to the system,
- the current status of the tape drive is unknown,
- a restoration from backup is needed,
- some tape drive maintenance operations are requested.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.