Common commands for using a tape drive under Linux tar

Source: Internet
Author: User
Tags parent directory

Tape Drive Operation Command:

Tar command:

Use the tar command to copy a file or directory tree to a single tape.

Note: Special files such as empty directories or device files cannot be copied and cannot be used to create multiple tape volumes.

1. copy Files to tape

(1) switch to a directory that contains files that need to be copied

(2) Insert a tape that can be written to the tape drive

(3) Input tar cvf/dev/rmt/0 filenme filename ...

Note: The C option copies the specified file, the V option displays information about the copied file, and the F option follows the tape device name written by the tar file. The specified file name is copied to the tape, overwriting any existing files on the tape.

Special note: Copying files to tape using the C option will destroy any files that are already on the tape. If you want to keep these files, use the R option.

2. List the files on the tape

(1) Insert the tape to the tape drive.

(2) Input tar tvf/dev/rmt/0

Note: The t option lists the specified files, the V option displays all information about the file, and the F option follows the tape device name written by the tar file.

3. Add files to tape

(1) switch to a directory that contains files that need to be copied.

(2) Insert a tape that can be written to the tape drive

(3) Input tar rvf/dev/rmt/0 filename filename ...

The specified file is added to the back of the existing file on the tape.

Note: If you use the N option as part of the tape device name, you can set up multiple tar file sets to tape. Enter the tar cvf/dev/rmt/0n Filenae, where the tape does not wrap when the file is self-contained, and the next time the tape is used, the file is written at the end of the current file set.

4. Get the end of a set of files from tape to write

1 switch to the directory that contains the files you want to copy.

2 Insert the tape in the tape drive.

3) Input tar xvf/dev/rmt/0

All files on the tape in the specified drive are copied to the current directory.

Get a single file from tape, input tar xvf/dev/rmt/n filename filename ...

Expands the specified file name from the tape into the current working directory.

5. Recursively read directories and subdirectories from tape

1) Change the directory to the parent directory of the file to be homemade

The tar xvf/dev/rmt/0 filename will restore filename to the current directory.

2 Enter the tar xvf/dev/rmt/0 directory-name, recursively copy the directory and all its subdirectories from tape.

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.