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

solaris 8 system admin ii sa 288 phần 5 doc

57 232 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

Tiêu đề Solaris 8 System Administration II
Trường học Sun Microsystems, Inc.
Chuyên ngành System Administration
Thể loại hướng dẫn
Năm xuất bản 2000
Thành phố Enterprise Services
Định dạng
Số trang 57
Dung lượng 252,7 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Upon completion of this module, you should be able to: ● Describe the CacheFS file system ● Use the appropriate commands to configure the CacheFS filesystem ● Use the appropriate command

Trang 1

32 Run theautomountcommand to update the list of directoriesmanaged by the automounter.

# automount -v

33 Remove the /usr/share/manmount point

# cd /usr/share

# rmdir man

34 Rename the/usr/share/mandirectory so you again have access

to the manual pages installed on the client system

# mv man.orig man

Trang 2

Exercise Summary

Discussion – Take a few minutes to discuss the experiences, issues, or

discoveries that you had during the lab exercises

● Experiences

● Interpretations

● Conclusions

● Applications

Trang 3

Task Solutions

On the Server Host

1 Edit the/etc/dfs/dfstabfile and add the following line in order

to share the manual pages:

On the Client Host

3 Rename the/usr/share/mandirectory so you can no longeraccess the manual pages installed on the client system

Trang 4

8 Run the command to update the list of directoriesmanaged by the automounter.

# automount -v

9 Test the configuration and verify that a mount for

/usr/share/manexists after accessing the manual pages

# man ls

< output from man command >

# mount | grep man

/usr/share/man on server:/usr/share/man read/write/remote on Fri Aug 1316:56:14 1999

Did it work?

This should automatically mount the directory where the manuals are stored Themancommand should work.

On the Server Host

10 Verify that the/export/homedirectory exists If it does not,create it

Trang 5

12 From the Edit menu, select Add In the Add User form, completethe following information:

a User Name: Your choice

b User Id: 3001

c Primary Group: Leave as 10

d Secondary Groups: Leave blank

e Comment: Your choice

f Login Shell: Your choice

g Password: Select Normal Password: Set the password to

cangetin.Skip the password aging lines

h Create Home directory: Leave as selected (do not click on thebox)

On the Client Host

15 Verify that the/export/homedirectory exists If it does not,create it

# ls /export/home

Trang 6

17 From the Edit menu, select Add In the Add User form, completethe following information:

a User Name: Same user

b User Id: Same UID as the server

c Primary Group: Same GID as the server

d Secondary Groups: Leave blank

e Comment: Your choice

f Login Shell: Same shell

g Password: Select Normal Password: Set the password to

cangetin

Skip the password aging lines

h Create Home directory: Deselect it (click on the box)

This adds a user to this system but does not create a home

directory This is correct Eventually you will use theautomount

command to mount the home directory from the server system

20 Quit Admintool

On Both Systems

21 Edit the /etc/passwdfile and change the home directory for thenew user from/export/home/usernameto /home/username.Replace usernamewith the name of your new user

22 Edit the /etc/auto_homefile Add the following line and replace

username with the name of your new user:

username server:/export/home/username

Trang 7

On the Server Host

23 Edit the/etc/dfs/dfstabfile and add the following line to sharethe/export/homedirectory:

25 Try to log in as the new user

Do both systems automatically mount the new user’s homedirectory?

Yes, this should work.

What directory is mounted, and what is the mount point:

▼ On the server?

/home/username on /export/home/username

▼ On the client?

Trang 8

Check Your Progress

Before continuing on to the next module, check that you are able toaccomplish or answer the following:

❑ List the benefits of using theautomountutility

❑ Describe the purpose of each of the types of automount maps

❑ Configure theauto_mastermap to specify which direct, indirect,and special maps theautomountddaemon reads

❑ Create theauto_directmap with the full path names and mountoptions for automatically mounting remote file resources

❑ Modify the auto_homemap as an example of an indirect mapproviding a consistent view ofhomedirectories across the network,regardless of where the user is logged in

Trang 10

Upon completion of this module, you should be able to:

● Describe the CacheFS file system

● Use the appropriate commands to configure the CacheFS filesystem

● Use the appropriate commands to check the status and consistency

of the CacheFS file system

● Set up CacheFS file system logging

● Describe the steps necessary to perform a check of the CacheFS filesystem

● List the steps to dismantle and delete a CacheFS file system

Additional Resources

Additional resources – The following references provide additional

details on the topics discussed in this module:

System Administration Guide, Volume I, Sun Part

Trang 11

CacheFS File System

You can use the CacheFS file system to improve the performance ofremote file systems (such as NFS), or slow devices, such as CD-ROMdrives

When you enable the CacheFS file system, the data read from theremote file system or CD-ROM is stored in a disk-based cache on thelocal system Subsequent read requests to the same data are fulfilled

by the local cache, which improves read performance

Note – This has no effect on the NFS server; it affects only the client.

CD-ROMNFS

Back file system

Trang 12

Using CacheFS Terminology

The following terms are used when discussing the CacheFS file

system:

● Back file system – The original disk-based, network-based, or ROM-based file system that is mounted as a CacheFS file systemand cached

CD-● Front file system – The mounted file system that is cached andaccessed by the user through the local mount point

● Consistency – Refers to the state of synchronization between theback and front file systems

Using CacheFS File System Commands

You have the following commands available for administering aCacheFS file system:

● cfsadmin– This command administers the disk space for thecached file system This includes creating, deleting, and listing thecontents of the cache

● cachefsstat– This command provides statistics on cache usage

● cachefslog– This command establishes a login procedure for thecache

● cachefswssize– This command helps determine the working setsizes for CacheFS file systems so that the cache area can be

properly sized This functions only if CacheFS logging is enabled

Trang 13

Creating a CacheFS File System

Setting up a CacheFS file system is basically a three-step procedure,illustrated in Figure 8-2

This example procedure assumes that a file system (/export/data) on

a remote system (host1) IS available to the local system The localsystem mounts the resource and caches it

Note – All commands are executed on the local system.

To set up a CacheFS file system, perform the following steps:

1 Create a cache using the following command:

Trang 14

3 Mount the remote file system and implement a CacheFS filesystem.

# mount -F cachefs -o backfstype=nfs,cachedir=/cache/cache0,\

cacheid=data_cache host1:/export/data /data

▼ The remote resource is mounted as a CacheFS file system

▼ The source file system type (backfstype) is nfs

▼ You must specify thecachedir

▼ The cacheidis optional, but it can provide a convenient defined label to identify this CacheFS mount for subsequentadministration commands

user-▼ The remote resource is host1:/export/dataand local usersaccess it through the /datamount point

4 Use themountcommand to verify the mount

# mount

/ on /dev/dsk/c0t0d0s0 read/write/setuid/largefiles on Thu May 11

15:55:34 2000

/proc on /proc read/write/setuid on Thu May 11 15:55:34 2000

/dev/fd on fd read/write/setuid on Thu May 11 15:55:34 2000

/tmp on swap read/write on Thu May 11 15:55:35 2000

Trang 15

CacheFS Cache Directory Details

Figure 8-3 illustrates areas of the underlying cache directory hierarchy:

The following describes the cache directory hierarchy:

● For each CacheFS file system being cached in the cache directory,

an entry is made in the.cfs_mnt_pointsdirectory

● If you specify a cache ID string when the CacheFS file system ismounted, this string becomes a symbolic link to the cache data forthat file system

● Local users access the cached data through the local/datamountpoint

.cfs_mnt_points

host1:_export_data

Trang 16

CacheFS Statistics and Consistency Checking

To view CacheFS file system statistics you can use the cachefsstat

command To check consistency, use the cfsadmincommand

You use cachefsstatcommand to display cache statistics It displaysinformation that describes the effectiveness of your cache

The following output shows statistics for a newly created cache:

# cachefsstat /data

/data

cache hit rate: 100% ( 8 hits, 0 misses)

consistency checks: 24 (24 pass, 0 fail)

garbage collection: 0

By default, automatic cache consistency is enabled The files in thecache are checked against the originals in the back file system (on theserver) and updates are performed on the client’s front file system The

passvalue (24 in this example) indicates the number of consistencychecks performed The failvalue (0 here) indicates the number ofupdates that have been performed

The value in the hitrate indicates the efficiency of the cache The hitsindicate the instances when the cached file was used and access to theoriginal file avoided Themissvalue indicates when there was not acached copy of the file and the back file system copy was accessed

To collect status over a specific period of time, you can first zero the

cachefscounters To zero all cachefscounters, use the followingcommand:

# cachefsstat -z

Trang 17

The demandconst Option

You can disable the automatic consistency checks by using the

demandconstoption for themountcommand (see the

mount_cachefs(1) man page for more information) This should bedone only when the back file system is static or the back and front filesystems do not need to be synchronized For example, if the back filesystem is a read-only file system on a CD-ROM, there is no need toenable consistency checking

If automatic consistency checking is disabled by using the

demandconstoption, the followingcfsadmincommand manuallyinvokes a consistency check and performs any necessary updates:

# cfsadmin -s /data

Trang 18

Enhancing CacheFS File System Caching

You can have additional control of the caching mechanism for CacheFSfile systems by doing the following:

● Set the number of data blocks used by the cache as a percentage ofthe front file system Refer to the cfsadmin(1M) man page fordetails

Note – These percentages can be enforced only if the CacheFS file

subsystem is given exclusive access to the front file system

● Set the minimum and maximum number of files that the CacheFSfile system can use as a percentage of the files in the front filesystem

The following display of cache statistics shows the default values:

▼ minblocks– Minimum amount of storage space (expressed as

a percentage of the total number of blocks in the front filesystem) that CacheFS is always allowed to use withoutlimitation by its internal control mechanisms

▼ threshblocks– A percentage of the total blocks in the frontfile system beyond which CacheFS cannot claim resourcesonce its block usage has reached the level specified by

minblocks

Trang 19

▼ maxfiles– Maximum number of files that CacheFS can use,expressed as a percentage of the total number of inodes in thefront file system.

▼ minfiles– Minimum number of files (expressed as apercentage of the total number of inodes in the front filesystem) that CacheFS is always allowed to use withoutlimitation by its internal control mechanisms

▼ threshfiles– A percentage of the total inodes in the frontfile system beyond which CacheFS cannot claim inodes onceits usage has reached the level specified by minfiles

▼ maxfilesize– Largest file size (expressed in Mbytes) thatCacheFS is allowed to cache

These parameters are specified with the-ooption, with multipleparameters separated by commas Refer to thecfsadmin(1M) manpage for more details

You can change these parameters only when you create the cache

Trang 20

Sizing the Cache

You use thecachefswssizecommand to determine the current size ofthe data in the cache This includes the amount of cache space neededfor each file system that was mounted under the cache, as well as atotal Before using thecachefswssize command, you must enable

cachefslogging Before you enable the cachefslogging, you mustcreate the directory for the log files

# mkdir /var/cachelogs

The following command creates and begins a cachefslog:

# cachefslog -f /var/cachelogs/data.log /data

/var/cachelogs/data.log: /data

In the previous command, a cache log called

/var/cachelogs/data.logwas created for the CacheFS file systemmounted locally as/data

You can change the cache log at any time The following command is

an example of changing the log file to:

Trang 21

Once you enable logging, you can check the size of the cache.

Trang 22

CacheFS File System Integrity

You use the fsck(1M) command to check and repair the integrity offile systems

To check the integrity of the CacheFS file system, perform thefollowing steps:

1 Unmount the CacheFS file system before invoking thefsck

command

# umount /data

2 Use the following command to check and repair the CacheFS filesystem:

# fsck -F cachefs -o noclean /cache/cache0

The-Foption informs thefsckcommand that the type of filesystem to check is the CacheFS file system type The-o noclean

option is used to forcefsckto perform a check even if itdetermines that a check is not necessary

3 Use the mountcommand to enable access to the repaired CacheFSfile system

# mount -F cachefs -o backfstype=nfs,cachedir=/cache/cache0,\

cacheid=data_cache host1:/export/data /data

Trang 23

Dismantling a CacheFS File System

Implementing a CacheFS file system can be an interim measure forenhancing performance You can delete a CacheFS file system andrecreate it at a later time

Note – Deleting a CacheFS file system (that is, deleting its cached

copy) has no effect on the original back file system

You can mount more than one back file system as a CacheFS filesystem and cache it in the same caching directory You can dismantleone CacheFS file system, leaving others intact You can also dismantleall the CacheFS file systems in the caching directory

To dismantle a CacheFS file system, perform the following steps:

1 If necessary, warn users that their access to the CacheFS file systemwill be interrupted

2 Determine the cache ID for the CacheFS file system you intend todelete The ID string is located in the last line of the output of thefollowing command The remainder of the output is covered later

Trang 24

4 Delete the CacheFS file system.

# cfsadmin -d data_cache /cache/cache0

Note – To delete all CacheFS file systems in the cache directory, use the

cfsadmin -d allcommand

5 If some CacheFS file systems remain after others are deleted, usethefsckcommand to correct the resource counts in the cachedirectory

# fsck -F cachefs -o noclean /cache/cache0

6 Remount the remaining CacheFS file systems

Trang 25

Exercise: Configuring the CacheFS File System

CacheFS file system

Preparation

Designate a machine in the lab that will store the man pages for clients

to mount on the CacheFS file system

Task Summary

In this exercise, you accomplish the following:

● Make a backup copy of /usr/share/manand then remove theoriginal directory

● Create a cache directory

● Mount the /usr/share/manNFS file system to your CacheFS filesystem and list the files created in your cache directory

● Check the status of the CacheFS file system and look at the size ofthe cache directory using the dfcommand

● Execute thesnoopcommand from a terminal window to capturetraffic between the server and the CacheFS system and then runthe command man lsand note the network traffic

Trang 26

Complete the following steps:

1 Move the man pages to another directory

check features

5 Use themountcommand to identify the mount that succeeded

# mount | grep man

6 List the files created in the cache directory and note the cache IDnumber

Trang 27

9 Display file system size of the cache directory usingthedfcommand.

# df -k /export/cache_dir

10 Open another terminal window and run the followingsnoop

command:

# snoop servername clientname

11 Access the /usr/share/mandirectory using the followingcommand:

Trang 28

15 Run the command to determine the maximum amount

of space in the/exportdirectory that the cache can use

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