Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the common commands for using tape drives under linux and unix

2025-02-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail what are the common commands for using tape drives under linux and unix. The content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.

There are many ways to use tape drives in Linux environment, mainly through Amanda, tar and other software.

Amanda provides the function of remote centralized backup, which can store backup remotely and centrally by setting client and server respectively. Tar is mainly used in stand-alone environment to write data directly to tape backup. For the backup of a single node, you can simply use the Tar command for backup and recovery.

After installing the tape, restart the server and execute the dmesg command to see that the new tape drive device is called / dev/st0

Tape operation

Rewind, roll the tape to the starting position: mt-f / dev/st0 rewind

Erase, erase the contents of the tape: mt-f / dev/st0 erase

Note: erase work is very slow, and damage to the tape, it is best not to perform, when the data is full, you can continue to write data and overwrite the original data, there is no need to perform erase operation. The new tape can be used immediately after opening the package, and there is no need to perform an erase.

Exit, roll the tape to its original position and eject from the tape drive: mt-f / dev/st0 offline

Data operation

List directory operations: tar tvf / dev/st0

Write data operation: tar cvf / dev/st0

Note: there are two ways to write data: write to a file directly without packaging and write to a file after packaging and compression. Each has its own advantages and disadvantages. The method of writing directly to a file without packaging seems inefficient and complex, but it can improve the survival rate of the data. Magnetic tape is a linear storage device in which all data is written sequentially. When one point of the tape is damaged, the tape in the rest of the tape can continue to be read, and the files in it can also be read. If you use the method of writing after packaging and compression, only one file is stored on the tape. When there is a failure in any part of the tape that cannot be read, the compressed file will lack some details, and it will be a bit error, which will also cause the compressed file to report a CRC error. Therefore, if you are storing a large amount of data, it is recommended to write directly. If you are accessing a small file, it is best to package and time-stamp the file name.

Continue writing data: tar rvf / dev/st0

Read data: tar xvf / dev/st0

In UNIX environment, the device file associated with tape is / dev/rmt/0. The following example only illustrates the association between tape drive device file and physical device under the commonly used Sun Solaris operating system.

Commands for tape drive

The following describes the tape drive read and write commands and operation management commands. The most commonly used tape drive read and write command is tar, which can list directories, read and write directory files to the tape. The following is an introduction to the tape drive read and write commands.

Column tape directory: tar tvf tape drive device file name

Write tape for the first time: tar cvf tape drive device file name the file or directory name to be recorded

Incremental write tape: tar rvf tape drive device file name the name of the file or directory to record

Read tape: tar xvf tape drive device file name the file or directory name to be read

The most commonly used tape drive operation management command is mt. The mt command is a very common command for operating tape drive. It is very convenient to manage tape drive devices. The following is an introduction to the tape drive operation management command:

Tighten the tape: mt-f tape drive device file name retension

Rewind: mt-f tape drive device file name rewind

List tape drive status: mt-f tape drive device file name status

Erase data: mt-f tape drive device file name erase

Note: for more detailed instructions on the use of the mt command, please refer to mt's man page.

Examples of tape drive operation management commands:

$mt-f / dev/rmt/0h retension / * tighten the tape * /

$mt-f / dev/rmt/0h rewind / * rewind * /

$mt-f / dev/rmt/0h status / * list tape drive status * /

$mt-f / dev/rmt/0h erase / * erase tape data * /

The type of tape drive is either SCSI interface or ATAPI interface. The device file names associated with the two types of tape drives are listed below:

Device (Device) rollback (Rewinding) not rollback (No-Rewind)

1st SCSI tape drive / dev/st0 / dev/nst0

2nd SCSI tape drive / dev/st1 / dev/nst1

Nth SCSI tape drive / dev/ st [n-1] / dev/ NST [n-1]

1st ATAPI tape drive / dev/ht0 / dev/nht0

2nd ATAPI tape drive / dev/ht1 / dev/nht1

Nth ATAPI tape drive / dev/ HTT [n-1] / dev/ NTT [n-1]

1st floppy tape drive / dev/ft0 / dev/nft0

This is the end of the common commands about the use of tape drives under linux and unix. I hope the above can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report