Previous Page
Next Page

Key Terms

Exercises

9.1. Adding Temporary Swap Space

In this exercise, you'll create a swap file to add additional, temporary swap space on your system.

Estimated time: 15 minutes

1.
As root, use the df -h command to locate a file system that has enough room to support a 512MB swap file.

2.
Use the mkfile command to add a 512MB swap file named swapfile in a directory, as follows:

mkfile 512m /<directory>/swapfile

3.
Use the ls -l /<directory> command to verify that the file has been created.

4.
Activate the swap area with the swap command:

/usr/sbin/swap -a /<directory>/swapfile

5.
Use the swap -l command to verify that the new swap area was added:

swap -l

6.
Use the swap -d command to remove the swap area:

swap -d /<directory>/swapfile

7.
Issue the swap -l command to verify that the swap area is gone:

swap -l

8.
Remove the swapfile that was created:

rm /<directory>/swapfile

The following two exercises require a minimum of two networked Solaris systems. You need to determine in advance which system will serve as the NFS server and which system will be the NFS client. The NFS server must have man pages installed in the /usr/share/man directory.

9.2. NFS Server Setup

In this exercise, you'll set up an NFS server to share the contents of the /usr/share/man directory for read-only access.

Estimated time: 30 minutes

1.
Make the following entry in the /etc/dfs/dfstab file:

share -F nfs -o ro /usr/share/man

2.
Restart the NFS server service to start the nfsd and mountd daemons:

svcadm restart nfs/server

3.
Verify that the NFS server service is online by typing this:

svcs nfs/server

4.
Verify that the resource is shared by typing this:

share

The system displays this:

-    /usr/share/man   ro   ""

5.
On the NFS client, rename the /usr/share/man directory so that man pages are no longer accessible:

cd /usr/share
mv man man.bkup

6.
Verify that the manual pages are no longer accessible by typing this:

man tar

7.
Create a new man directory to be used as a mount point:

mkdir man

8.
Verify that you are able to see the shared resource on the NFS server by typing this:

dfshares <nfs-server-name>

The system should display a message similar to the following:

RESOURCE                 SERVER ACCESS    TRANSPORT
192.168.0.4:/usr/share/man     192.168.0.4      -

9.
Mount the /usr/share/man directory located on the NFS server to the directory you created in step 8:

mount <nfs-server-name>:/usr/share/man \
/usr/share/man

10.
Now see if the man pages are accessible by typing this:

man tar

11.
Verify the list of mounts that the server is providing by typing this:

dfmounts <nfs-server-name>

The system should display something like this:

RESOURCE  SERVER PATHNAME                 CLIENTS
 -       192.168.0.4 /usr/share/man     192.168.0.21

12.
Unmount the directory on the NFS client:

umountall -r

The -r option specifies that only remote file system types are to be unmounted.

13.
Verify that the file system is no longer mounted by typing this:

dfmounts <nfs-server-name>

14.
On the NFS server, unshare the /usr/share/man directory:

unshare /usr/share/man

15.
On the NFS client, try to mount the /usr/share/man directory from the NFS server, as follows:

mount <nfs-server-name>:/usr/share/man \
/usr/share/man

The NFS server should not allow you to mount the file system.

16.
Check the shared resources on the NFS server by typing this:

dfshares <nfs-server-name>

The file system can no longer be mounted because it is no longer shared.

9.3. Using AutoFS

This exercise demonstrates the use of AutoFS.

Estimated time: 30 minutes

1.
The NFS server should already have an entry in the /etc/dfs/dfstab file from the previous exercise. It looks like this:

share -F nfs -o ro /usr/share/man

The nfsd and mountd daemons should also be running on this server. On the NFS client, verify that the man pages are not working by typing this:

man tar

2.
On the NFS client, remove the directory you created in Exercise 9.2:

rmdir /usr/share/man

3.
On the NFS client, edit the /etc/auto_master file to add the following line for a direct map:

/-     auto_direct

4.
On the NFS client, use vi to create a new file named /etc/auto_direct. Add the following line to the new file:

/usr/share/man    <nfs-server-name>:/usr/share/man

5.
Run the automount command to update the list of directories managed by AutoFS:

automount -v

6.
Now see if man pages are working on the NFS client by typing this:

man tar

7.
On the NFS client, use mount to see whether AutoFS automatically mounted the remote directory on the NFS server:

mount

8.
On the NFS server, unshare the shared directory by typing this:

unshareall

9.
On the NFS server, shut down the NFS server daemons:

svcadm disable nfs/server

10.
On the NFS client, edit the /etc/auto_master file and remove this line:

/-   auto_direct

11.
On the NFS client, remove the file named /etc/auto_direct:

rm /etc/auto_direct

12.
On the NFS client, run the automount command to update the list of directories managed by AutoFS:

automount -v

13.
On the NFS client, return /usr/share/man to its original state, like this:

cd /usr/share
rmdir man
mv man.bkup man

Exam Questions

1.

After you create and add additional swap space, what is the correct method to ensure the swap space is available following subsequent reboots?

  1. You can add an entry to the /etc/vfstab file.

  1. You can modify the startup scripts to include a swapadd command.

  1. Swap cannot be added; therefore, you must adjust the size of the swap partition.

  1. Additional steps are required because the necessary changes are made to the startup file when the swap space is added.


2.

Which command is used to create a swap file?

  1. cat

  1. touch

  1. mkfile

  1. swapadd

  1. newfs


3.

Which command is used to show the available swap space?

  1. prtconf

  1. iostat

  1. swap -s

  1. vmstat

  1. /usr/bin/ps


4.

How are swap areas activated each time the system boots?

  1. The entry in the /etc/vfstab file activates them.

  1. The /sbin/swapadd script activates them.

  1. The /usr/sbin/swap -a command activates them.

  1. The swapon command activates them.


5.

Which statements are true about swap areas? (Choose three.)

  1. An NFS file system can be used for a swap area.

  1. A swap file is the preferred method of adding swap space on a permanent basis.

  1. A swap file is created in any ordinary file system.

  1. You cannot unmount a file system while a swap file is in use.

  1. A swap area must not exceed 2GB on a Solaris 10 system.

  1. Using a striped metadevice for swap space is very advantageous and improves performance.


6.

If you add resources to a particular file, you can then make the resources available and unavailable by using the shareall and unshareall commands. Which of the following files is that particular file?

  1. /etc/dfs/dfstab

  1. /etc/dfs/sharetab

  1. /etc/vfstab

  1. /etc/mnttab


7.

To stop and restart NFS to enable a new share, which of the following do you use?

  1. svcadm restart autofs

  1. svcadm restart nfs/client

  1. svcadm restart nfs/server

  1. automount -v


8.

In AutoFS, which of the following associates a directory with a map?

  1. indirect

  1. direct

  1. automount

  1. automountd


9.

Which of the following maps has a full pathname and indicates the relationship explicitly?

  1. NIS

  1. auto_master

  1. indirect

  1. direct


10.

NFS daemons are started at bootup from which of the following services or files? (Choose two.)

  1. svc:/network/nfs/server

  1. svd:/network/nfs/client

  1. svc:/system/filesystem/autofs

  1. /etc/inittab


11.

Which of the following is not an NFS daemon?

  1. rpcd

  1. mountd

  1. lockd

  1. statd


12.

Which NFS daemons are found only on the NFS server? (Choose three.)

  1. nfsd

  1. lockd

  1. mountd

  1. nfslogd


13.

Which file do you use to specify the file systems that are to be shared?

  1. /etc/dfs/sharetab

  1. /etc/dfs/dfstab

  1. /etc/vfstab

  1. /etc/mnttab


14.

Which command makes a resource available for mounting?

  1. export

  1. share

  1. exportfs

  1. mount


15.

Which command displays information about shared resources that are available to the host from an NFS server?

  1. shareall

  1. share

  1. dfshares

  1. dfinfo


16.

File systems mounted with which of the following options indicate that mount is to retry in the background if the server's mount daemon (mountd) does not respond?

  1. intr

  1. fg

  1. bg

  1. soft


17.

Which of the following options to the mount command specifies how long (in seconds) each NFS request made in the kernel should wait for a response?

  1. retrans

  1. timeo

  1. retry

  1. remount


18.

File systems that are mounted read-write or that contain executable files should always be mounted with which option?

  1. hard

  1. intr

  1. soft

  1. nointr


19.

From the NFS client, which of the following options makes mount retry the request up to a specified number of times when the NFS server becomes unavailable?

  1. retry

  1. retrans

  1. remount

  1. timeo


20.

When an NFS server goes down, which of the following options to the mount command allows you to send a kill signal to a hung NFS process?

  1. bg

  1. nointr

  1. intr

  1. timeo


21.

Which of the following programs support the AutoFS service? (Choose two.)

  1. automount

  1. automountd

  1. mount

  1. share


22.

From which of the following files does automountd start?

  1. /etc/init.d/volmgt

  1. svc:/system/filesystem/autofs

  1. svc:/network/nfs/server

  1. svc:/network/nfs/client


23.

Which of the following commands do you use to see who is using a particular NFS mount?

  1. nfsstat

  1. dfshares

  1. showmount

  1. ps


24.

Which of the following files lists all direct and indirect maps for AutoFS?

  1. /etc/auto_master

  1. /etc/auto_direct

  1. /etc/auto_share

  1. /lib/svc/method/svc-autofs


25.

Every Solaris installation comes with a default master map with default entries. Without any changes to the generic system setup, clients should be able to access remote file systems through which of the following mount points?

  1. /tmp_mnt

  1. /net

  1. /export

  1. /export/home


26.

Which of the following is the simplest and most useful AutoFS map?

  1. Direct map

  1. Indirect map

  1. Master map

  1. All are equal


27.

What is the default time for automountd to unmount a file system that is not in use?

  1. 600 seconds

  1. 60 seconds

  1. 120 seconds

  1. 180 seconds


28.

What types of maps are available in AutoFS?

  1. Direct and indirect

  1. Master, direct, and indirect

  1. Master and direct

  1. Master and indirect


29.

Which of the following commands is used to cause a disk resource to be made available to other systems via NFS?

  1. mount

  1. share

  1. export

  1. dfshares


30.

Which of the following scripts or services starts up the NFS log daemon?

  1. /usr/lib/nfs/nfslogd

  1. /etc/nfs/nfslog.conf

  1. /etc/dfs/dfstab

  1. /etc/default/nfs


31.

Which of the following daemons provides NFS logging?

  1. syslogd

  1. nfsd

  1. statd

  1. nfslogd


Answers to Exam Questions

1.

A. After you create and add additional swap space, you can add an entry for that swap space in the /etc/vfstab file to ensure that the swap space is available following subsequent reboots. For more information, see the section "Setting Up Swap Space."

2.

C. You use the mkfile and swap commands to designate a part of an existing UFS as a supplementary swap area. For more information, see the section "Setting Up Swap Space."

3.

C. The swap -s command is used to display the available swap space on a system. For more information, see the section "Setting Up Swap Space."

4.

B. Swap areas are activated by the /sbin/swapadd script each time the system boots. For more information, see the section "Setting Up Swap Space."

5.

A, C, D. These statements are all true of a swap area: An NFS file system can be used for a swap area; a swap file is created in any ordinary file system; and you cannot unmount a file system while a swap file is in use. For more information, see the section "Setting Up Swap Space."

6.

A. If you execute the shareall command, any new entries in the /etc/dfs/dfstab file are shared. If you execute the unshareall command, any entries in the /etc/dfs/dfstab file are unshared. For more information, see the section "Setting Up NFS."

7.

C. To restart NFS to enable a new share, you type svcadm restart nfs/server. For more information, see the section "NFS Daemons."

8.

C. The automount command, which is called at system startup time, reads the master map file named auto_master to create the initial set of AutoFS mounts. For more information, see the section "AutoFS."

9.

D. With a direct map, there is a direct association between a mount point on the client and a directory on the server. A direct map has a full pathname and indicates the relationship explicitly. For more information, see the section "AutoFS Maps."

10.

A, B. NFS uses a number of daemons to handle its services. These services are initialized at startup from the svc:/network/nfs/server and svc:/network/nfs/client service identifiers. For more information, see the section "NFS Daemons."

11.

A. mountd, lockd, and statd are all NFS daemons. rpcd is not an NFS daemon. For more information, see the section "NFS Daemons."

12.

A, B, D. The NFS daemons found only on the NFS server are nfsd, lockd, and nfslogd. For more information, see the section "NFS Daemons."

13.

B. A shared file system is referred to as a shared resource. You specify which file systems are to be shared by entering the information in the file /etc/dfs/dfstab. For more information, see the section "Setting Up NFS."

14.

B. The share command exports a resource and makes a resource available for mounting. For more information, see the section "Setting Up NFS."

15.

C. The dfshares command displays information about the shared resources that are available to the host from an NFS server. For more information, see the section "Setting Up NFS."

16.

C. File systems mounted with the bg option indicate that mount is to retry in the background if the server's mount daemon (mountd) does not respond when, for example, the NFS server is restarted. For more information, see the section "Mounting a Remote File System."

17.

B. After the file system is mounted, each NFS request made in the kernel waits a specified number of seconds for a response (which is specified with the timeo=<n> option). For more information, see the section "Mounting a Remote File System."

18.

A. Sun recommends that file systems that are mounted as read-write or that contain executable files should always be mounted with the hard option. For more information, see the section "Mounting a Remote File System."

19.

A. From the NFS client, mount retries the request up to the count specified in the retry=<n> option. After the file system is mounted, each NFS request that is made in the kernel waits a specified number of seconds for a response. For more information, see the section "Mounting a Remote File System."

20.

C. If a file system is mounted hard and the intr option is not specified, the process hangs until the remote file system reappears if the NFS server goes down. If intr is specified, sending an interrupt signal to the process kills it. For more information, see the section "Mounting a Remote File System."

21.

A, B. File systems that are shared through the NFS service can be mounted by using AutoFS. AutoFS, a client-side service, is a file system structure that provides automatic mounting. AutoFS is initialized by automount, which is run automatically when a system is started. The automount daemon, named automountd, runs continuously, mounting and unmounting remote directories on an as-needed basis. For more information, see the section "AutoFS."

22.

B. Two programs support the AutoFS service: automount and automountd. Both are run when a system is started by the svc:/system/filesystem/autofs service identifier. For more information, see the section "AutoFS."

23.

C. To see who is using a particular NFS mount, you use the showmount command. For more information, see the section "AutoFS."

24.

A. A master map, which is in the /etc/auto_master file, associates a directory with a map. A master map is a list that specifies all the maps that AutoFS should check. For more information, see the section "AutoFS Maps."

25.

B. Without any changes to the generic system setup, clients should be able to access remote file systems through the /net mount point. For more information, see the section "AutoFS Maps."

26.

B. Indirect maps are the simplest and most useful maps. Indirect maps are useful for accessing specific file systems, such as home directories, from anywhere on the network. For more information, see the section "AutoFS Maps."

27.

A. The -t option to the automount command sets the time, in seconds, that a file system is to remain mounted if it is not being used. The default is 600 seconds. For more information, see the section "AutoFS."

28.

B. The three types of AutoFS maps are master, direct, and indirect maps. For more information, see the section "AutoFS Maps."

29.

B. The share command is used to specify a disk resource that is to be made available to other systems via NFS. share exports a resource or makes a resource available for mounting. For more information, see the section "Setting Up NFS."

30.

A. The /usr/lib/nfs/nfslogd script starts up the NFS log daemon (nfslogd). For more information, see the section "NFS Server Logging."

31.

D. The nfslogd daemon provides NFS logging and is enabled by using the log=<tag> option in the share command. When NFS logging is enabled, all NFS operations on the file system are recorded in a buffer by the kernel. For more information, see the section "NFS Server Logging."


Previous Page
Next Page