Tape and system backup operations (ufsdump, tar, cpio, DD )(

Source: Internet
Author: User
Tags rewind
Steps for adding a tape drive
  • 1   System power-off
  • 2 Check whether the SCSI address of the tape is set correctly.

 The default target ID of the tape drive is 4 (the SCSI optical drive is 6)
 If you have multiple tapes, set the second tape drive correctly so that its SCSI address does not conflict with the current address.

  • 3    Physical installation/connection to tape Devices
  • 4    -R start to discover new devices
 OK boot-R

  SCSI tape drive

  •  Unlike disks, tape devices do not need to be formatted or labeled.
  •    When a new tape device is connected to the system and found (OK. boor-R), this tape device can be used.
  •    The default target ID of the tape drive is 4.
Device SCSI address (target ID) Name of the master Logical Device Additional logical device name
First tape device  4 /Dev/RMT/0 /Dev/RMT/0l
Second tape device  5 /Dev/RMT/1
/Dev/RMT/1l
The default SCSI optical drive is  6    

   In other systems, the SCSI tape drive is/dev/nst0 (no back-to-band) And/dev/st0 (back-to-band)

  Tape device name

  •  The logical name of the tape drive starts from 0. If you have more than one tape device, the device name is:

    /Dev/RMT/0,/dev/RMT/1...

  • N ---------- non-Rewind Mode
/Dev/RMT/0n
  •    Tape Density
/Dev/RMT/0l
/Dev/RMT/0 m
/Dev/RMT/0 h
/Dev/RMT/0u
         L ---------- low
         M --------- Medium
         H --------- high
         U --------- ultra
  • B --------- multi-file tape
/Dev/RMT/0bn

If you back up multiple FS to one tape, you must add B.
B is BSD style, which is used to hold the head before or after the EOF the file.
Without B, the head is located before the file EOF. Apparently not conducive to the next file operation
Add B and the head is located after the file EOF. You can operate the next file.
When reading and writing multiple files on a tape, tools like tar do not matter where the head is on the tape.
Manual commands such as Mt are required to adjust the head position. In this case, device names such as B and n are required.

   What is the relationship between tape return and non-return (n?
If parameter n is not added, for example,/dev/RMT/0, it is automatically rewound.

Tar CVF/dev/RMT/0 oradb
Tar CVF/dev/RMT/0 Oracle
First, write a file, then automatically record it back, and then write it to the second file,
Because the front is automatically brought back to the front, it is overwritten.
Previous File

The correct method is:

Tar CVF/dev/RMT/0n oradb
Tar CVF/dev/RMT/0 Oracle
After the first file is written, it will not be automatically carried back
The second file is followed by the previous file. After writing the file, the system automatically record it back.

The same is true for read bands:

Tar xvf/dev/RMT/0n
Tar xvf/dev/RMT/0
Read the first file (oradb), without reading the first file
Then read the second file (Oracle)

This Automatic Rewinding device cannot continuously back up multiple file systems on a magnetic box.
In short, add N and write it without a rewind. You can write it next time.
           Add N. After reading the file, do not flip the tape. Next, read the next file.

 Adding bn to tar files to tape

   Display the status of a tape device

# MT-F/dev/RMT/0 status     
-F must be followed by the file name
If you have more than one tape device, the device is/dev/RMT/1,/dev/RMT/2...
# Mt status If it is not followed by-F, the default device file name is used.
If there is only one tape drive, it is no better than with-f.

You may see the following information:

Quantum dlt7000 tape drive:    The hardware is identified.
Sense key (0x0) = nosense residual = 0 retries = 0
File No = 0 Block No = 0
Sense key (0x0) = nosense
Normal access to tape
Sense key (0x6) = unit attention  Indicates that the device may be reset or the device has just been powered on.
/Dev/RMT/0: no tape loaded or drive offline Normally, the tape is not inserted,
So put the tape into the tape drive first.
No such file or directory /Dev/RMT/0 not found
It indicates that the system cannot communicate with the tape device.
Check whether the tape drive is powered on and whether the connection is normal,
Or run: OK. BOOT-R

   Tape operations (these operations are in combination with N, because if n is not used, it is automatically replayed by default, which will affect the operation)

  •    Rew

RewOperations are often performed with files with N. MT-F/dev/RMT/0 rew is unnecessary because the default value is automatic back-to-band.

# MT-F/dev/RMT/0n rew N is not automatically returned
Manual rew
  •    FSF forward, BSF backward
MT-F/dev/RMT/0n FSF 1 Moving forward
MT-F/dev/RMT/0n BSF 3 Two segments backward
  •    Offline exit tape (automatic rewind before exiting tape)
MT-F/dev/nst0 offline

===================================== Tape backup and recovery operations = ====================================

  The commands related to reading and writing data of tapes mainly include five commands: ufsdump, ufsrestore, tar, cpio, and DD.

   The ufsdump command provides different levels of dump, from 0 to 9. The dump level is used to determine which files are backed up.

  •  Level 0 specifies full dump

A full dump backs up the entire file system. It is performed at a long interval, for example, one week or one month.

  •  Level 1 incremental dump

The files modified or created after the previous low-level (0-level) dump will be backed up.
Incremental dump is more frequent, maybe once a day

   When backing up the entire system, you should first switch the system to the single-user level S.

OK boot-S
OK boot CDROM-S

For example, when the system runs Level 3, the file may be in use, which may result in invalid backup.
In addition to ufsdump/ufsrestore, when backing up the entire system using other tar and cpio, you must restart the system by a single user.

  Usage: ufsdump [0123456789 fustdwwnndccbaVlos [argument] filesystem

#/Usr/sbin/ufsdump 0 UF/dev/RMT/0/export/home           The most common BACKUP command

   Backup (full storage) Steps

  • 1) enter the single-user mode Init s
  • 2) Insert tape 
  • 3) Start backup  
#/Usr/sbin/ufsdump 0cuf/Dev/RMT/0/Dev/rdsk/cntndns0
Back up raw slice to tape
0: 0 (full) backup
C: cartridge (this parameter is optional)
U: Update file/etc/dumpdates
F: similar to the F parameter of tar, you can specify the specific device file name later.
  F is required to specify the file name/dev/RMT/0.
If multiple tapes are required for backup, The ufsdump command automatically notifies you of tape replacement.

   The ufsrestore command Copies files from the backup created by the ufsdump command to the current directory.
Copy files from the backup tape to the current directory

# Cd/newdir CD first
#/Usr/sbin/ufsrestore RVF/dev/RMT/0
Restore to the current directory

   TarBack up and restore tapes

Tar backup process Tar recovery process
$ CD xxx
$ Tar CVF/dev/RMT/0 *
$ CD xxx
$ Tar xvf/dev/RMT/0

CD first, and then default directory
 

  Lable

Tar-cvpf/dev/nst0 -- Label = "Backup set created on 'date' + % d-% B-% Y ''. "-- directory/-- exclude = var/spool/etc home usr/local var/spool

   Cpio backup to tape

Copy directory/work and all subdirectories to tape/dev/RMT/0
Copy files from the tape back to the/work directory
# Cd/work
# Ls-r | cpio-OCB>/dev/RMT/0
# Cd/work
# Cpio-ICBD </dev/RMT/0
C ---- indicates that the header information has been written in ASCII format.
B ---- This is required and indicates that the input is recorded in blocks.

  By default, the cpio-o-I command supports multi-volume backup (you can change the tape)
Cpio-ov> tape_device_name
Cpio-I [vt] <tape_device_name
Once it identifies the end of the media, it prompts you to insert another tape.

   Dd command

Dd If =/dev/RMT/0 of =/tmp/file BS = 1024
 Dd command to restore the tape file to/tmp/File

  How to view files on tape

Tar-tvf/dev/RMT/0 If it is a tar tape, it is better,
Directly treat the tape as a tar file
Ufsrestore tvf/dev/RMT/0c Tape Used for ufsdump backup
Smitty lsmksysb For system backup, you can use Smitty lsmksysb to view the tape content.

   

 This article from: http://blog.sina.com.cn/s/blog_6151984a0100fqmh.html

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.