免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2662 | 回复: 4
打印 上一主题 下一主题

[存储备份] AIX backup command 如何在磁带上分段备份多个文件? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2003-01-23 16:54 |只看该作者 |倒序浏览
有2 个问题:
1.第1次backup file1 file2 file3,第2次接着backup file4 fle5, how to do?
2.AIX restore command how to get 这些文件?

请教各路大侠,给出命令和步骤。

论坛徽章:
0
2 [报告]
发表于 2003-01-23 17:04 |只看该作者

AIX backup command 如何在磁带上分段备份多个文件?

1。backup命令做不到。
backup Command


Purpose
Backs up files and file systems.


Syntax

To Back Up Files by Name
backup -i [ -b Number ] [ -p [ -e RegularExpression ] ] [ -f Device ] [ -l Number ] [ -o ] [ -q ] [ -v ]


To Back Up File Systems by i-node
backup [ [ -Level ] [ -b Number ] [ -c ] [ -f Device ] [ -L Length ] [ -u ] ] [ FileSystem ] | [ -w | -W ]


Description
The backup command creates copies of your files on a backup medium, such as a magnetic tape or diskette. The copies are in one of the two backup formats:

Specific files backed up by name using the -i flag.
Entire file system backed up by i-node using the Level and FileSystem parameters.
If you issue the backup command without any parameters, it defaults to a level 9 i-node backup of the root file system to the /dev/rfd0 device. The default syntax is:


-9uf/dev/rfd0 /dev/rhd4

The default backup device is /dev/rfd0. If flags are specified that are not appropriate for the specified backup device, the backup command displays an error message and continues with the backup.

A single backup can span multiple volumes.


Notes:
Running the backup command results in the loss of all material previously stored on the selected output medium.
Data integrity of the archive may be compromised if a file is modified during system backup. Keep system activity at a minimum during the system backup procedure.
If a backup is made to a tape device with the device block size set to 0, it might be difficult to restore data from the tape unless the default write size was used with the backup command. The default write size for the backup command can be read by the restore command when the tape device block size is 0.
In other words, the -b flag should not be specified when the tape device block size is 0. If the -b flag of the backup command is specified and is different from the default size, the same size must be specified with the -b flag of the restore command when the archived files are restored from the tape.

You can use a Web-based System Manager (wsm) application to run this command. You could also use the System Management Interface Tool (SMIT) smit backup fast path to run this command.


Backing Up Files by Name
To back up by name, use the -i flag. The backup command reads standard input for the names of the files to be backed up.

File types can be special files, regular files, or directories. When the file type is a directory, only the directory is backed up. The files under the directory are not backed up, unless they are explicitly specified.


Notes:
Files are restored using the same path names as the archived files. Therefore, to create a backup that can be restored from any path, use full path names for the files that you want to back up.
When backing up files that require multiple volumes, do not enter the list of file names from the keyboard. Instead, pipe or redirect the list from a file to the backup command.
When you enter the file names from the keyboard and the backup process needs a new tape or diskette, the command "loses" any file names already entered but not yet backed up. To avoid this problem, enter each file name only after the archived message for the previous file has been displayed. The archived message consists of the character a followed by the file name.

If you specify the -p flag, only files of less than 2GB are packed.

Backing Up File Systems by i-node
To back up a file system by i-node, specify the -Level and FileSystem parameters. When used in conjunction with the -u flag, the -Level parameter provides a method of maintaining a hierarchy of incremental backups for each file system. Specify the -u flag and set the -Level parameter to n to back up only those files that have been modified since the n-1 level backup. Information regarding the date, time, and level of each incremental backup is written to the /etc/dumpdates file. The possible backup levels are 0 to 9. A level 0 backup archives all files in the file system. If the /etc/dumpdates file contains no backup information for a particular file system, specifying any level causes all files in that file system to be archived.

The FileSystem parameter can specify either the physical device name (block or raw name) or the name of the directory on which the file system is mounted. The default file system is the root (/) file system.

Users must have read access to the file system device (such as /dev/hd4) or have Backup authorization in order to perform backups by i_node.


Notes:
You must first unmount a file system before backing it up by i-node. If you attempt to back up a mounted file system, a warning message is displayed. The backup command continues, but the created backup may contain inconsistencies because of changes that may have occurred in the file system during the backup operation.
Backing up file systems by i-node truncates the uid or gid of files having a uid or gid greater than 65535. When restored, these files may have different values for the uid and gid attributes. To retain the values correctly, always back up by name files having a uid or gid greater than 65535.
You can archive only JFS (Journaled File System) file systems when backing up by i-node. Back up any non-JFS file systems by file name or by using other archive commands, such as the pax, tar, or cpio command.

Flags

-b Number  For backups by name, specifies the number of 512-byte blocks; for backups by i-node, specifies the number of 1024-byte blocks to write in a single output operation. When the backup command writes to tape devices, the default is 100 for backups by name and 32 for backups by i-node.
The write size is the number of blocks multiplied by the block size. The default write size for the backup command writing to tape devices is 51200 (100 * 512) for backups by name and 32768 (32 * 1024) for backups by i-node. The write size must be an even multiple of the tape's physical block size.

The value of the -b flag is always ignored when the backup command writes to diskette. In this case, the command always writes in clusters that occupy a complete track.

-c  Specifies that the tape is a cartridge, not a nine-track.  
-e RegularExpression  Specifies that the files with names matching the regular expression are not to be packed. A regular expression is a set of characters, meta characters, and operators that define a string or group of strings in a search pattern. It can also be a string containing wildcard characters and operations that define a set of one or more possible strings. The -e flag is applied only when the -p flag is specified.  
-f Device  Specifies the output device. To send output to a named device, specify the Device variable as a path name (such as /dev/rmt0). To send output to the standard output device, specify a - (minus sign). The - (minus) feature enables you to pipe the output of the backup command to the dd command.
You can also specify a range of archive devices. The range specification must be in the following format:



/dev/deviceXXX-YYY

where XXX and YYY are whole numbers, and XXX must always be less than YYY; for example, /dev/rfd0-3.

All devices in the specified range must be of the same type. For example, you can use a set of 8mm, 2.3GB tapes or a set of 1.44MB diskettes. All tape devices must be set to the same physical tape block size.

If the Device variable specifies a range, the backup command automatically goes from one device in the range to the next. After exhausting all of the specified devices, the backup command halts and requests that new volumes be mounted on the range of devices.

-i  Specifies that files be read from standard input and archived by file name. If relative path names are used, files are restored (with the restore command) relative to the current directory at restore time. If full path names are used, files are restored to those same names.  
-L Length  Specifies the length of the tape in bytes. This flag overrides the -c, -d, and -s flags. You can specify the size with a suffix of b, k, m, or g to represent Blocks (512 bytes), Kilo (1024 bytes), Mega (1024 Kilobytes), or Giga (1024 Megabytes), respectively. To represent a tape length of 2 Gigabytes, enter -L 2g. This flag only applies to AIX 4.2 and above.

Note: Use the -L flag for i-node backups only.  
-l Number  (lowercase L) Limits the total number of blocks to use on the diskette device. The value specified must be a non-zero multiple of the number of sectors per diskette track. This option applies to by-name backups only. See the format command for information on sectors per diskette track.  
-o  Creates a Version 2-compatible backup by name. This flag is required for compatibility with Version 2 systems because backups by name that are created by a version higher than 2 cannot be restored on Version 2 systems. To create a Version 2-compatible backup by name, use the -o flag along with other flags required for backups by name.

Files with attributes and values, such as user IDs and group IDs, that are too large for Version 2 systems will not be backed up. A message is displayed for each such file and each value that is too large.

-p  Specifies that the files be packed, or compressed, before they are archived. Only files of less than 2GB are packed.

Note: This option should only be used when backing up files from an inactive filesystem. Modifying a file when a backup is in progress may result in corruption of the backup and an inability to recover the data. When backing up to a tape device which performs compression, this option can be omitted.  
-q  Indicates that the removable medium is ready to use. When you specify the -q flag, the backup command proceeds without prompting you to prepare the backup medium and press the Enter key to continue. This option applies only to the first volume; you are prompted for subsequent volumes. The -q flag applies only to backups by name.  
-u  Updates the /etc/dumpdates file with the raw device name of the file system and the time, date, and level of the backup. You must specify the -u flag if you are making incremental backups. The -u flag applies only to backups by i-node.  
-v  Causes the backup command to display additional information about the backup. When using the -v flag, the size of the file as it exists on the archive is displayed in bytes. Additionally, a total of these file sizes is displayed when all files have been processed. Directories are listed with a size of 0. Symbolic links are listed with the size of the symbolic link. Hard links are listed with the size of the file, which is how hard links are archived. Block and character devices, if they were backed up, are listed with a size of 0.
When the -v flag is not specified, the backup command displays only the names of the files being archived. This option is used only when backing up by file name.

-w  Currently disabled. If the -w flag is specified, no other flags are applied.  
-W  Displays, for each file system in the /etc/dumpdates file, the most recent backup date and level. If the -W option is specified, no other flags are applied.  
-Level  Specifies the backup level (0 to 9). The default level is 9.  



Exit Status
This command returns the following exit values:
0  Successful completion.  
>;0  An error occurred.  



Examples
To backup all the files and subdirectories in the /home directory using full path names, enter:
find /home -print | backup -i -f /dev/rmt0
The -i flag specifies that files will be read from standard input and archived by file name. The find command generates a list of all the files in the /home directory. The files in this list are full path names. The | (pipe symbol) causes this list to be read from standard input by the backup command. The -f flag directs the backup command to write the files to the /dev/rmt0 tape device. Because the files are archived using full path names, they will be written to the same paths when restored.
To backup all the files and subdirectories in the /home/mike directory using relative path names, enter:
cd /home
find . -print | backup -i -v -q
Each file name in the list generated by the find command is preceded by ./ (dot, slash). Because the files are backed up using relative path names, they will be written to the current directory when restored. The -v flag causes the backup command to display additional information about the backup. The files are written to the default backup device /dev/rfd0.
To backup the / (root) file system, enter:
backup -0 -u -f /dev/rmt0 /
The 0 level specifies that all the files in the / (root) file system be backed up. The -u flag causes the backup command to update the /etc/dumpdates file for this backup.
To backup all the files in the / (root) file system that have been modified since the last level 0 backup, enter:
backup -1 -u -f /dev/rmt0 /
If the /etc/dumpdates file does not have an entry for a level 0 backup of the / (root) system, all the files in the file system are backed up.
To run the backup command using the System Management Interface Tool (SMIT), enter:

smit backup


Files

/etc/filesystems  Contains file system mount information.  
/etc/dumpdates  Specifies log for incremental by i-node backups.  
/dev/rfd0  Specifies default backup device.  
/dev/rhd4  Specifies device where the default file system (root) is located.  
/usr/sbin/backup  Contains the backup command.  



Related Information
The dd command, find command, rdump command, restore command.

The dumpdates file, filesystems file, rmt special file.

2。
restore Command



Purpose
Extracts files from archives created with the backup command.


Syntax

To Restore Files Archived by File Name
restore -x [ d M v q ] [ -b Number ] [ -f Device ] [ -s SeekBackup ] [ -X VolumeNumber ] [ File ... ]

restore -x [ d M v q e ] [ -b Number ] [ -f Device ] [ -s SeekBackup ] [ -X VolumeNumber ] [ File ... ]


To List Files Archived by File Name
restore -T [ q   v ] [ -b Number ] [ -f Device ] [ -s SeekBackup ]


To Restore Files Archived by File System
restore -r [ B q v y ] [ -b Number ] [ -f Device ] [ -s SeekBackup ]


To Restore Files Archived by File System
restore -R [ B v y ] [ -b Number ] [ -f Device ] [ -s SeekBackup ]


To Restore Files Archived by File System
restore -i [ h m q v y ] [ -b Number ] [ -f Device ] [ -s SeekBackup ]


To Restore Files Archived by File System
restore -x [ B h m q v y ] [ -b Number ] [ -f Device ] [ -s SeekBackup ] [ File ... ]


To List Files Archived by File System
restore -t | -T [ B h q v y ] [ -b Number ] [ -f Device ] [ -s SeekBackup ] [ File ... ]


Description
The restore command reads archives created by the backup command and extracts the files stored on them. These archives can be in either file-name or file-system format. An archive can be stored on disk, diskette, or tape. Files must be restored using the same method by which they were archived. This requires that you know the format of the archive. The archive format can be determined by examining the archive volume header information that is displayed when using the -T flag. When using the -x, -r, -T, or -t flags, the restore command automatically determines the archive format.


Note: restore actively sparses files that are being restored. If a file has block aligned and sized areas that are NULL populated, then restoredoes not cause physical space for those filesystem blocks to be allocated. The size in bytes of the file remain the same, but the actual space taken within the filesystem is only for the non-NULL areas.
Individual files can be restored from either file-name or file-system archives by using the -x flag and specifying the file name. The file name must be specified as it exists on the archive. Files can be restored interactively from file-system archives using the -i flag. The names of the files on an archive can be written to standard output using the -T flag.

Users must have write access to the file system device or have Restore authorization in order to extract the contents of the archive.

The diskette device, /dev/rfd0, is the default media for the restore command. To restore from standard input, specify a - (dash) with the -f flag. You can also specify a range of devices, such as /dev/rmt0-2.


Notes:
If you are restoring from a multiple-volume archive, the restore command reads the volume mounted, prompts you for the next volume, and waits for your response. After inserting the next volume, press the Enter key to continue restoring files.
If an archive, created using the backup command, is made to a tape device with the device block size set to 0, it may be necessary for you to have explicit knowledge of the block size that was used when the tape was created in order to restore from the tape.
Multiple archives can exist on a single tape. When restoring multiple archives from tape, the restore command expects the input device to be a no-retension-on-open, no-rewind-on-close tape device. Do not use a no-rewind tape device for restoring unless either the -B, -s, or -X flag is specified. For more information on using tape devices, see the rmt special file.

File-System Archives
File-system archives are also known as i-node archives due to the method used to archive the files. A file-system name is specified with the backup command, and the files within that file system are archived based on their structure and layout within the file system. The restore command restores the files on a file-system archive without any special understanding of the underlying structure of the file system.

When restoring file-system archives, the restore command creates and uses a file named restoresymtable. This file is created in the current directory. The file is necessary for the restore command to do incremental file-system restores.


Note: Do not remove the restoresymtable file if you perform incremental file-system backups and restores.
The File parameter is ignored when using either the -r or the -R flag.


File-Name Archives
File-name archives are created by specifying a list of file names to archive to the backup command. The restore command restores the files from a file-name archive without any special understanding of the underlying structure of the file system. The restore command allows for metacharacters to be used when specifying files for archive extraction. This provides the capability to extract files from an archive based on pattern matching. A pattern filename should be enclosed in single quotations, and patterns should be enclosed in brackets (...).


About Sparse Files
Operating system filesystems, files containing long strings of NULLs can be stored much more efficiently than other files. To be specific, if a string of NULLs spans an entire allocation block, that whole block is not stored on disk at all. Files where one or more blocks are omitted in this way are called sparse files. The missing blocks are also known as holes.


Note :Sparse files are not the same as compressed files. Sparse files are exactly the same as their non-sparse equivalents when they are read.
Sparse files are generally created by database applications. Since whenever a database file is created it is formatted with NULLs. These fragments may be either filled with allocated or unallocated NULLs.


Flags

-B  Specifies that the archive should be read from standard input. Normally, the restore command examines the actual medium to determine the backup format. When using a | (pipe), this examination cannot occur. As a result, the archive is assumed to be in file-system format, and the device is assumed to be standard input (-f -).  
-b Number  For backups done by name, specifies the number of 512-byte blocks; for backups done by i-node, specifies the number of 1024-byte blocks to read in a single output operation. When the restore command reads from tape devices, the default is 100 for backups by name and 32 for backups by i-node.
The read size is the number of blocks multiplied by the block size. The default read size for the restore command reading from tape devices is 51200 (100 * 512) for backups by name and 32768 (32 * 1024) for backups by i-node. The read size must be an even multiple of the tapes physical block size. If the read size is not an even multiple of the tapes physical block size and it is in fixed block mode (nonzero), the restore command tries to determine a valid value for Number. If successful, the restore command changes Number to the new value, writes a message about the change to standard output, and continues. If unsuccessful in finding a valid value for Number, the restore command writes an error message to standard error and exits with a nonzero return code. Larger values for the Number parameter result in larger physical transfers from the tape device.

The value of the -b flag is always ignored when the restore command reads from diskette. In this case, the command always reads in clusters that occupy a complete track.

-d  Indicates that, if the File parameter is a directory, all files in that directory should be restored. This flag can only be used when the archive is in file-name format.  
-e  Restores the non sparse files as non sparse as they were archived by the name format of backup command for both packed and unpacked files. It is necessary to know the sparseness/non-sparseness of the file(s) before archiving the files, since enabling this flag restores the sparse files as non-sparse.
This flag should be enabled only if files are to be restored are non sparse consisting of more than 4K NULLs. If the -e flag is specified during restore, it successfully restores all normal files normally and non-sparse database files as non sparse.

-f Device  Specifies the input device. To receive input from a named device, specify the Device variable as a path name (such as /dev/rmt0). To receive input from the standard output device, specify a - (minus sign). The - (minus) feature enables you to pipe the input of the restore command from the dd command.
You can also specify a range of archive devices. The range specification must be in the following format:


/dev/deviceXXX-YYY

where XXX and YYY are whole numbers, and XXX must always be less than YYY; for example, /dev/rfd0-3.

All devices in the specified range must be of the same type. For example, you can use a set of 8mm, 2.3GB tapes or a set of 1.44MB diskettes. All tape devices must be set to the same physical tape block size.

If the Device variable specifies a range, the restore command automatically goes from one device in the range to the next. After exhausting all of the specified devices, the restore command halts and requests that new volumes be mounted on the range of devices.

-h  Restores only the actual directory, not the files contained in it. This flag can only be used when the archive is in file-system format. This flag is ignored when used with the -r or -R flags.  
-i  Allows you to interactively restore selected files from a file-system archive. The subcommands for the -i flag are:

cd Directory
Changes the current directory to the specified directory.

add [File]
Specifies that the File parameter is added to the list of files to extract. If File is a directory, that directory and all the files contained in it are added to the extraction list (unless the -h flag is used). If File is not specified, the current directory is added to the extraction list.

delete [File]
Specifies that the File parameter is to be removed from the list of files to be extracted. If File is a directory, that directory and all the files contained in it are removed from the extraction list (unless the -h flag is used).

ls [Directory]
Displays the directories and files contained within the Directory parameter. Directory names are displayed with a / (slash) after the name. Files and directories, within the specified directory, that are on the extraction list are displayed with an * (asterisk) before the name. If verbose mode is on, the i-node number of the files and directories is also displayed. If the Directory parameter is not specified, the current directory is used.

extract
Restores all the directories and files on the extraction list.

pwd
Displays the full path name of the current directory.

verbose
Causes the ls subcommand to display the i-node number of files and directories. Additional information about each file is also displayed as it is extracted from the archive.

setmodes
Sets the owner, mode, and time for all directories added to the extraction list.

quit
Causes restore to exit immediately. Any files on the extraction list are not restored.

help
Displays a summary of the subcommands.  
-M  Sets the access and modification times of restored files to the time of restoration. If a restored file is an archive created by the ar command, the modification times in all the member headers are also set to the time of restoration. You can specify the -M flag only when you are restoring individually named files and only if the -x or -X flags are also specified. When the -M flag is not specified, the restore command maintains the access and modification times as they appear on the backup medium.
The -M flag is used when the data is in the AIX 4.2 backup by-i-node or by-name format.

-m  Renames restored files to the file's i-node number as it exists on the archive. This is useful if a few files are being restored and you want these files restored under a different file name. Since any restored archive members are renamed to their i-node numbers, directory hierarchies and links are not preserved. Directories and hard links are restored as regular files. The -m flag is used when the archive is in file-system format.  
-q  Specifies that the first volume is ready to use and that the restore command should not prompt you to mount the volume and hit Enter. If the archive spans multiple volumes, the restore command prompts you for the subsequent volumes.  
-r  Restores all files in a file-system archive. The -r flag is only used to restore complete level 0 backups or to restore incremental backups after a level 0 backup is restored. The restoresymtable file is used by restore to pass information between incremental restores. This file should be removed once the last incremental backup is restored. The File parameter is ignored when using the -r flag.  
-R  Requests a specific volume of a multiple-volume, file-system archive. The -R flag allows a previously interrupted restore to be restarted. The File parameter is ignored when using the -R flag. Once restarted, the restore command behavior is the same as with the -r flag.  
-s SeekBackup  Specifies the backup to seek and restore on a multiple-backup tape archive. The -s flag is only applicable when the archive is written to a tape device. To use the -s flag properly, a no-rewind-on-close and no-retension-on-open tape device, such as /dev/rmt0.1 or /dev/rmt0.5, must be specified. If the -s flag is specified with a rewind tape device, the restore command displays an error message and exits with a nonzero return code. If a no-rewind tape device is used and the -s flag is not specified, a default value of -s 1 is used. The value of the SeekBackup parameter must be in the range of 1 to 100 inclusive. It is necessary to use a no-rewind-on-close, no-retension-on-open tape device because of the behavior of the -s flag. The value specified with -s is relative to the position of the tapes read/write head and not to an archives position on the tape. For example, to restore the first, second, and fourth backups from a multiple-backup tape archive, the respective values for the -s flag would be -s 1, -s 1, and -s 2.  
-t  Displays information about the backup archive. If the archive is in file-system format, a list of files found on the archive is written to standard output. The name of each file is preceded by the i-node number of the file as it exists on the archive. The file names displayed are relative to the root (/) directory of the file system that was backed up. If the File parameter is not specified, all the files on the archive are listed. If the File parameter is used, then just that file is listed. If the File parameter refers to a directory, all the files contained in that directory are listed. If the archive is in file-name format, information contained in the volume header is written to standard output. This flag can be used to determine if the archive is in file-name or file-system format.  
-T  Displays information about the backup archive. If the archive is in file-name format, the information contained in the volume header and a list of files found on the archive are written to standard output. The File parameter is ignored for file-name archives. If the archive is in file-system format, the behavior is identical to the -t flag.  
-v  Displays additional information when restoring. If the archive is in file-name format and either the -x or -T flag is specified, the size of the file as it exists on the archive is displayed in bytes. Directory, block, or character device files are archived with a size of 0. Symbolic links are listed with the size of the symbolic link. Hard links are listed with the size of the file, which is how they are archived. Once the archive is read, a total of these sizes is displayed. If the archive is in file-system format, directory and nondirectory archive members are distinguished.  
-x  Restores individually named files specified by the File parameter. If the File parameter is not specified, all the archive members are restored. If the File parameter is a directory and the archive is in file-name format, only the directory is restored. If the File parameter is a directory and the archive is in file-system format, all the files contained in the directory are restored. The file names specified by the File parameter must be the same as the names shown by the restore -T command. Files are restored with the same name they were archived with. If the file name was archived using a relative path name (./filename), the file is restored relative to the current directory. If the archive is in file-system format, files are restored relative to the current directory.
The restore command automatically creates any needed directories. When using this flag to restore file-system backups, you are prompted to enter the beginning volume number.

The restore command allows for shell-style pattern matching metacharacters to be used when specifying files for archive extraction. The rules for matching metacharacters are the same as those used in shell pathname "globbing," namely:


* (asterisk)
Matches zero or more characters, but not a '.' (period) or '/' (slash).

? (question mark)
Matches any single character, but not a '.' (period) or '/' (slash).

[ ] (brackets)
Matches any one of the characters enclosed within the brackets. If a pair of characters separated by a dash are contained within the brackets, the pattern matches any character that lexically falls between the two characters in the current local. Additionally, a '.' (period) or a '/' (slash) within the brackets will not match a a '.' (period) or a '/' (slash) in a file name.

\ (backslash)
Matches the immediately following character, preventing its possible interpretation as a metacharacter.  
-X VolumeNumber  Begins restoring from the specified volume of a multiple-volume, file-name backup. Once started, the restore command behavior is the same as with the -x flag. The -X flag applies to file-name archives only.  
-y  Continues restoring when tape errors are encountered. Normally, the restore command asks you whether or not to continue. In either case, all data in the read buffer is replaced with zeroes. The -y flag applies only when the archive is in file-system format.  
-?  Displays a usage message.  



Exit Status
This command returns the following exit values:
0  Successful completion.  
>;0  An error occurred.  



Examples
To list the names of files in either a file-name or file-system archive on the diskette device /dev/rfd0, type:

restore -Tq

The archive is read from the /dev/rfd0 default restore device. The names of all the files and directories contained in the archive are displayed. For file-system archives, the file name is preceded by the i-node number of the file as it exists on the archive. The -q flag tells the restore command that the first volume is available and is ready to be read. As a result, you are not prompted to mount the first volume.

To restore a specific file, type:

restore -xvqf myhome.bkup system.data

This command extracts the file system.data into the current directory from the archive myhome.bkup. The archive in this example is in the current directory. File and directory names must be specified as they are displayed when using the -T flag. The -v flag displays additional information during the extraction. This example applies to both file-name and file-system archives.

To restore a specific directory and the contents of that directory from a file-name archive, type:

restore -xdvqf /dev/rmt0 /home/mike/tools

The -x flag tells restore to extract files by their file name. The -d tells restore to extract all the files and subdirectories in the /home/mike/tools directory. File and directory names must be specified as they are displayed when using the -T flag. If the directories do not exist, they are created.

To restore a specific directory and the contents of that directory from a file-system archive, type:

restore -xvqf /dev/rmt0 /home/mike/tools

This command extracts files by file name. File and directory names must be specified as they are displayed when using the -T flag. If the directories do not exist, they are created.

To restore an entire file-system archive, type:

restore -rvqf /dev/rmt0

This command restores the entire file system archived on the tape device, /dev/rmt0, into the current directory. This example assumes you are in the root directory of the file system to be restored. If the archive is part of a set of incremental file-system archives, the archives should be restored in increasing backup-level order beginning with level 0 (for example, 0, 1, 2).

To restore the fifth and ninth backups from a single-volume, multiple-backup tape, type:

restore -xvqs 5 -f/dev/rmt0.1
restore -xvqs 4 -f/dev/rmt0.1

The first command extracts all files from the fifth archive on the multiple-backup tape specified by /dev/rmt0.1. The .1 designator specifies the tape device will not be retensioned when it is opened and that it will not be rewound when it is closed. It is necessary to use a no-rewind-on-close, no-retension-on-open tape device because of the behavior of the -s flag. The second command extracts all the files from the fourth archive (relative to the current location of the tape head on the tape). After the fifth archive has been restored, the tape read/write head is in a position to read the archive. Since you want to extract the ninth archive on the tape, you must specify a value of 4 with the -s flag. This is because the -s flag is relative to your position on the tape and not to an archives position on the tape. The ninth archive is the fourth archive from your current position on the tape.

To restore the fourth backup, which begins on the sixth tape on a 10-tape multiple-backup archive, put the sixth tape into the tape drive and type:

restore -xcs 2 -f /dev/rmt0.1 /home/mike/manual/chap3

Assuming the fourth backup is the second backup on the sixth tape, specifying -s 2 advances the tape head to the beginning of the second backup on this tape. The restore command then restores the specified file from the archive. If the backup continues onto subsequent volumes and the file has not been restored, the restore command instructs you to insert the next volume until the end of the backup is reached. The -f flag specifies the no-rewind, no-retension tape device name.


Note: The -s flag specifies the backup number relative to the tape inserted in the tape drive, not to the overall 10-tape archive.
To improve the performance on streaming tape devices, pipe the dd command to the restore command by typing:

dd if=/dev/rmt0 bs=64b | restore -xf- -b64

The dd command reads the archive from the tape using a block size of 64 512-byte blocks and writes the archive to standard output. The restore command reads the standard input using a block size of 64 512-byte blocks. The value of the block size used by the dd command to read the archive from the tape must be an even multiple of the block size that was used to create the tape with the backup command. For example, the following backup command could be used to create the archive that this example extracts:

find /home -print | backup -ivqf/dev/rmt0 -b64

This example applies to archives in file-name format only. If the archive was in file-system format, the restore command should include the -B flag.

To improve the performance of the restore command on the 9348 Magnetic Tape Unit Model 12, you can change the block size by typing:

chdev -l DeviceName -a BlockSize=32k

To restore non sparse database files, type:

restore  -xef  /dev/rmt0

To restore files that were sparse before archive as sparse, type:

restore  -xf  /dev/rmt0


Files

/dev/rfd0  Specifies the default restore device.  
/usr/sbin/restore  Contains the restore command.  



Related Information
The ar command, backup command, mkfs command, fsck command, dd command.

The filesystems file, backup file, rmt special file.

论坛徽章:
0
3 [报告]
发表于 2003-01-23 17:18 |只看该作者

AIX backup command 如何在磁带上分段备份多个文件?

thank “老农”。

有其它办法吗?
我把backup. tctl. /dev/rmtx.x结合着用,试的晕头转向,又每个文件>;2G, 好象只有backup 支持>;2G。

论坛徽章:
0
4 [报告]
发表于 2003-01-23 19:12 |只看该作者

AIX backup command 如何在磁带上分段备份多个文件?

man pax
其实tar也支持>;2G文件的。tar -rvf就是追加。

论坛徽章:
0
5 [报告]
发表于 2003-01-24 09:24 |只看该作者

AIX backup command 如何在磁带上分段备份多个文件?

原帖由 "老农a" 发表:

其实tar也支持>;2G文件的。tar -rvf就是追加。

thank you!
据我所知,tar 和cpio 都不支持>;2G,有好几次失败的经验,不知是否是我理解错了,请指教。
可能是我没有把问题说清楚,我的意思是通过磁带控制,可以取出第2次存到磁带的文件,或者说,是按日期备份每批文件的,可以按日期取出。不同日期可能有相同的文件名,tar -rvf 区分不出。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP