Ufsdump Command and Ufsrestore command

Source: Internet
Author: User
Tags file system backup

I. Overview

1, backup file system reason

Backup files are one of the most important systems management features. Backups should be performed on a regular schedule to prevent data loss due to the following types of problems:

(1) System crashes

(2) accidentally delete the file

(3) Hardware failure

(4) Natural disasters, such as fires, hurricanes or earthquakes

(5) There was a problem reinstalling or upgrading the system

All file systems that are important to the user should be backed up, including frequently changed file systems.

2. You can use the Ufsdump command to perform a full or incremental backup. You can use the FSSNAP command to create a temporary image of a file system.

(1) Full backup: Copy the complete file system or directory, the system must be at the S single user level. All data is in one location and requires a large number of backup tapes for a long write time.

(2) Snapshots: Create a temporary image of the file system, the system can be in multiuser mode, and system performance may degrade when snapshots are created.

(3) Increment: Copies only those files in the specified file system that have changed since a previous backup, making it easier to retrieve small changes in the file system, and it takes a long time to find incremental tapes that contain files. You may have to return the last full backup.

3. Create incremental backups using dump level

The dump level (0–9) specified in the Ufsdump command determines the files to be backed up. Dump level 0 To create a full backup. Level 1–9 is used to plan incremental backups, but there is no clear meaning. Level 1–9 is just a series of numbers used to schedule cumulative or stand-alone backups. The only meaning that a level 1–9 has is to indicate the correlation of these numbers to each other, which indicates a larger number or a smaller number. A smaller dump number always restarts a full or cumulative backup. The following example demonstrates the flexibility of using the level 1–9 incremental dump process.

Example-dump level for daily incremental backups

In the plan shown in the following example, only the results of work on different tapes in a day are backed up. This type of backup is called a daily incremental backup. In this case, a sequential dump level number (3, 4, 5, 6) is used in a week, and a smaller number (2) is used in Friday. A smaller number in Friday will restart the processing of the backup.

Second, use the Ufsdump command to back up the file system

1, display the contents of the/etc/vfstab file.

$ more/etc/vfstab

View the mount point column that corresponds to the file system name.

When backing up your file system, use the directory names listed in the Mount point column. Cases:

$ more/etc/vfstab

#device Mount FS fsck Mount

#to mount to fsck-type pass at boot options

/dev/dsk/c0t0d0s7/dev/rdsk/c0t0d0s7/export/home UFS 2 Yes-

2. Determine the number of tapes or disk size required for a full backup

Become superuser or assume an equivalent role.

Estimate the size of the backup in bytes.

# Ufsdump [0]s File-system

If this is the first backup of the file system, use the S option to display the number of bytes required to make the backup estimate.

If it is not the first backup of the file system, use the 0S option to display the number of bytes required to make the backup estimate.

Example

# Ufsdump S/export/home

489472

3. Enter Single user mode

Become superuser or assume an equivalent role.

Bring the system into run level S (Single-user mode).

For example:

# shutdown-g30-y or # init S

Optionally, check the consistency of the file system.

For example:

# fsck-m/DEV/RDSK/C0T0D0S7

The fsck-m command checks for file system consistency. For example, a power failure might cause the file to be in an inconsistent state.

4, backup file system.

# Ufsdump Options Arguments filenames

Return the system to run level 3 by pressing the CONTROL-D key combination.

Verify that the backup is successful.

# Ufsrestore TF Device-name

5, Examples:

# init 0

OK boot-s

# Ufsdump 0ucf/dev/rmt/0/

0 specifies a level 0 dump (or full backup).

u Specifies the date that the/etc/dumpdates file will be updated for this backup.

C identifies the cassette tape device.

f/dev/rmt/0 identifies the tape device.

/represents the file system being backed up.

# Ufsrestore tf/dev/rmt/0//Check for backups made

6. View Backup

When the Ufsdump command is used in conjunction with the-u option, the/etc/dumpdates file can be maintained and updated.

Each line in the/etc/dumpdates file will display the following information:

Backed up file system

Dump level of the last backup

Sunday period, date, and time of backup

# cat/etc/dumpdates

/dev/rdsk/c0t0d0s0 0 Wed June 28 16:13:52 2004
Iii. ufsrestore Command Recovery file and file system

1, the order execution process and matters needing attention

The Ufsrestore command can copy files from a backup created using the Ufsdump command to the current working directory on disk.

You can use the Ufsrestore command to reload the entire file system hierarchy from the level 0 dump and subsequent incremental dumps.

You can also use this command to recover one or more individual files from any backup tape.

If you run the Ufsrestore command as Superuser, you can restore the file by original owner, last modified time, and mode (permissions).

When restoring files and directories, the Ufsrestore command will re-create the file hierarchy in the current working directory.

For example:

Files backed up from the/export/doc/books directory (where/export is a file system) are saved relative to/export. In other words, the Book1 file in the books directory will be saved on tape as./doc/books/book1. Thereafter, if you will. /doc/books/book1 file is restored to the/var/tmp directory, the file is restored to/var/tmp/doc/books/book1.

When you restore individual files and directories, you should restore them to a temporary location, such as the/var/tmp directory. After you verify the files, you can move them to their correct locations. However, you can restore individual files and directories to their original locations. If you do this, make sure that you do not overwrite the new file with an older version of the backup tape.

To avoid conflicts with other users, you may need to create and go to a subdirectory (such as/var/tmp/restore) to restore the file to that subdirectory.

If you want to restore the hierarchy, you should restore the files to a temporary directory, which must reside on the file system where the files will reside. Then, after restoring the file, you can use the MV command to move the entire hierarchy to which it belongs.

Note

Do not restore files in the/tmp directory, even if temporary recovery is not allowed. The/tmp directory is typically mounted as a TMPFS file system. TMPFS does not support UFS file system attributes (such as ACLs).

2, the interactive way to recover files

Go to the directory where you can temporarily restore files to.

# cd/var/tmp

Initiates an interactive recovery.

# Ufsrestore if/dev/rmt/n

Some of the prompt messages and ufsrestore> prompts are displayed.

Create a list of files to recover.

Lists the contents of the directory.

Ufsrestore> ls [directory-name]

Go to the directory.

Ufsrestore> CD Directory-name

Create a list of files and directories to recover.

ufsrestore> Add filenames

Optionally, remove any directories or files (if necessary) from the list of files to be recovered.

ufsrestore> Delete filename

(optional) Displays the file name when the file is recovered.

ufsrestore> verbose

Recover files.

Ufsrestore> Extract

The Ufsrestore command asks you for the volume number you want to use.

Type the corresponding volume number and press ENTER. If you have only one volume, type 1 and press ENTER.

Specify next Volume #: 1

The files and directories in the list are extracted and restored to the current working directory.

To maintain the mode of the current directory, enter n at the set Owner/mode prompt.

Set owner/mode for '. ' [yn] n

The Ufsrestore command must wait when it performs its last purge.

Exit the Ufsrestore program.

Ufsrestore> quit

The shell prompt is then displayed.

Verify the recovered file.

Lists the recovered files and directories.

# ls–l

A list of files and directories is displayed.

Check the list to make sure that all of the files and directories specified in the list have been restored.

Move the file to the correct directory.

The example shows how to extract/etc/passwd and/etc/shadow files from backup tapes.

# cd/var/tmp

# Ufsrestore if/dev/rmt/0

Ufsrestore> ls

Ufsrestore> CD etc

ufsrestore> Add passwd Shadow

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.