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.
- Use the VM Control Program (CP)
Attachcommands 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
#cpcommand 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.
- Change directory to the /sys/bus/ccw/drivers/dasd-eckd/ directory:
# cd /sys/bus/ccw/drivers/dasd-eckd/
- 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 #
- Change directory to the appropriate 0.0.xxxx directory.
# cd 0.0.93e1
- The zero in the online file indicates that the device is offline. A one indicates that the device is online.
# cat online 0
- Turn the device online by using the
echocommand and change the zero to a one, followed by a recheck of its contents:
# echo 1 > online # cat online 1
- 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,
You can view if this worked by checking the old interface (prior to the Linux 2.6 kernel) by using the
/proc/dasd/devicesinterface (see Listing 1). Notice how the
/procinterface works, but the interface is deprecated and is read-only in the Linux 2.6 kernel. Do not attempt to update the
/procinterface in the Linux 2.6 kernel. The Linux 2.6 kernel uses the new
Another way to check the Linux 2.6 kernel is by issuing the
ls -lcommand 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.
#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
- Change the directory back to the /root directory and format the device by using the
dasdfmtcommand to format the /dev/dasdc device, as shown in Listing 3 below. You might want to use different
dasdfmtcommand will erase all information on the DASD, so be very careful.
#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 #
- Create a partition for the device using the
fdasdcommand. In Listing 4, I chose the
-a(automatic) option to create one partition.
#fdasd -a /dev/dasdc auto-creating one partition for the whole disk... writing volume label... writing VTOC... rereading partition table...
- Use the
mke2fscommand to create either an ext2 or ext3 filesystem. In Listing 5, I am creating an ext3 filesystem by using the -j option.
# 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. #
- 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.
- As usual, you have to add an entry to /etc/fstab. Note that I used
ext3and made a copy before editing
fstab, as shown in Listing 7 below.
#cd /etc #cp fstab fstab.orig #vi fstab
fstab, I added the line in BOLD type for
/dev/dasdc1, as shown in Listing 8 below.
# 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
- Add the new device to file
/etc/modprobe.confto 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
mkinitrd, which creates an initial RAMdisk image, to pick up the changes you just made in
modprobe.confso 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).
ziplto save the changes to
initrdfor the next IPL: # zipl -V.
- Reboot your system to make sure the changes worked.
- 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.
Dig deeper into Linux on developerWorks
Get samples, articles, product docs, and community resources to help build, deploy, and manage your cloud apps.
Keep up with the best and latest technical info to help you tackle your development challenges.
Software development in the cloud. Register today to create a project.
Evaluate IBM software and solutions, and transform challenges into opportunities.