1. Trang chủ
  2. » Công Nghệ Thông Tin

Solaris 9 System Administrator Exam phần 5 potx

58 195 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 58
Dung lượng 1,95 MB

Nội dung

System Backups and Restores 193 Table 8.4 The tar Functions Function Description c Creates (overwrites) a tape archive r Replaces the named files in a tape archive t Lists the files in a tape archive u Updates the named files in a tape archive x Extracts all the named files from a tape archive Along with these functions, the f tar_file command-line argument is used to specify a backup device. If this command-line argument is not used, either the backup device specified by the TAPE environmental variable or the backup device identified in the /etc/default/tar file is used. The files or directories to be backed up are listed as command-line arguments after the function and argument. The v option can be used to display the names of files as they are added to or extracted from the archive. In some situations, using the tar command to create a single archive of directories and files will result in an archive that uses less space than all the original files and directories. Thus, the tar command can be used to reduce storage space requirements. Backing Up a Directory Using the tar Command The following listing shows how the tar command is used to back up the /export/home directory to the /dev/rmt/0 tape drive: # tar cf /dev/rmt/0 /export/home Restoring a Directory Using the tar Command The following listing shows the tar command being used to restore the /export/home directory from the /dev/rmt/0 tape drive: # tar xf /dev/rmt/0 The cpio Command The cpio(1) command can also be used to create an archive of directories and files. The cpio command operates in three modes: ➤ Copy out (-o command-line argument)—Reads a list of directory and filenames, and then copies their contents along with control information to an archive format. 08 8699 ch08 11/19/02 10:10 AM Page 193 Chapter 8 194 ➤ Copy in (-i command-line argument)—Reads an archive to extract the directories and files and recreates them at a specified location on the system. ➤ Pass (-p command-line argument)—Reads a list of directories/files (along with their contents) and reproduces them at a specified location on the system. Table 8.5 lists the most commonly used cpio command-line arguments. See the cpio(1) manual page for additional details. Table 8.5 Selected cpio Command-Line Arguments Argument Description -a Resets file access times (used with -i) -A Appends to the archive (used with -o) -d Creates directories as needed (used with -i and -p) -i Copies in (extracts from archive) -I file Reads contents of file as input archive (used with -i) -L Follows symbolic links (used with -o and -p) -m Retains modification times (used with -i and -p) -o Copies out (creates an archive) -O file Uses file as an output archive (used with -o) -p Passes input to output -t Prints archive table of contents—no files are created (used with -i) -u Copies files unconditionally—older files will overwrite newer files (used with -i and -p) -v Prints filenames in verbose mode The following listing shows some typical uses of the cpio command. The first cpio command uses the output of the ls command to generate a list of files to place in the file archive. The second cpio command lists the contents of archive. The third cpio command extracts files from archive. # ls file1 file2 file3 file4 # ls | cpio -ov -O archive file1 file2 file3 file4 272 blocks 08 8699 ch08 11/19/02 10:10 AM Page 194 System Backups and Restores 195 # cpio -ivt -I archive -rw-r r 1 root other 27 Apr 6 03:04 2001, file1 -rw-r r 1 root other 389 Apr 6 03:04 2001, file2 -rw-r 1 root other 34341 Apr 6 03:04 2001, file3 -rw-r r 1 root other 103306 Apr 6 03:04 2001, file4 272 blocks # cpio -ivum -I archive file1 file2 file3 file4 272 blocks # The find Command The find(1) command can be used to generate a list of files (their names) under a particular directory or a list of filenames that meet specified criteria. The find command is especially useful when combined with the cpio command. At a minimum, one command-line argument is required. That is the name of the directory. By default, the directory and all files and directories under it are also listed. The find command provides a variety of command-line arguments. Table 8.6 lists some of the more useful find command-line arguments. Table 8.6 Selected find Command-Line Arguments Argument Description -atime n List only files accessed -n (fewer than n days ago) or +n (more than n days ago). -ctime n Lists only files for which statuses changed -n (fewer than n days ago) or +n (more than n days ago). -exec cmd Executes cmd for each listed file. -group grp Lists only files that belong to the group name of GID grp. -mtime n Lists only files modified -n (fewer than n days ago) or +n (more than n days ago). -name pattern Lists only files whose name matches pattern. -newer file Lists only files that are newer than file. -print Prints the selected files (always true even if not specified). -type c Lists only the specified type of file (block, character, directory, Door, fifo, link, plain, or socket). -user usr Lists only files owned by username or UID usr. 08 8699 ch08 11/19/02 10:10 AM Page 195 Chapter 8 196 To make the find command even more powerful (and harder to determine), these command-line arguments can be combined into complex expressions using the and (-a) and the or (-o) operators. For example, the expression -type p -a -user dla will cause find to list only plain (ordinary) files owned by the user account dla. The following listing shows how the find command is used to generate a list of files. The first find command lists all files under the /export/home/sarah directory, which is used to generate the sarah.cpio archive. The second cpio command lists the files under /etc that have been modified in the last two days. The same command is repeated and used as the input cpio command to create the etc.cpio archive. # find /export/home/ambro | cpio -o -O ambro.cpio 544 blocks # find /etc -mtime -2 /etc/saf/zsmon/_pmpipe /etc/saf/_sacpipe /etc/mnttab /etc/utmppipe # find /etc/ -mtime -2 | cpio -o -O etc.cpio 16 blocks # Summary A backup strategy typically consists of a periodic full backup, supplemented by a series of incremental backups. Full backups make it easy to restore entire systems, but take a lot of time and tape. Incremental backups only back up what has been changed since the last backup. Combining the two types of backups into a strategy uses less time and less tape. The ufsdump and ufsrestore commands can be used to perform backup/restore operations on entire UFS file systems (full backup) or select- ed files/directories (incremental backups). Backups should only be per- formed on unmounted UFS file systems. To back up a mounted file system, use the fssnap command to take a snapshot of the mounted file system, and then back up the snapshot. The tar and cpio commands can be used to create archives of files and direc- tories that can be restored on other systems. The find command can be used to select the files/directories to place in the archive. 08 8699 ch08 11/19/02 10:10 AM Page 196 System Backups and Restores 197 Exam Prep Practice Questions Question 1 Which of the following can be backed up using the ufsdump command? [Select all that apply.] ❑ A. File systems on hard disks ❑ B. Files on hard disks ❑ C. File systems on CD-ROMs ❑ D. Directories on hard disks The correct answers are A, B, and D. File systems on CD-ROMs (answer C) are not UFS file systems and cannot be backed up using the ufsdump command. Question 2 Which of the following tar commands can be used to back up the /etc directory? ❍ A. tar cvf /dev/rmt/0 /etc ❍ B. tar cvf /etc /dev/rmt/0 ❍ C. tar +cvf /dev/rmt/0 /etc ❍ D. tar +cvf /etc/ dev/rmt/0 Answer A is correct. All the other answers do not use proper syntax. In answer B, the command-line arguments are in the wrong order. The proper order of command-line arguments is function, followed by the backup device, followed by the files to back up. The +c in answers C and D is incor- rect (the plus is not a valid argument). Question 3 You have to perform nightly backups (Monday through Friday) after close of business. Which of the following backup strategies would get you out of the office and home quicker? ❍ A. cumulative daily, cumulative weekly ❍ B. cumulative daily, incremental weekly ❍ C. incremental daily, cumulative weekly ❍ D. incremental daily, incremental weekly 08 8699 ch08 11/19/02 10:10 AM Page 197 Chapter 8 198 Answer D is the correct answer, because it would take less time than the other strategies listed. Any cumulative backup would take longer, because everything that has changed since the last full backup has to be written to tape. Although the incremental daily, incremental weekly is fastest, it’s not one of the best in terms of restoring data. A full system restore would require the last full backup tape, all incremental weekly tapes, and all incremental daily tapes. Question 4 Which ufsdump command-line argument can be used to estimate the size of the dump? ❍ A. s ❍ B. S ❍ C. b ❍ D. B Answer B is the correct answer. Answer A (s) is used to specify the size of the volume to be dumped. Answer C (b) is used to specify the blocking factor. Answer D (B) is not a valid answer. Question 5 Which of the following statements is true about the find / -mtime +7 -print | cpio -o -O 7days.cpio command? ❍ A. All files and directories under the / directory that have been modified seven or more days ago will be used to create the 7days.cpio archive. ❍ B. Only files under the / directory that have been modified seven or more days ago will be used to create the 7days.cpio archive. ❍ C. The command will fail because the find command-line arguments are incorrect. ❍ D. All files and directories under the / directory that have been modified seven or fewer days ago will be used to create the 7days.cpio archive. ❍ E. The command will fail because the cpio command-line arguments are incorrect. The correct answer is A. Answer B is incorrect because the specified find command will list directories as well. Answers C and E are incorrect, because 08 8699 ch08 11/19/02 10:10 AM Page 198 System Backups and Restores 199 there is nothing wrong with either the find or cpio command-line argu- ments. Answer D is incorrect because the plus (+) that precedes the number of days associated with -mtime command-line argument means “or more.” A minus (-) would imply “or less. Question 6 Which of the following commands can be used to position a tape loaded in device /dev/rmt/0n to the third data set after the tape has been rewound? [Select all that apply.] ❑ A. mt -f /dev/rmt/0n fsf 2 ❑ B. mt fsf 2 ❑ C. mt -f /dev/rmt/0n fsf 3 ❑ D. mt fsf 3 ❑ E. mt asf 3 The correct answers are A, B, and E. Answers C and D would position the tape to the beginning of the fourth data set. Question 7 Which file needs to be updated to allow remote access to a tape drive? ❍ A. /dev/rmt/0 ❍ B. /.rhosts ❍ C. /.profile ❍ D. /etc/hosts Answer B is the correct answer. Answer A (/dev/rmt/0) is the special device for the tape drive. Answer C ( /.profile) is root’s login profile. Answer D (/etc/hosts) is a file used to list the IP addresses of known systems. Question 8 In the special filename /dev/rmt/0n, what does the n refer to? The correct answer is no, as in norewind. 08 8699 ch08 11/19/02 10:10 AM Page 199 Chapter 8 200 Question 9 Which is not a valid tape drive density indicator? ❍ A. x ❍ B. c ❍ C. h ❍ D. l The correct answer is A. The x is not a valid tape drive density indicator, while c (compressed), h (high) and l (low) are valid indicators. 08 8699 ch08 11/19/02 10:10 AM Page 200 System Backups and Restores 201 Need to Know More? Mulligan, John P., Solaris 8 Essential Reference, (New Riders, Indianapolis, IN, 2001). Sun Microsystems, System Administration Guide: Basic Administration. Available in printed form, on the Web at docs.sun.com, and from the online documentation provided with the Solaris 8 operating system. Sun Microsystems, System Reference Manual, Section 1—User Commands. Available in printed form, on the Web at docs.sun.com, and from the online documentation provided with the Solaris 9 operating system. Sun Microsystems, System Reference Manual, Section 1M— Administration Commands. Available in printed form, on the Web at docs.sun.com, and from the online documentation provided with the Solaris 9 operating system. 08 8699 ch08 11/19/02 10:10 AM Page 201 08 8699 ch08 11/19/02 10:10 AM Page 202 [...]... Mask Maximum Theoretical Hosts A 1–126 255 .0.0.0 16,777,216 B 128– 191 255 . 255 .0.0 65, 536 C 192 –223 255 . 255 . 255 .0 256 The subnet mask is used to separate the network portion of an IP address from the host portion 10 8 699 ch10 11/ 19/ 02 10:13 AM Page 2 25 The Environment Solaris Network TCP/IP Configuration Files Solaris 9 uses several files to configure the... the solaris9 host: $ /usr/sbin/ping -s sparc20 60 5 PING sparc20: 60 data bytes 68 bytes from sparc20 ( 192 .168 .99 .9) : 68 bytes from sparc20 ( 192 .168 .99 .9) : 68 bytes from sparc20 ( 192 .168 .99 .9) : 68 bytes from sparc20 ( 192 .168 .99 .9) : 68 bytes from sparc20 ( 192 .168 .99 .9) : icmp_seq=0 icmp_seq=1 icmp_seq=2 icmp_seq=3 icmp_seq=4 time=1.ms time=0.ms time=0.ms time=0.ms time=0.ms sparc20 PING Statistics -5. .. in.lpd exits Supported Operating Systems Because the Solaris LP Print Service uses the Berkeley Software Distribution (BSD) protocol as defined by Request For Comment (RFC) 11 79, the following operating systems can be supported as print clients: ➤ Solaris 2.x, 7, and 8 ➤ SunOS 4.x and 5. x ➤ HP-UX ➤ Other RFC 11 79- compliant systems 09 8 699 ch 09 11/ 19/ 02 10:04 AM Page 2 05 2 05 ... The -q argument is not valid 09 8 699 ch 09 11/ 19/ 02 10:04 AM Page 218 218 Chapter 9 Need to Know More? Sun Microsystems, System Administration Guide: Advanced Administration Available in printed form, on the Web at docs.sun.com, and from the online documentation provided with the Solaris 8 operating system Sun Microsystems, System Reference Manual, Section... laser1 abc request id is laser1-27 (1 file(s)) # lpstat laser1-27 solaris! root 10281 Oct 03 15: 18 # lpstat -t scheduler is running system default destination: laser1 device for laser1: /dev/term/a device for laser2: /dev/term/b laser1 accepting requests laser2 accepting requests laser1-27 solaris! root 10281 Oct 03 15: 19 # 09 8 699 ch 09 11/ 19/ 02 10:04 AM Page 211 211 ... the /etc/inet/hosts file for other systems This allows access to the remote systems using hostnames instead of IP addresses The /etc/nodename File The /etc/nodename file contains only one entry: the default hostname of the local system The hostname or node name should be assigned in accordance with RFC 95 2, DOD Internet Host Table Specification 2 25 10 8 699 ch10 11/ 19/ 02 10:13 AM Page 226 226 Chapter... the Web at docs.sun.com, and from the online documentation provided with the Solaris 9 operating system Sun Microsystems, System Reference Manual, Section 1—User Commands Available in printed form, on the Web at docs.sun.com, and from the online documentation provided with the Solaris 8 operating system Sun Microsystems, System Reference Manual, Section 4—File Formats Available in printed form, on... print request? [Select all that apply.] ❑ A lp -i laser1- 49 -H 0 ❑ B lp -i laser1- 49 -q 0 ❑ C lp -d laser1 -q 0 file1 ❑ D lp -d laser1 -H immediate The correct answers are B, C, and D Answer A is incorrect because the -H command-line argument requires the keyword immediate to work properly 09 8 699 ch 09 11/ 19/ 02 10:04 AM Page 216 216 Chapter 9 Question... will no longer accept requests # lp -dlaser1 file laser1: requests are not being accepted # lpstat -a laser1 laser1 not accepting requests since ➥ Mon Aug 12 09: 28 :50 EDT 2002 out of paper # 09 8 699 ch 09 11/ 19/ 02 10:04 AM Page 208 208 Chapter 9 Printer usage is controlled by the enable(1) and disable(1) commands and specifying the name of a defined printer... listing shows the ping command sending one ICMP ECHO_REQUEST datagram: $ /usr/sbin/ping solaris9 solaris9 is alive $ Table 10.3 lists some of the more frequently used command-line arguments supported by the ping command 10 8 699 ch10 11/ 19/ 02 10:13 AM Page 227 The Environment Solaris Network Table 10.3 The ping Command-Line Arguments Argument Description . supported as print clients: ➤ Solaris 2.x, 7, and 8 ➤ SunOS 4.x and 5. x ➤ HP-UX ➤ Other RFC 11 79- compliant systems 09 8 699 ch 09 11/ 19/ 02 10:04 AM Page 204 Printing 2 05 Print Models A print model. archive file1 file2 file3 file4 272 blocks 08 8 699 ch08 11/ 19/ 02 10:10 AM Page 194 System Backups and Restores 1 95 # cpio -ivt -I archive -rw-r r 1 root other 27 Apr 6 03:04 2001, file1 -rw-r r 1 root other 3 89 Apr 6 03:04. For example, the terminfo entry for a Hewlett- Packard (HP) LaserJet printer is stored in the /usr/share/lib/terminfo/h/hplaserjet file. 09 8 699 ch 09 11/ 19/ 02 10:04 AM Page 2 05 Chapter 9 206 Although

Ngày đăng: 14/08/2014, 02:22

TỪ KHÓA LIÊN QUAN