HPUX tape management commands and common applications

Source: Internet
Author: User
Tags rewind

From the user's point of view, any unix device can be seen as a file. Therefore, you can "open" an appropriate tape drive file to write data to the file. Although it sounds too simple, this is the actual situation. The Unix system treats every device as a file and processes it like a common file, so that the operations on the file and the device are as unified as possible. From the user's point of view, the use of devices is the same as that of General files. Therefore, the most effective way to manage tapes is to use related commands.

Daily applications:

1. Tape BACKUP command:

Make_tape_recovery-Av is backed up to/dev/rmt/0mn by default.

If there are multiple tape drives, use the following command

Make_tape_recovery-Av-a/dev/rmt/1mn

2. Retrieve the content of the drive belt of the system.

In addition to the first section of the data stored in the drive belt of the system, the data stored in the drive belt is used in other cases, it is used to copy data to the magnetic band in tar format. Therefore, if you skip the first article, you can use the tar command to access the content of other parts.

The method is as follows:

# Mt-t/dev/rmt/0mn fsf 1

# Tar-xvf/dev/rmt/0 m [filename]

Appendix: when you use the mt command to skip the first upload case, you must use the device file of the tape file/dev/rmt/0mn (No rewind on close, otherwise, after the mt command is completed, the magnetic belt will automatically return to the starting position.

3. Place the tape and run the tar command to test whether the tape drive is available.

# Tar-cvf/dev/rmt/0 m myfile

4. view the content in the tape

Tar cvf/dev/rmt/2 m/tmp Write File in

Tar-tvf/dev/rmt/2 m view the content in the tape

Command explanation:

1. mt command

The mt command is used to control the tape drive. You can use the status option of the mt command to obtain the status information about the tape drive. The mt Command reports information about all the tape drives in the configuration file/kernel/drv/st. conf.

Mt command Format: mt [-f device] command [count],

L display tape status

# Mt-f/dev/rmt/n status

You can then replace the tape drive numbers 0, 1, 2, and 3 to display information about all available tape drives.

Application instance:

Display the status of the QIC-150 tape drive (/dev/rmt/0:

$ Mt-f/dev/rmt/0 status

Archive QIC-150 tape drive:

Sense key (0x0) = No Additional Sense residual = 0 retries = 0

File no = 0 block no = 0

Example:

[Root @ pms_db1]/> mt-f/dev/rmt/36mn status--- The status is, not on tape

Drive: HP C7438A

Format:

Status: Tape media is not present

File: 0

Block: 0

[Root @ pms_db1]/tmp> mt-f/dev/rmt/36mn status---- The status is normal.

Drive: HP C7438A

Format:

Status: [41114700]BOT onlineCompressionimmediate-report-mode

File: 0

Block: 0


[Root @ pms_db2]/tmp> mt-f/dev/rmt/0mn status---- Backup is supported, but an error is reported in half.

Drive: HP C7438A

Format:

Status :[81114700] EOFOnline compressionimmediate-report-mode ---- The tape is at the end or in the middle and needs to be reversed

File: 23

Block:-1

I found some information:

> What is the meaning of "Block:-1 "? Does it indicate anyerror?

Mt (7) says these fields are no longer used andSet to-1: structureForMTIOCGET-mag tape get status command struct mtget {

BOT, indicating that the tape is at the beginning

EOF (END Of file)

LPull another tape

If an error occurs while reading the tape, you can re-tension the tape, clean the tape drive, and then try again. Do not re-take the non-QIC tape drive.

$ Mt-f/dev/rmt/3 retension

LTo bypass the cartridge, use the mt command.

$ Mt-f/dev/rmt/1 rewind

2.tar command

The tar command is a tool program used to create and restore backup files. The Solaris System Enhances tar to make it more competent for system-level backup. It allows all or part of the files and directories to be backed up to be saved in one or more text files. In UNIX, the/dev directory of the root file system contains all the files associated with the physical device. When operating these files, they are actually operating the underlying physical devices. If the DAT or DLT drive has been connected and powered on, the drive can be automatically detected and the system will prompt whether to configure the detected drive during self-check. Select Configuration. If you do not find the drive when starting the system, it may be that the drive of the drive has been installed in the system.

Tar command format:

Tar {c | r | t | u | x} [BDeEFhilmnopPqvw @ [0-7] [bfk] [X...] [block size] [tape archive file] [size] [exclude file...] {file |-I Inclusion file |-C directory file }... the following describes common options:

LCopy files to tape

1. Enter the directory containing the file to be copied.

2. Insert the writable tape into the tape drive.

3. copy the file to the tape. The command is as follows:

$ Tar cvf/dev/rmt/n filenames

Parameter description: c indicates the archive file to be created; v indicates the name of each file during archiving;

F/dev/rmt/n indicates that the archive file should be written to the specified device or file.

Filenames indicates the file and directory to be copied. Multiple files are separated by spaces.

The system copies the specified file name to the tape and overwrites any existing files on the tape. Then, remove the tape from the tape drive. Write the file name to the tape tag.

Application Example: Copy two files in the/export/home/directory to the tape

$ Cd/export/home/

$ Ls reports

ReportA reportB

$ Tar cvf/dev/rmt/0 reports

A reports/0 tape blocks

A reports/reportA 59 tape blocks

A reports/reportB 61 tape blocks

$ Tar tvf/dev/rmt/0

  L restore files from tape

Go to the directory where the file is to be placed.

Insert the tape into the tape drive.

Restore files from tape. Run the following command:

$ Tar xvf/dev/rmt/n [filenames]

Parameter description: x indicates that files should be extracted from the specified archive file. All files on the specified tape drive will be copied to the current directory. V indicates the name of each file during recovery. F/dev/rmt/n indicates the tape device that contains the archive file. Filenames specifies the file to be restored. Multiple files are separated by spaces.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.