Sun Microsystems 10 用户手册

下载
页码 121
Version 3.1-en
  Solaris 10 Container Guide - 3.1   5. Cookbooks 
Effective: 30/11/2009
For   dynamic   configuration,   the   device's   major   and   minor   number   must   be   determined.   This 
information can be obtained with the ls command in the global zone. The option -L is important here 
because it tracks symbolic links up until the actual entry in /devices:
global# cd /dev
global# ls -lL /dev/rdsk/c1t1d0s1
crw-r-----   1 root     sys      118,  1 Dec  5 19:33 rdsk/c1t1d0s1
global#
With this information, a corresponding entry can then be made in the /dev directory of the local zone 
using the command  mknod. The device type (here:  
c
 = character device) and the major and the 
minor device number must be specified (here: 118 and 1 from the ls -lL output). In a next step, the 
appropriate access privileges should be set with chmod.
global# cd ...zonepath.../dev
global# mknod rdsk/c1t1d0s1 c 118 1
global# ls -lL rdsk/c1t1d0s1
crw-r--r--   1 root     root     118,  1 Jan 29 16:06 
global# chmod o-r rdsk/c1t1d0s1
global# ls -lL rdsk/c1t1d0s1
crw-r-----   1 root     root     118,  1 Jan 29 16:06 rdsk/c1t1d0s1
Now the device is immediately visible and usable within the zone.
test# ls -l /dev/rdsk/c*
crw-r--r--   1 root root 118, 1 Jan 29 16:06/dev/rdsk/c1t1d0s1
bash-3.00 ls -l /dev/rdsk/c*
total 0
crw-r-----   1 root     root     118,  1 Jan 29 16:06 c1t1d0s1
test# reboot
For permanent use and for the purpose of documentation, the device should  also be entered in the 
zone configuration.
global# zonecfg -z test 
zonecfg:test> add device
zonecfg:test:device> set match=/dev/rdsk/c1t1d0s1
zonecfg:test:device> end
zonecfg:test> verify
zonecfg:test> commit
zonecfg:test> exit
global#
If   the   device   is  then  deleted   from   the  zone   configuration,   it   will  also  be  removed   from   the   /dev 
directory of the local zone after the next reboot. This procedure is preferable to manual removal from 
the /dev directory.
global# zonecfg -z test 
zonecfg:test> remove device match=/dev/rdsk/c1t1d0s1
zonecfg:test> verify
zonecfg:test> commit
zonecfg:test> exit
global#
77