C H A P T E R  4

Using the hd Utility on Linux

This chapter describes how to use the hd utility, also known as hdtool on Linux. The hd utility is a hard drive mapping tool used to determine the logical-to-physical device mapping and can be used on the Sun Fire X4500/X4540 servers.

This chapter includes the following sections:


Installing the hd Utility

You can install the utility from the Tools and Drivers CD, if available. The hd utility is also available on the server product download page and resides in the Tools and Drivers CD in the /solaris/tools/hdtool/ directory

You can install the utility from the Tools and Drivers CD, if available, or from your product Tools and Drivers CD image, downloadable from the product web page.

The Linux version of the hd utility resides in the /linux/tools/hdtool/ directory.



Tip - On the Sun Fire X4500/X4540 servers, the hd utility is included in the SUNWhd package preinstalled in /opt/SUNWhd/hd/bin/hd.



Once you have downloaded hd, from a command line, go to its directory and type:

> hd


Running the hd Utility on Linux

You use the utility to get a logical-to-physical mapping of the devices. This mapping can help you to administer the system, manage the hard drives, and troubleshoot the server.

The hd utility works with existing Linux disk maintenance, configuration, and administration commands like cfgdisk.

The hd utility provides a color-coded hard drive location map. It has the following functions:

To use hd utility you must have the hd package installed. For additional commands related to hd, see the following man pages for additional commands: cfgdisk, hd,and hdadm.


Viewing the hd Utility Drive Mapping Output

You can use the drive mapping output from hd utility for remote analysis. The utility probes and displays the available storage devices in the system.

The hd utility output makes the distinction between controllers, slots, and storage devices that are physically present in the machine and visible to Linux.

This chapter includes the following sections:

Viewing the Hard Drive Map Using the hd Command

The hd utility maps the disks and produces output that can help you to identify empty slots and drives that have not been enumerated.

The following command displays a map of the disk drives.


# hd

For example, here is output for the Sun Fire X4500 server that includes a list of drives, format and vendor, followed by a mapping table.


% hd
platform = SUN FIRE X4500
 
sdaa    ATA      HITACHI HDS7250  K2AO sdab    ATA      HITACHI HDS7250  K2AO sdac    ATA      HITACHI HDS7250  K2AO sdad    ATA      HITACHI HDS7250  K2AO sda     ATA      HITACHI HDS7250  K2AO sdae    ATA      HITACHI HDS7250  K2AO sdaf    ATA      HITACHI HDS7250  K2AO sdag    ATA      HITACHI HDS7250  K2AO sdah    ATA      HITACHI HDS7250  K2AO sdai    ATA      HITACHI HDS7250  K2AO sdaj    ATA      HITACHI HDS7250  K2AO sdak    ATA      HITACHI HDS7250  K2AO sdal    ATA      HITACHI HDS7250  K2AO sdam    ATA      HITACHI HDS7250  K2AO sdan    ATA      HITACHI HDS7250  K2AO sdao    ATA      HITACHI HDS7250  K2AO sdap    ATA      HITACHI HDS7250  K2AO sdaq    ATA      HITACHI HDS7250  K2AO sdar    ATA      HITACHI HDS7250  K2AO sdas    ATA      HITACHI HDS7250  K2AO sdat    ATA      HITACHI HDS7250  K2AO sdau    ATA      HITACHI HDS7250  K2AO sdav    ATA      HITACHI HDS7250  K2AO sdb     ATA      HITACHI HDS7250  K2AO sdc     ATA      HITACHI HDS7250  K2AO sdd     ATA      HITACHI HDS7250  K2AO sde     ATA      HITACHI HDS7250  K2AO sdf     ATA      HITACHI HDS7250  K2AO sdg     ATA      HITACHI HDS7250  K2AO sdh     ATA      HITACHI HDS7250  K2AO sdi     ATA      HITACHI HDS7250  K2AO sdj     ATA      HITACHI HDS7250  K2AO sdk     ATA      HITACHI HDS7250  K2AO sdl     ATA      HITACHI HDS7250  K2AO sdm     ATA      HITACHI HDS7250  K2AO sdn     ATA      HITACHI HDS7250  K2AO sdo     ATA      HITACHI HDS7250  K2AO sdp     ATA      HITACHI HDS7250  K2AO sdq     ATA      HITACHI HDS7250  K2AO sdr     ATA      HITACHI HDS7250  K2AO sds     ATA      HITACHI HDS7250  K2AO sdt     ATA      HITACHI HDS7250  K2AO sdu     ATA      HITACHI HDS7250  K2AO sdv     ATA      HITACHI HDS7250  K2AO sdw     ATA      HITACHI HDS7250  K2AO sdx     ATA      HITACHI HDS7250  K2AO sdy     ATA      HITACHI HDS7250  K2AO sdz     ATA      HITACHI HDS7250  K2AO

Viewing the Hard Drive Map Using the hdadm display Command

The following command displays a map of the disk drives:


# hdadm display

Here is an example of using the hdadm command to display the hard drive’s physical slot number, logical name, and status:


# hdadm display
------------------------Sun Fire X4500 Server--------Rear-----------
36:   37:   38:   39:   40:   41:   42:   43:   44:   45:   46:   47:
sdab  sdaf  sdt   sdx   sdar  sdav  sdaj  sdan  sdl   sdp   sdd   sdh
^++   ^++   ^++   ^++   ^++   ^++   ^++   ^++   ^++   ^++   ^++   ^++
24:   25:   26:   27:   28:   29:   30:   31:   32:   33:   34:   35:
sdaa  sdae  sds   sdw   sdaq  sdau  sdai  sdam  sdk   sdo   sdc   sdg
^++   ^++   ^++   ^++   ^++   ^++   ^++   ^++   ^++   ^++   ^++   ^++
12:   13:   14:   15:   16:   17:   18:   19:   20:   21:   22:   23:
sdz   sdad  sdr   sdv   sdap  sdat  sdah  sdal  sdj   sdn   sdb   sdf
^++   ^++   ^++   ^++   ^++   ^++   ^++   ^++   ^++   ^++   ^++   ^++
0:    1:    2:    3:    4:    5:    6:    7:    8:    9:   10:   11:
sdy   sdac  sdq   sdu   sdao  sdas  sdag  sdak  sdi   sdm  sda   sde 
^b+   ^b+   ^++   ^++   ^++   ^++   ^++   ^++   ^++   ^++   ^++   ^++
-------*-----------*----Sun Fire X4500 Server----*---Front-----*----

Viewing the Disk Controllers and Bootable Drives

The Sun Fire X4500/X4540 server comes with six controllers, each supporting up to eight SATA drives, for a total of 48 SATA drives. Before you reinstall the Linux OS, you need to determine the logical device name that corresponds to the two bootable disks, which is in the form:

sdX

Where sdX is the SCSI disk name.

A Sun Fire X4500/X4540 server with 48 disks is the only supported configuration. For the Sun Fire X4500 server, the boot device nodes are in:

For the Sun Fire X4540 server, the boot device notes are in:

These are the bootable disks, and the operating system must be installed on one of these device nodes.

Use the hd command parameters to determine the status of a hard drive. The command parameters and the information they display are shown in TABLE 4-1.The hd output can also help you identify the empty slots and drives that have not been recognized by the Linux operating system.

Viewing Hard Disk Drive Status

Use the hd command parameters to determine the status of a hard drive. The command parameters and the information they display are shown in TABLE 4-1.


TABLE 4-1   hd Utility Command Options on Linux
Option Description
-c Maps and displays a status of all hard disks in color mode.

There are three status rows for each device:

  • Physical slot/location that matches the chassis label.

  • Logical location that matches Linux Storage device name.

  • sdX drive runtime status.

The following syntax is used:

  • Up arrow (^): Indicates the device.

  • Green: Device enumerated.

  • ++: Device is present and accessible.

  • Red: Device not enumerated or no drive in physical slot/location.

  • --: Device is not accessible, absent/empty or down.

  • .: Devices under the controller are not enumerated. The controller is not enumerated until there is a drive in the slots.

  • ##: Device has warning messages from the storage subsystem.

  • Blue: Bootable drive slot.

  • b: Drive slot is bootable if an OS is installed on the drive.

-s Gives summarized version.
-B Lists bootable slot number, devname with present/absent status.
-q This option is for the Sun Fire X4500/X4540 server only.

It provides a list of the hard drive physical slot numbers, logical names, and status (present or absent). This option is useful for scripting environments.

For example, some applications could include hd -q in noninteractive mode to determine if a specific drive in a specific physical slot is accessible before configuring RAID.

-r Lists SMART data for all disks in drive slot number for Sun Fire X4540.
-R Lists SMART data per individual ID in landscape mode for all disks.
-e sdXY Lists SMART data for specified drive for Sun Fire X4540.
-E sdXY Lists raw hex SMART data for specified drive for Sun Fire X4540.
-h Provides utility help information.
-j Lists Sun Fire X4500/X4540 controller number.
-o Lists Sun Fire X4540 HBA/Target sdname sysfs.
-V Displays the utility version.
-x Generates hd_map.html.


Viewing the Hard Drives in Sequential Order

The following command displays the drive’s physical slot number, logical name, and status (present or absent) in sequential order.

# hd -q

Here is sample output for the Sun Fire X4500 server:


Physical Slot Number         Name                         Status
0                            sdy                           present 1                            sdac                          present 2                            sdq                           present 3                            sdu                           present 4                            sdao                          present 5                            sdas                          present 6                            sdag                          present 7                            sdak                          present 8                            sdi                           present 9                            sdm                           present 10                           sda                           present 11                           sde                           present 12                           sdz                           present 13                           sdad                          present 14                           sdr                           present 15                           sdv                           present 16                           sdap                          present 17                           sdat                          present 18                           sdah                          present 19                           sdal                          present 20                           sdj                           present 21                           sdn                           present 22                           sdb                           present 23                           sdf                           present 24                           sdaa                          present 25                           sdae                          present 26                           sds                           present 27                           sdw                           present 28                           sdaq                          present 29                           sdau                          present 30                           sdai                          present 31                           sdam                          present 32                           sdk                           present 33                           sdo                           present 34                           sdc                           present 35                           sdg                           present 36                           sdab                          present 37                           sdaf                          present 38                           sdt                           present 39                           sdx                           present 40                           sdar                          present 41                           sdav                          present 42                           sdaj                          present 43                           sdan                          present 44                           sdl                           present 45                           sdp                           present 46                           sdd                           present 47                           sdh                           present

Viewing the hd Command Help Options

The following command displays utility help.


# hd -h
 
# hd -h Usage: hd [ -c(olor mode) ] [ -s(ummary) ]
 [ -B (list Bootable slot number, devname with present/absent status) ]
 [ -q (list drive slot number in seQuential list) ]
 [ -r (List SMART data for all disks in drive slot number for x4540) ]
 [ -R (List SMART data’s indivdual id in landscape view for all disks) ]
 [ -e <sdXY> (List SMART data for specified disk) for x4540 ]
 [ -E <sdXY> (List raw hex SMART data for specified disk) for x4540 ]
 [ -j (list x4500/x4540 controller number) ]
 [ -o (list x4540 ( HBA/Target sdname sysfs ) ]
 [ -x (Generate hd_map.html) ]


Configuring Offline and Online Hard Disk Drives Using the hdadm Command

The hdadm command is a hard drive management tool for the x64 systems, such as the Sun Fire X4500 server. This command supports drive hot-plugging features and assists with configuring disk drives before they are inserted or removed.

Additionally, the hdadm command consist of subcommands that allows you to configure hard disk drives using the disk logical name or physical slot number.

The hdadm subcommands allows the system administrator to choose command combinations to configure disks online or offline. The hdadm command along with the hd and cfgdisk commands provides a full range of tools to configure and manage their Sun Fire X4500/X4540 server disk drives.


TABLE 4-2   hdadm Subcommand Options
Option Description
online This option configures all drives that are in connected and unconfigured state to an online and accessible status.

It takes the slot as argument, and all the other option as specified in the synopsis.

offline This option unconfigures all drives that are in connected and configured state to an offline status.

It takes the argument slot or disk and all the other option as specified in the synopsis.

display This option displays all drives within the Sun Fire X4500/X4540 server.
slot This option can use any number between 0 and 47 as argument. This number corresponds to the drive in the physical slot number on the chassis in the Sun Fire X4500 server.
disk This option requires sdX argument which corresponds to the Linux storage device name on Sun Fire X4500/X4540 server.
all This option applies to all the disk drives in Sun Fire X4500/X4540 server. It is dependent on the offline and online subcommand selected.

This option can be used when you need to initialize all the drives.

row[0..3] This option allows you to take a series of drives in a row offline or online.
col[0..3] The option allows you to take a series of drives in a column offline or online.
checker0 This option offlines or onlines disk drives in checker pattern 0.
checker1 This option offlines or onlines disk drives in checker pattern 1.
alt_col0 This option offlines or onlines disk drives in alternate column pattern 0.
alt_col1 This option offlines or onlines disk drives in alternate column pattern 1.
up This option offlines or onlines the disk drives in an up pattern.
down This option offlines or onlines the disk drives in an down pattern.


Examples Using the hdadm Command

This section contains examples of common hdadm commands. For more information and options, refer to the hdadm man page.

This chapter includes the following sections:

procedure icon  To Take a Disk Offline by Physical Slot Number

For example, to take a drive offline in slot 11 by its physical slot number, perform the following steps:

  1. Type the following command:


    # hdadm offline slot 11
    

  2. Remove the drive in slot 11 with the blue LED.

procedure icon  To Take a Disk Offline by Logical Name

For example to take a drive offline in slot 10 by its logical name, perform the following steps:

  1. Type the following command:

    # hdadm offline disk sda

  2. Remove the drive in slot 10 with the blue LED.

procedure icon  To Put a Disk Online by Physical Slot Number

For example, to take a disk drive in slot 11 online by using its physical slot number, perform the following steps:For example, to take a disk drive in slot 11 online by using its physical slot number, perform the following steps:

  1. Insert the drive in slot 11.

  2. Type the following command:


    # hdadm offline row3
    

    The LED for slot 11 turns green.

procedure icon  To Take Multiple Disks Offline in a Row

For example, to take disk drives in row 3 offline, perform the following step:

procedure icon  To Take Multiple Disks Offline in Column

For example, to take disk drives in column 3 offline, perform the following step:

procedure icon  To Put All Drives Online

For example, to take all disk drives online, perform the following steps:

  1. Insert all of the disk drives into the server.

  2. Type the following command:


    # hdadm online all
    

    The LEDs for all disk drives turn green.