[EdCert previous] [EdCert next] [EdCert top]

Adding Disks with HP-UX

Once the disk has been physically installed, the system should detect the device that a new device is available on the SCSI bus. After the power to the system has been restored, press the Esc key to get to the Boot PROM prompt where Boot_Admin> is offered. At the Boot_Admin> prompt, type search:


Boot_Admin> search [return]

This will return the list of scsi devices:


Device Path             Device Type
----------------        -----------------
scsi.6.0                HP C2247
scsi.2.0                TOSHIBA CD-ROM XM-340ITA

After verifying the disk drive is detected by the Boot PROM, continue the initialization sequence by entering boot. When the boot process has completed, ensure that the drive was detected by the kernel by reviewing the kernel messages in /var/adm/syslog/syslog.log. They should look somewhat similar to the following:
Mar 19 15:21:47 bud vmunix: 2/0/1.0 tgt
Mar 19 15:21:47 bud vmunix: 2/0/1.0.0 sdisk
Mar 19 15:21:47 bud vmunix: 2/0/1.1 tgt
Mar 19 15:21:47 bud vmunix: 2/0/1.1.0 sdisk
Mar 19 15:21:47 bud vmunix: 2/0/1.6 tgt
Mar 19 15:21:47 bud vmunix: 2/0/1.6.0 sdisk
This system located three disk drives on controller 0 located at the controller device address 1 and at SCSI IDs 0, 1 and 6. Additionally, the command /usr/sbin/ioscan may be run to show further information about the disk drives detected.
# /usr/sbin/ioscan -C disk
H/W Path   Class                Description
===========================================
2/0/1.0.0               disk    HP      C2247
2/0/1.1.0               disk    HP      C2247
2/0/1.6.0               disk    SEAGATE ST31200N
If the disk device is not found, determine if the device driver needed for the disk and interface are available. If any necessary device driver is absent from the kernel, the kernel will need to be rebuilt incorperating the new driver.

Here is a brief overview of the steps to rebuild a kernel.

Device nodes

During HP-UX boot-up, /sbin/insf is executed to create the character and block device special /dev files that allow communication with the disk. HP-UX uses a somewhat standard SVR4 device file naming system. For each disk device, the following special files are created: Where card is the (SCSI) controller number, target is the SCSI ID number, and device is the logical unit number, or lun. The lun is 0 for the majority of devices. An example for a disk at controller 0, target 6, lun 0, is /dev/dsk/c0t6d0.

A disk is usually divided into file systems, areas that can hold files, or raw data areas such as swap. File systems are created in disk partitions or logical volumes. To view the size of the drive to be configured use the command, diskinfo.

# /usr/sbin/diskinfo /dev/rdsk/c0t6d0
SCSI describe of /dev/rdsk/c0t6d0:
             vendor: HP      
         product id: C3324A          
               type: direct access
               size: 1025730 Kbytes
   bytes per sector: 512
Though HP-UX does support standard (BSD) style filesystems, it is recommended that the logical volume manager (LVM) be used because of the following reasons.

More recommended reading about LVM is availbable in the Logical Volume White paper.

Creating traditional filesystems

To initialize the disk and check the disk for bad blocks the command, mediainit can be used. This is usually not necessary with HP-UX 10.x.
# mediainit /dev/rdsk/c0t1d0
The newfs command has been updated, from the 9.x version, to prompt for disk specific information, thereby overriding the information directives found in the, now obsolete, /etc/disktab file.

# newfs -F hfs /dev/rdsk/c0t5d0
mkfs (hfs): Warning - 121 sector(s) in the last cylinder are not allocated.
mkfs (hfs): /dev/rdsk/c0t5d0 - 990071 sectors in 2947 cylinders of 12 tracks, 28 sectors
1013.8Mb in 185 cyl groups (16 c/g, 5.51Mb/g, 832 i/g)
Super block backups (for fsck -b) at:
    16,   5424,  10832,  16240,  21648,  27056,  .....

Creating logical volume filesystems

The system administration tool, sam, can be used to perform most of the tasks involved with adding a new disk. Optionally, the commands to activate this disk can be given from the command line, which is demonstrated here. The physical disk drive should be added to either and an existing volume group or to a newly created volume group. These tasks are done with the commands /usr/sbin/vgextend and /usr/sbin/vgcreate respectively.

In either case pvcreate needs to run to initializes the device (a raw disk device) for use as a physical volume in a volume group.

# pvcreate /dev/rdsk/c0t5d0
Physical volume "/dev/rdsk/c0t5d0" has been successfully created.
Then to create a new volume group, the directory /dev/vg01 with the character special file called group, execute vgcreate.
#mkdir /dev/vg01
#mknod /dev/vg01/group c 64 0x010000
# vgcreate /dev/vg01 /dev/dsk/c0t5d0
Volume group "/dev/vg01" has been successfully created.
Volume Group configuration for /dev/vg01 has been saved in /etc/lvmconf/vg01.conf
Note that the last argument to the mknod command must be unique for each volume group that exists on the system.

Otherwise, to add or extend an existing volume group, executed vgextend.

# vgextend /dev/vg00 /dev/dsk/c0t5d0
Volume group "/dev/vg00" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
Utililizing the increased disk space in the volume group, create a single or multiple logical volumes that will contain filesystems. In this example a single logical volume and file system of 1 gigabyte is created.
# lvcreate -L 1000 /dev/vg00      
Logical volume "/dev/vg00/lvol9" has been successfully created with
character device "/dev/vg00/rlvol9".
Logical volume "/dev/vg00/lvol9" has been successfully extended.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf

# newfs -F hfs /dev/vg00/rlvol9
mkfs (hfs): Warning - 608 sector(s) in the last cylinder are not allocated.
mkfs (hfs): /dev/vg00/rlvol9 - 1024000 sectors in 1642 cylinders of 16 tracks, 39 sectors
1048.6Mb in 103 cyl groups (16 c/g, 10.22Mb/g, 1600 i/g)
Super block backups (for fsck -b) at:
    16,  10040,  20064,  30088,  40112,  ....

Mounting the new filesystem

Add this filesystem to the ones that are automatically mounted by system initialization, by updating the file /etc/fstab with the following entry. It specifies the device and the mount point for the filesystem.

/dev/vg00/lvol9 /usr/local hfs defaults 0 2

Mount the filesystem using the command /usr/sbin/mount -a. Check the mount table to ensure the partition was mounted and check the filesystem size with the /usr/bin/bdf command.
# mount -a
# mount
/ on /dev/vg00/lvol1 defaults on Thu May 23 08:10:01 1996
/var on /dev/vg00/lvol8 defaults on Thu May 23 08:10:14 1996
/usr on /dev/vg00/lvol7 defaults on Thu May 23 08:10:15 1996
/tmp on /dev/vg00/lvol6 defaults on Thu May 23 08:10:15 1996
/opt on /dev/vg00/lvol5 defaults on Thu May 23 08:10:15 1996
/home on /dev/vg00/lvol4 defaults on Thu May 23 08:10:15 1996
/usr/local on /dev/vg00/lvol9 defaults on Thu May 23 08:37:17 1996
# bdf /usr/local
Filesystem          kbytes    used   avail %used Mounted on
/dev/vg00/lvol9    1001729       9  901547    0% /usr/local
For more optional information about HP-UX filesystems, HFS, please review the HP-UX 10.0 HFS File System White Paper.

Terms used: disk drive.



[EdCert previous] [EdCert next] [EdCert top]