Collection
zero Useful+1
zero

Tape drive

Tools for reading and writing tapes
A tape drive is a tool for reading and writing tapes. Tape drive is used to store data in the computer magnetic tape The main purpose of the device on the Data backup and file
Chinese name
Tape drive
Foreign name
tape drive
Category
Scientific and technological products
Role
Backup PC data
Operation command
Retension the tape

introduce

Announce
edit
Tape drive
Tape drive, note that when you do, it means replacement disc drive And backup all night? We are glad that such days are gone forever.
A clumsy old disk drive is not difficult to store a lot of data, and it often needs several discs to back up important data. As a senior programmer, conservative programmers start with "tape apes" to make backups.

use

Announce
edit
Note: Only one tape drive
1. Tape
mt -f /dev/rmt/0 retension
2. Rewind tape
mt -f /dev/rmt/0 rewind
3. Display Tape Drive Status
mt -f /dev/rmt/0 status
Tar command:
Use the tar command to copy files or directory trees to a single tape. Benefit: Available on UNIX systems. Disadvantages: The file system boundary is unknown. The full path name cannot exceed 255 characters. It cannot copy special files such as empty directories or device files. It cannot be used to create multiple [1] Tape volume.

Copy to tape

1) Convert to the directory containing the files to be copied.
2) Insert a writable tape into the tape drive.
3) Enter tar cvf/dev/rmt/0 filenme filename
Among them, the c (copy) option copies the specified file, the v (detailed) option displays the information about the copied file, and the f (file) option is followed by the tape device name written by the tar file. The specified file name is copied to the tape, overwriting all existing files on the tape.
Note: Using the c option to copy files to the tape will destroy all existing files on the tape. If you want to keep these files, use the r option. Can use wildcards (? *)
4) Remove the tape from the drive and write the file name on the label of the tape.

List Tape Files

1) Insert the tape into the tape drive.
2) Enter tar tvf/dev/rmt/0
The t (list) option lists the specified file, the vv (detailed) option displays all the file information, and the f (file) option is followed by the tape device name written by the tar file.

Add File Tape

1) Convert to the directory containing the files to be copied.
2) Insert a writable tape into the tape drive.
3) Enter tar rvf/dev/rmt/0 filename filename
The specified file is added to the end of the existing file on the tape.
4) Remove the tape from the drive and write the file name on the label of the tape.
Note: If you use the n (no rewind) option as a part of the tape device name, you can customize multiple [2] Tar file set to tape. Enter tar cvf/dev/rmt/0n filenae. When the file is self-made, the tape will not be wound. The next time the tape is used, the file will be written at the end of the current file set.

Write from end

1) Convert to the directory containing the files to be copied.
2) Insert a tape into the tape drive.
3) Enter 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 the tape, enter tar xvf/dev/rmt/n filename filename
Expand the specified file name from the tape and place it in the current working directory.

Directories and Subdirectories

1) Change the directory to the parent directory of the file to be self-made.
tar xvf /dev/rmt/0 filename
The filename will be restored to the current directory.
2) Enter tar xvf/dev/rmt/0 directory name to recursively copy the directory and all its subdirectories from the tape.
Cpio command: The cpio command copies files, special files, and file systems that require multiple tapes, providing compatibility from SunOS5. x to SunOS4. x systems. Benefits: It can pack data to tape more effectively than the tar command; The bad area on the tape can be skipped when restoring files; The following options for writing files in different header formats (tar ustar crc odr bar) are provided to facilitate migration between different system types; And create multiple tape volumes.
When using the cpio command to create an archive, the command obtains a list of files and pathnames from standard input and writes them to standard output. Output is usually redirected to a file or device.

Copy Catalog Tape

1) Insert a write protected open tape in the tape drive.
2) Enter ls | cpio oc>/dev/rmt/0
Where, o option copies the file; The c option writes header information in ASCII. This command overwrites all files on the tape and displays the total number of blocks.
3) Remove the tape from the drive and write the file name on the label of the tape.

List Tape Files

1) Insert the tape into the tape drive.
2) Enter cpio - civt
The i option reads the tape content; V option displays output; The t option lists the file contents on the tape in the specified drive.

Get from tape

If the archive uses a relative name, the output file is created in the current directory as a directory. If the archive is created with an absolute pathname, the full pathname is used when the file is recreated.
DANGER: Using absolute pathnames is dangerous because it may overwrite the initial file.
1) Convert to the directory where files need to be placed.
2) Insert a tape into the tape drive.
3) Enter cpio icv.

Get from tape

1) Convert to the directory where files need to be placed.
2) Insert a tape into the tape drive.
3) Enter cpio - icv "* file"
All files matching this pattern are customized to the current directory. There can be multiple modes, but each mode must be enclosed in double quotation marks.
Pax command: used to copy files, special files, or file systems that require multiple tapes. This command can also be used when copying files between the system and POSIX.

shortcoming

Announce
edit
Disadvantages: I don't know [3] System boundary The full path name cannot exceed 255 characters.
1. Copy all files in the directory to the tape
1) Convert to a directory containing files to be copied
2) Insert a write protected open tape in the tape drive.
3) Enter pax - w - f/dev/rmt/0
-The w option writes the contents of the current directory to the tape, and the - f option identifies the tape drive.
4) Enter pax - l - f/dev/rmt/0
-The - l option lists the files on the tape and verifies that the files have been copied.
5) Remove the tape from the drive and write the file name on the label of the tape.
Note: When using the pax command to copy files to a single tape, you can also use the tar command to display the file list and obtain files from the tape.
2. Get all the files on the tape
1) Convert to the directory where files need to be placed.
2) Insert a tape into the tape drive.
3) Enter pax - r - f
-The r option reads the tape content and writes it to the current directory, and the - f option identifies the tape drive.
4) Enter ls - l. Lists the files in the current directory and displays their permissions to verify file copying.

tar

1. Compress a group of files to the tar.gz suffix.
# tar cvf backup.tar /etc
#gzip -q backup.tar
or
# tar cvfz backup.tar.gz /etc/
2. Release a file with the suffix tar. gz.
#gunzip backup.tar.gz
#tar xvf backup.tar
or
# tar xvfz backup.tar.gz
3. Complete compression with one command
#tar cvf - /etc/ | gzip -qc > backup.tar.gz
4. Complete the release with one command
# gunzip -c backup.tar.gz | tar xvf -
5. How to untie tar Z file?
# tar xvfz backup.tar. Z
or
# uncompress backup.tar. Z
#tar xvf backup.tar
6. How to unlock the. tgz file?
#gunzip backup.tgz
7. How to compress and decompress the package of. bz2?
#bzip2 /etc/smb.conf
This will compress the file smb.conf into smb.conf.bz2
#bunzip2 /etc/smb.conf.bz2
This will restore smb.conf.bz2 to smb.conf in the current directory
Note: The. bz2 compression format is not very common. You can man bzip2

rpm

1. Install a package
# rpm -ivh
2. Upgrade a package
# rpm -Uvh
3. Remove a bag
# rpm -e
4. Installation parameters
--Force Force installation even if overwriting files belonging to other packages
--Nodeps If the installation of the RPM package depends on other packages, the installation will be forced even if other packages are not installed.
5. Query whether a package is installed
# rpm -q
6. Get the information of the installed package
# rpm -qi
7. List the files in the package
# rpm -ql
8. List which RPM package a file on the server belongs to
#rpm -qf
9. It can be used together with several parameters
# rpm -qil
10. List all installed rpm packages
# rpm -qa
11. List which files are included in an RPM package file that has not been installed into the system?
# rpm -qilp [4]