Dynamically add new DASD to Red Hat Enterprise Linux on zSeries

Discover how Red Hat Enterprise Linux Version 4 (RHEL V4.0) has changed the way you add new direct access storage device (DASD) devices. Follow along as Dionne Graff provides detailed instructions on how to add these devices to an already running Red Hat 2.6-based system.

Dionne Graff (dgraff@us.ibm.com), zSeries New Technology Center, IBM 

Dionne GraffDionne Catherine Graff has a Bachelor of Science Degree in Computer Science from SUNY New Paltz. She is an Advisory Software Engineer with IBM where she has been employed for 22 years. She is currently providing presales technical support work for the Linux zSeries Technical Support Team. You can reach Dionne at dgraff@us.ibm.com.



28 April 2005

Adding DASD devices

The RHEL V4.0, which is based on the Linux™ 2.6 kernel, has some changes that affect the way you administer the system to add new DASD devices. In this step-by-step example, running RHEL4x 64-bit second level on z/VM® zSeries® was used.

  1. Use the VM Control Program (CP) Link or Attach commands to add the new device to the VM system that is running the second level Linux system. You have to issue the command from the Linux console, where you IPLed your Linux system, and use the #cp command so that it communicates with z/VM, and not Linux.

    Note that the # shown in this step is not the Linux prompt. The rest of the steps are all Linux commands.

    #cp att 93E1 *

    This command adds a directory representing the device, 93E1, in the /sys/bus/ccw/drivers/dasd-eckd/ directory.

  2. Change directory to the /sys/bus/ccw/drivers/dasd-eckd/ directory:
    # cd /sys/bus/ccw/drivers/dasd-eckd/
  3. Check to see if the directory representing your device is listed in the content of the /sys/bus/ccw/drivers/dasd/-eckd directory. It will be in the format of 0.0.xxxx in the Linux 2.6 kernel. In this example, it will be 0.0.93E1.
    # ls
    0.0.0190  0.0.019a  0.0.019e  0.0.93a9  0.0.93e1
    0.0.0191  0.0.019d  0.0.0592  0.0.93af
    #
  4. Change directory to the appropriate 0.0.xxxx directory.
    # cd 0.0.93e1
  5. The zero in the online file indicates that the device is offline. A one indicates that the device is online.
    # cat online
    0
  6. Turn the device online by using the echo command and change the zero to a one, followed by a recheck of its contents:
    # echo 1 > online
    # cat online
    1
  7. Now that the online file indicates that the device is online, next check to see which devnode is being accessed by the Linux system (for example, dasdx).

    You can view if this worked by checking the old interface (prior to the Linux 2.6 kernel) by using the /proc/dasd/devices interface (see Listing 1). Notice how the /proc interface works, but the interface is deprecated and is read-only in the Linux 2.6 kernel. Do not attempt to update the /proc interface in the Linux 2.6 kernel. The Linux 2.6 kernel uses the new sysfs interface.

    Another way to check the Linux 2.6 kernel is by issuing the ls -l command from the /sys/bus/ccw/drivers/dasd-eckd/0.0.xxxx directory. In Listing 2, the 93E1 device is assigned to the /dev/dasdc device. This might be different on your system but will be in the format of dasdx, where x is variable.

    Listing 2. ls -l command
    #ls -l
    total 0
    -r--r--r--  1 root root 4096 Feb 16 13:26 availability
    lrwxrwxrwx  1 root root    0 Feb 16 13:32 block -> ../../../../block/dasdc
    -rw-r--r--  1 root root 4096 Feb 16 13:26 cmb_enable
    -r--r--r--  1 root root 4096 Feb 16 13:26 cutype
    -rw-r--r--  1 root root 4096 Feb 16 13:26 detach_state
    -r--r--r--  1 root root 4096 Feb 16 13:26 devtype
    -r--r--r--  1 root root 4096 Feb 16 13:26 discipline
    -rw-r--r--  1 root root    0 Feb 16 13:26 online
    -rw-r--r--  1 root root 4096 Feb 16 13:26 readonly
    -rw-r--r--  1 root root 4096 Feb 16 13:26 use_diag
  8. Change the directory back to the /root directory and format the device by using the dasdfmt command to format the /dev/dasdc device, as shown in Listing 3 below. You might want to use different dasdfmt parameters. The dasdfmt command will erase all information on the DASD, so be very careful.

    Listing 3. dasdfmt command
    #cd /root
    #
    # dasdfmt -b 4096 -d cdl -f /dev/dasdc
    Drive Geometry: 3339 Cylinders * 15 Heads =  50085 Tracks
    
    I am going to format the device /dev/dasdc in the following way:
       Device number of device : 0x93e1
       Labelling device        : yes
       Disk label              : VOL1
       Disk identifier         : 0X93E1
       Extent start (trk no)   : 0
       Extent end (trk no)     : 50084
       Compatible Disk Layout  : yes
       Blocksize               : 4096
    
    --->> ATTENTION! <<---
    All data of that device will be lost.
    Type "yes" to continue, no will leave the disk untouched: yes
    Formatting the device. This might take a while (get yourself a coffee).
    
    Finished formatting the device.
    Rereading the partition table... ok
    #
  9. Create a partition for the device using the fdasd command. In Listing 4, I chose the -a (automatic) option to create one partition.

    Listing 4. fdasd command
    #fdasd -a /dev/dasdc
    auto-creating one partition for the whole disk...
    writing volume label...
    writing VTOC...
    rereading partition table...
  10. Use the mke2fs command to create either an ext2 or ext3 filesystem. In Listing 5, I am creating an ext3 filesystem by using the -j option.

    Listing 5. mke2fs command
    # mke2fs -j /dev/dasdc1
    
    mke2fs 1.35 (28-Feb-2004)
    max_blocks 615419904, rsv_groups = 18782, rsv_gdb = 146
    Filesystem label=
    OS type: Linux
    Block size=4096 (log=2)
    Fragment size=4096 (log=2)
    300960 inodes, 600996 blocks
    30049 blocks (5.00%) reserved for the super user
    First data block=0
    Maximum filesystem blocks=616562688
    19 block groups
    32768 blocks per group, 32768 fragments per group
    15840 inodes per group
    Superblock backups stored on blocks:
            32768, 98304, 163840, 229376, 294912
    
    Writing inode tables: done
    inode.i_blocks = 7016, i_size = 4243456
    Creating journal (8192 blocks): done
    Writing superblocks and filesystem accounting information: done
    
    This filesystem will be automatically checked every 21 mounts or
    180 days, whichever comes first.  Use tune2fs -c or -i to override.
    #
  11. Mount the newly created filesystem somewhere on your system. Listing 6 illustrates the /opt directory.

    Listing 6. Filesystem mount
    # mount /dev/dasdc1 /opt
    # df
    Filesystem           1K-blocks      Used Available Use% Mounted on
    /dev/mapper/VolGroup00-LogVol00
                           4031680   1989424   1837456  52% /
    /dev/dasda1              99168      9440     84612  11% /boot
    none                    125664         0    125664   0% /dev/shm
    /dev/dasdc1            2366164     36336   2209632   2% /opt
    [root@esll02 ~]#

    The last steps are to make the mount permanent over reIPLs.

  12. As usual, you have to add an entry to /etc/fstab. Note that I used ext3 and made a copy before editing fstab, as shown in Listing 7 below.

    Listing 7. ext3 command
    #cd /etc
    #cp fstab fstab.orig
    #vi fstab

    In fstab, I added the line in BOLD type for /dev/dasdc1, as shown in Listing 8 below.

    Listing 8. fstab command
    # This file is edited by fstab-sync - see 'man fstab-sync' for details
    /dev/VolGroup00/LogVol00 /                       ext3    defaults        1 1
    LABEL=/boot             /boot                   ext3    defaults        1 2
    none                    /dev/pts                devpts  gid=5,mode=620  0 0
    none                    /dev/shm                tmpfs   defaults        0 0
    none                    /proc                   proc    defaults        0 0
    none                    /sys                    sysfs   defaults        0 0
    /dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0
    /dev/dasdc1             /opt                    ext3    defaults        1 2
  13. Add the new device to file /etc/modprobe.conf to the END of the existing list, as shown in Listing 9. If you do not complete this step, the device numbers (devnode numbers) will change.

    Listing 9. Adding the new device
    # cp modprobe.conf modprobe.conf.orig
    # vi modprobe.conf
    
    alias eth0 qeth
    options dasd_mod dasd=0.0.93AF,0.0.93A9,0.0.93E1
  14. Run mkinitrd, which creates an initial RAMdisk image, to pick up the changes you just made in modprobe.conf so the device will be online and mountable after the next IPL or boot.

    Prior to running mkinitrd, go to the /boot directory for this and rename the original image first (see Listing 10).

  15. Run zipl to save the changes to initrd for the next IPL: # zipl -V.
  16. Reboot your system to make sure the changes worked.

Resources

  • Read the Red Hat Enterprise Linux 4 installation guide for more information on the IBM® S/390® and IBM eServer™ zSeries architectures.
  • Check out what's new in zSeries.
  • Browse for books on these and other technical topics.
  • Want more? The developerWorks eServer zone hosts hundreds of informative articles and introductory, intermediate, and advanced tutorials on the eServer brand.
  • Get involved in the developerWorks community by participating in developerWorks blogs.
  • The IBM developerWorks team hosts hundreds of technical briefings around the world which you can attend at no charge.

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into Linux on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Linux
ArticleID=81481
ArticleTitle=Dynamically add new DASD to Red Hat Enterprise Linux on zSeries
publish-date=04282005