HP-UX Disk Setup Using sdsadmin

This document is a short description of how to set up a SCSI disk under HP-UX using sdsadmin. For concreteness, I show how I configured a Seagate ST15150N 4.3GB disk on SCSI ID 4. Details may be different on your system. Consult the manual pages for sdsadmin, ioscan, diskinfo, and newfs to make sure.

Use this information at your own risk. The information below reflects only my limited experience with partitioning single disks (no striping) under HP-UX 9.05. It consists simply of the notes I wrote to remind myself of what I did.

I'm assuming the disk is already formatted; if not, you need to run mediainit after you attach it.

  1. Shut down the system, attach the disk, reboot. Be sure to use a unique SCSI ID.

  2. To verify that the system sees the disk, run this command:
        # ioscan -f
    
    For instance, on my system, for a disk at SCSI ID 4, the relevant output line looks like this:
        Class    H/W Path  Driver   H/W Status    S/W Status
        =====================================================
        disk     2.0.1.4.0 scsi     ok(0x202)     ok
    
    This means the associated device files will be /dev/dsk/c201d4sP and /dev/rdsk/c201d4sP, where P is the partition number. In general, the number after the d will be the SCSI ID.

  3. Run diskinfo to probe the disk for the information contained on it:
        # diskinfo -v /dev/rdsk/c201dNs0
    
    N is the disk SCSI ID. diskinfo output will show the vendor and product id values. For instance, for a Seagate ST15150N disk, the values are SEAGATE and ST15150N. You can use the product id value for the type and label values in the sdsadmin configuration file.

  4. Write the sdsadmin configuration file. The general form looks like this:
        type value
        label value
        partition 1
                size s1
        partition 2
                size s2
           .
           .
           .
        partition n
                size max
    
    s1, s2, etc., are the partition sizes. Use an integer followed by K, M, or G to indicate sizes in kilobytes, megabytes, or gigabytes (e.g., 300M = 300 megabytes, 2G = 2 gigabytes). The special size max for the final partition means "whatever's left" (up to the absolute maximum of about 4 gigabytes).

    The type value is written to the disk and used as the product id value for output from diskinfo, e.g., ST15150N. It may be a good idea to use unique type values, especially if the disk you're configuring isn't the first disk of a given type. For instance, you may want to use type values like ST15150N_disk2, ST15150N_disk3, etc.

    For my Seagate disk, I set it up with a 300MB partition to use for swap, followed by user file systems with sizes of 1GB, 1.6GB, and whatever is left beyond that. The size value for the 1.6GB partition is 1600M, since 1.6 is not an integer. The file looks like this:

        type ST15150N
        label ST15150N
        partition 1
                size 300M
        partition 2
                size 1G
        partition 3
                size 1600M
        partition 4
                size max
    
  5. Run sdsadmin to process the configuration file:
        # sdsadmin -m -C configfile /dev/dsk/c201dNs0
    
    configfile is the configuration filename and N is the SCSI ID of the disk to be partitioned.

    sdadmin processes the configuration file and writes an entry to /etc/disktab. The entry name is created from the type value in the configuration file with HP_ prepended to it. For the Seagate disk, the disktab entry is called HP_ST15150N and looks like this:

        HP_ST15150N|HP_ST15150Nnoreserve|HP_ST15150Nnoswap:\
            :ns#53:nt#21:nc#3769:\
            :s1#307200:b1#8192:f1#1024:\
            :s2#1048576:b2#8192:f2#1024:\
            :s3#1740800:b3#8192:f3#1024:\
            :s4#1096704:b4#8192:f4#1024:\
            :se#512:rm#7200:
    

    To see what sdadmin did, run it with the -l (list) option:

        # sdsadmin -l /dev/dsk/c201dNs0
    
    You can redo your configuration file to modify the partitions if you like, but you'll need to add the -f (force) option for a disk that's already been processed.

  6. Run newfs to create the file systems. Since I'm using partition 1 for swap, newfs is only necessary for the remaining partitions:
        # newfs -L -n -v /dev/rdsk/c201d4s2 HP_ST15150N
        # newfs -L -n -v /dev/rdsk/c201d4s3 HP_ST15150N
        # newfs -L -n -v /dev/rdsk/c201d4s4 HP_ST15150N
    
    -L = allow long filenames, -n = don't install a bootstrap program on the file system, -v = verbose (say what's going on as newfs runs). The device names the partition on which to create the file system, and the final argument is the name of the disktab entry to use.

  7. Add entries to /etc/checklist for file systems that should be mounted at boot time or used for swap partitions. To use partition 1 for swap and mount partitions 2, 3, and 4 on /usr5, /usr6, and /usr7, the entries look like this:
        /dev/dsk/c201d4s1 x     swap x        x x
        /dev/dsk/c201d4s2 /usr5 hfs  defaults 1 2
        /dev/dsk/c201d4s3 /usr6 hfs  defaults 1 2
        /dev/dsk/c201d4s4 /usr7 hfs  defaults 1 2
    
    To test the partitions, you can mount them manually:
        # mount /usr5
        # mount /usr6
        # mount /usr7
    
    To test the swap partition, try adding it to swap space manually:
        # swapon -f /dev/dsk/c201d4s1
    
    Then run swapinfo to verify that the partition is being used for swapping. Note, however, that if swapon works, you can't undo it without rebooting.

Document written by: Paul DuBois
Document last updated: 18 March 1996