MyWebUniversity.com Home Page
 



OpenSolaris man pages main menu


System Administration Commands                          disks(1M)



NAME
     disks - creates /dev entries for hard disks attached to  the
     system

SYNOPSIS
     /usr/sbin/disks [-C] [-r rootdir]


DESCRIPTION
     devfsadm(1M) is now  the  preferred  command  for  /dev  and
     should be used instead of disks.


     disks creates symbolic links in the /dev/dsk  and  /dev/rdsk
     directories pointing to the actual disk device special files
     under the /devices directory tree. It performs the following
     steps:

         1.   disks searches the kernel device tree to  see  what
              hard disks are attached to the system. It notes the
              /devices pathnames for the slices on the drive  and
              determines    the   physical   component   of   the
              corresponding /dev/dsk or /dev/rdsk name.

         2.   The /dev/dsk and /dev/rdsk directories are  checked
              for  disk  entries  -  that is, symbolic links with
              names of the form cN[tN]dNsN, or cN[tN]dNpN,  where
              N  represents  a  decimal number. cN is the logical
              controller number, an arbitrary number assigned  by
              this  program  to  designate a particular disk con-
              troller. The first controller found  on  the  first
              occasion  this  program  is  run  on  a  system, is
              assigned number 0. tN is the bus-address number  of
              a  subsidiary  controller  attached to a peripheral
              bus such as SCSI or  IPI  (the  target  number  for
              SCSI, and the facility number for IPI controllers).
              dN is the number of the disk attached to  the  con-
              troller.  sN is the slice number on the disk. pN is
              the FDISK partition number used by fdisk(1M).  (x86
              Only)

         3.   If only some of  the  disk  entries  are  found  in
              /dev/dsk  for  a disk that has been found under the
              /devices directory tree, disks creates the  missing
              symbolic  links.  If none of the entries for a par-
              ticular disk are found in /dev/dsk, disks checks to
              see  if  any entries exist for other disks attached
              to the same controller,  and  if  so,  creates  new
              entries  using  the  same controller number as used
              for other disks on the same controller. If no other
              /dev/dsk  entries  are  found  for  slices of disks
              belonging to the same physical  controller  as  the



SunOS 5.11          Last change: 31 Oct 2008                    1






System Administration Commands                          disks(1M)



              current  disk, disks assigns the lowest-unused con-
              troller number and creates  entries  for  the  disk
              slices using this newly-assigned controller number.


     disks is run automatically each time a  reconfiguration-boot
     is  performed or when adddrv(1M) is executed. When invoking
     disks manually, first run drvconfig(1M) to  ensure  /devices
     is consistent with the current device configuration.

  Notice to Driver Writers
     disks  considers  all  devices   with   a   node   type   of
     DINTBLOCK, DINTBLOCKCHAN, DINTCD, DINTBLOCKWN
     or DINTCDCHAN to be disk  devices.  disks  requires  the
     minor name of disk devices obey the following format conven-
     tions.


     The minor name for block interfaces  consists  of  a  single
     lowercase  ASCI  character,  a  through u, representing the
     slices and the primary partitions. The minor name for  logi-
     cal  drive  block  interfaces  consists  of  the  strings p5
     through p36. The minor name for character  (raw)  interfaces
     consists of a single lowercase ASCI character, a through a,
     followed by the string ,raw, representing the slices and the
     primary partitions. The minor name for logical drive charac-
     ter (raw) interfaces consists of the string p5  through  p36
     followed by ,raw.


     disks performs the following translations:

         o    a through p to s0 through s15

         o    q through u to p0 through p4

         o    p5 through p36 to p5 through p36


     SPARC drivers should only use  the  first  eight  slices:  a
     through  h,  while  x86  drivers can use a through u, with q
     through u corresponding to fdisk(1M) primary  partitions.  q
     represents  the  entire disk, while r, s, t, and u represent
     up  to  four  additional  primary  partitions.  For  logical
     drives,  p5  to p36 correspond to the 32 logical drives that
     are supported. The device nodes for  logical  drives  change
     dynamically as and when they are created or deleted.


     To prevent disks from attempting to  automatically  generate
     links for a device, drivers must specify a private node type
     and  refrain  from  using   a   node   type:   DINTBLOCK,



SunOS 5.11          Last change: 31 Oct 2008                    2






System Administration Commands                          disks(1M)



     DINTBLOCKCHAN, DINTCD, or DINTCDCHAN when calling
     ddicreateminornode(9F).

OPTIONS
     The following options are supported:

     -C            Causes disks to remove any invalid links after
                   adding   any   new  entries  to  /dev/dsk  and
                   /dev/rdsk. Invalid links are links which refer
                   to  non-existent  disk  nodes  that  have been
                   removed, powered off, or are  otherwise  inac-
                   cessible.


     -r rootdir    Causes disks to  presume  that  the  /dev/dsk,
                   /dev/rdsk  and  /devices  directory  trees are
                   found under rootdir, not directly under /.


ERORS
     If disks finds entries of a  particular  logical  controller
     linked to different physical controllers, it prints an error
     message and exits without making any  changes  to  the  /dev
     directory, since it cannot determine which of the two alter-
     native logical-to-physical mappings is  correct.  The  links
     should  be  manually  corrected  or  removed  before another
     reconfiguration-boot is performed.

EXAMPLES
     Example 1 Creating Block and Character Minor Devices


     The following example demonstrates creating  the  block  and
     character  minor  devices  from  within  the xkdisk driver's
     attach(9E) function.


       #include    
       /*
        * Create the minor number by combining the instance number
        * with the slice number.
        */
       #define MINORNUM(i, s)   ((i) << 4  (s))

       int
       xkdiskattach(devinfot *dip, ddiattachcmdt cmd)
       {
           int instance, slice;
           char name[8];

               /* other stuff in attach... */




SunOS 5.11          Last change: 31 Oct 2008                    3






System Administration Commands                          disks(1M)



           instance = ddigetinstance(dip);
           for (slice = 0; slice < VNUMPAR; slice]) {
               /*
                * create block device interface
                */
               sprintf(name, "%c", slice ] 'a');
               ddicreateminornode(dip, name, SIFBLK,
                   MINORNUM(instance, slice), DINTBLOCKCHAN, 0);

               /*
                * create the raw (character) device interface
                */
               sprintf(name,"%c,raw", slice ] 'a');
               ddicreateminornode(dip, name, SIFCHR,
                   MINORNUM(instance, slice), DINTBLOCKCHAN, 0);
           }
       }



     Installing the xkdisk disk driver on a Sun Fire  4800,  with
     the  driver controlling a SCSI disk (target 3 attached to an
     isp(7D) SCSI  HBA)  and  performing  a  reconfiguration-boot
     (causing  disks  to  be  run)  creates the following special
     files in /devices.


       # ls -l /devices/ssm@0,0/pci@18,700000/pci@1/SUNW,isptwo@4/
       brw-r-----   1 root sys   32, 16 Aug 29 00:02 xkdisk@3,0:a
       crw-r-----   1 root sys   32, 16 Aug 29 00:02 xkdisk@3,0:a,raw
       brw-r-----   1 root sys   32, 17 Aug 29 00:02 xkdisk@3,0:b
       crw-r-----   1 root sys   32, 17 Aug 29 00:02 xkdisk@3,0:b,raw
       brw-r-----   1 root sys   32, 18 Aug 29 00:02 xkdisk@3,0:c
       crw-r-----   1 root sys   32, 18 Aug 29 00:02 xkdisk@3,0:c,raw
       brw-r-----   1 root sys   32, 19 Aug 29 00:02 xkdisk@3,0:d
       crw-r-----   1 root sys   32, 19 Aug 29 00:02 xkdisk@3,0:d,raw
       brw-r-----   1 root sys   32, 20 Aug 29 00:02 xkdisk@3,0:e
       crw-r-----   1 root sys   32, 20 Aug 29 00:02 xkdisk@3,0:e,raw
       brw-r-----   1 root sys   32, 21 Aug 29 00:02 xkdisk@3,0:f
       crw-r-----   1 root sys   32, 21 Aug 29 00:02 xkdisk@3,0:f,raw
       brw-r-----   1 root sys   32, 22 Aug 29 00:02 xkdisk@3,0:g
       crw-r-----   1 root sys   32, 22 Aug 29 00:02 xkdisk@3,0:g,raw
       brw-r-----   1 root sys   32, 23 Aug 29 00:02 xkdisk@3,0:h
       crw-r-----   1 root sys   32, 23 Aug 29 00:02 xkdisk@3,0:h,raw



     /dev/dsk will contain the disk entries to the  block  device
     nodes in /devices


       # ls -l /dev/dsk



SunOS 5.11          Last change: 31 Oct 2008                    4






System Administration Commands                          disks(1M)



       /dev/dsk/c0t3d0s0 -> ../../devices/[...]/xkdisk@3,0:a
       /dev/dsk/c0t3d0s1 -> ../../devices/[...]/xkdisk@3,0:b
       /dev/dsk/c0t3d0s2 -> ../../devices/[...]/xkdisk@3,0:c
       /dev/dsk/c0t3d0s3 -> ../../devices/[...]/xkdisk@3,0:d
       /dev/dsk/c0t3d0s4 -> ../../devices/[...]/xkdisk@3,0:e
       /dev/dsk/c0t3d0s5 -> ../../devices/[...]/xkdisk@3,0:f
       /dev/dsk/c0t3d0s6 -> ../../devices/[...]/xkdisk@3,0:g
       /dev/dsk/c0t3d0s7 -> ../../devices/[...]/xkdisk@3,0:h



     and /dev/rdsk will contain the disk entries for the  charac-
     ter device nodes in /devices


       # ls -l /dev/rdsk
       /dev/rdsk/c0t3d0s0 -> ../../devices/[...]/xkdisk@3,0:a,raw
       /dev/rdsk/c0t3d0s1 -> ../../devices/[...]/xkdisk@3,0:b,raw
       /dev/rdsk/c0t3d0s2 -> ../../devices/[...]/xkdisk@3,0:c,raw
       /dev/rdsk/c0t3d0s3 -> ../../devices/[...]/xkdisk@3,0:d,raw
       /dev/rdsk/c0t3d0s4 -> ../../devices/[...]/xkdisk@3,0:e,raw
       /dev/rdsk/c0t3d0s5 -> ../../devices/[...]/xkdisk@3,0:f,raw
       /dev/rdsk/c0t3d0s6 -> ../../devices/[...]/xkdisk@3,0:g,raw
       /dev/rdsk/c0t3d0s7 -> ../../devices/[...]/xkdisk@3,0:h,raw


FILES
     /dev/dsk/*     Disk entries (block device interface)


     /dev/rdsk/*    Disk entries (character device interface)


     /devices/*     Device special files (minor device nodes)


ATRIBUTES
     See attributes(5) for descriptions of the  following  attri-
     butes:



     
           ATRIBUTE TYPE               ATRIBUTE VALUE       
    
     Availability                 SUNWcsu                     
    


SEE ALSO
     adddrv(1M),   devfsadm(1M),    fdisk(1M),    attributes(5),
     isp(7D),       devfs(7FS),       dkio(7I),       attach(9E),



SunOS 5.11          Last change: 31 Oct 2008                    5






System Administration Commands                          disks(1M)



     ddicreateminornode(9F)


BUGS
     disks silently ignores malformed minor device names.


















































SunOS 5.11          Last change: 31 Oct 2008                    6



OpenSolaris man pages main menu

Contact us      |       About us      |       Term of use      |       Copyright © 2000-2010 MyWebUniversity.com ™