Este conteúdo não está disponível no idioma selecionado.
Chapter 17. Managing tape devices
A tape device is a magnetic tape where data is stored and accessed sequentially. Data is written to this tape device with the help of a tape drive. There is no need to create a file system in order to store data on a tape device. Tape drives can be connected to a host computer with various interfaces like, SCSI, FC, USB, SATA, and other interfaces.
17.1. Types of tape devices Copiar o linkLink copiado para a área de transferência!
The following is a list of the different types of tape devices:
-
/dev/st0is a rewinding tape device. -
/dev/nst0is a non-rewinding tape device. Use non-rewinding devices for daily backups.
There are several advantages to using tape devices. They are cost efficient and stable. Tape devices are also resilient against data corruption and are suitable for data retention.
17.2. Installing tape drive management tool Copiar o linkLink copiado para a área de transferência!
Install the mt-st package for tape drive operations. Use the mt utility to control magnetic tape drive operations, and the st utility for SCSI tape driver.
Procedure
Install the
mt-stpackage:dnf install mt-st
# dnf install mt-stCopy to Clipboard Copied! Toggle word wrap Toggle overflow
17.3. Tape commands Copiar o linkLink copiado para a área de transferência!
The following are the common mt commands:
| Command | Description |
|---|---|
|
| Displays the status of the tape device. |
|
| Erases the entire tape. |
|
| Rewinds the tape device. |
|
| Switches the tape head to the forward record. Here, n is an optional file count. If a file count is specified, tape head skips n records. |
|
| Switches the tape head to the previous record. |
|
| Switches the tape head to the end of the data. |
17.4. Writing to rewinding tape devices Copiar o linkLink copiado para a área de transferência!
A rewind tape device rewinds the tape after every operation. To back up data, you can use the tar command. By default, in tape devices the block size is 10KB (bs=10k). You can set the TAPE environment variable using the export TAPE=/dev/st0 attribute. Use the -f device option instead, to specify the tape device file. This option is useful when you use more than one tape device.
Prerequisites
-
You have installed the
mt-stpackage. For more information, see Installing tape drive management tool. Load the tape drive:
mt -f /dev/st0 load
# mt -f /dev/st0 loadCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Procedure
Check the tape head:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Here:
-
the current
file numberis -1. -
the
block numberdefines the tape head. By default, it is set to -1. -
the
block size0 indicates that the tape device does not have a fixed block size. -
the
Soft error countindicates the number of encountered errors after executing the mt status command. -
the
General status bitsexplains the stats of the tape device. -
DR_OPENindicates that the door is open and the tape device is empty.IM_REP_ENis the immediate report mode.
-
the current
If the tape device is not empty, overwrite it:
tar -czf /dev/st0 _/source/directory
# tar -czf /dev/st0 _/source/directoryCopy to Clipboard Copied! Toggle word wrap Toggle overflow This command overwrites the data on a tape device with the content of
/source/directory.Back up the
/source/directoryto the tape device:Copy to Clipboard Copied! Toggle word wrap Toggle overflow View the status of the tape device:
mt -f /dev/st0 status
# mt -f /dev/st0 statusCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
View the list of all files on the tape device:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
17.5. Writing to non-rewinding tape devices Copiar o linkLink copiado para a área de transferência!
A non-rewinding tape device leaves the tape in its current status, after completing the execution of a certain command. For example, after a backup, you could append more data to a non-rewinding tape device. You can also use it to avoid any unexpected rewinds.
Prerequisites
-
You have installed the
mt-stpackage. For more information, see Installing tape drive management tool. Load the tape drive:
mt -f /dev/nst0 load
# mt -f /dev/nst0 loadCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Procedure
Check the tape head of the non-rewinding tape device
/dev/nst0:mt -f /dev/nst0 status
# mt -f /dev/nst0 statusCopy to Clipboard Copied! Toggle word wrap Toggle overflow Specify the pointer at the head or at the end of the tape:
mt -f /dev/nst0 rewind
# mt -f /dev/nst0 rewindCopy to Clipboard Copied! Toggle word wrap Toggle overflow Append the data on the tape device:
mt -f /dev/nst0 eod tar -czf /dev/nst0 /source/directory/
# mt -f /dev/nst0 eod # tar -czf /dev/nst0 /source/directory/Copy to Clipboard Copied! Toggle word wrap Toggle overflow Back up the
/source/directory/to the tape device:Copy to Clipboard Copied! Toggle word wrap Toggle overflow View the status of the tape device:
mt -f /dev/nst0 status
# mt -f /dev/nst0 statusCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
View the list of all files on the tape device:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
17.6. Switching tape head in tape devices Copiar o linkLink copiado para a área de transferência!
You can switch the tape head in the tape device by using the eod option.
Prerequisites
-
You have installed the
mt-stpackage. For more information, see Installing tape drive management tool. - Data is written to the tape device. Fore more information, see Writing to rewinding tape devices or Writing to non-rewinding tape devices.
Procedure
To view the current position of the tape pointer:
mt -f /dev/nst0 tell
# mt -f /dev/nst0 tellCopy to Clipboard Copied! Toggle word wrap Toggle overflow To switch the tape head, while appending the data to the tape devices:
mt -f /dev/nst0 eod
# mt -f /dev/nst0 eodCopy to Clipboard Copied! Toggle word wrap Toggle overflow To go to the previous record:
mt -f /dev/nst0 bsfm 1
# mt -f /dev/nst0 bsfm 1Copy to Clipboard Copied! Toggle word wrap Toggle overflow To go to the forward record:
mt -f /dev/nst0 fsf 1
# mt -f /dev/nst0 fsf 1Copy to Clipboard Copied! Toggle word wrap Toggle overflow
17.7. Restoring data from tape devices Copiar o linkLink copiado para a área de transferência!
You can restore data from a tape device by using the tar command.
Prerequisites
-
You have installed the
mt-stpackage. For more information, see Installing tape drive management tool. - Data is written to the tape device. For more information, see Writing to rewinding tape devices or Writing to non-rewinding tape devices.
Procedure
For rewinding tape devices
/dev/st0:Restore the
/source/directory/:tar -xzf /dev/st0 /source/directory/
# tar -xzf /dev/st0 /source/directory/Copy to Clipboard Copied! Toggle word wrap Toggle overflow
For non-rewinding tape devices
/dev/nst0:Rewind the tape device:
mt -f /dev/nst0 rewind
# mt -f /dev/nst0 rewindCopy to Clipboard Copied! Toggle word wrap Toggle overflow Restore the
etcdirectory:tar -xzf /dev/nst0 /source/directory/
# tar -xzf /dev/nst0 /source/directory/Copy to Clipboard Copied! Toggle word wrap Toggle overflow
17.8. Erasing data from tape devices Copiar o linkLink copiado para a área de transferência!
You can erase data from a tape device by using the erase option.
Prerequisites
-
You have installed the
mt-stpackage. For more information, see Installing tape drive management tool. - Data is written to the tape device. For more information, see Writing to rewinding tape devices or Writing to non-rewinding tape devices.
Procedure
Erase data from the tape device:
mt -f /dev/st0 erase
# mt -f /dev/st0 eraseCopy to Clipboard Copied! Toggle word wrap Toggle overflow Unload the tape device:
mt -f /dev/st0 offline
# mt -f /dev/st0 offlineCopy to Clipboard Copied! Toggle word wrap Toggle overflow