On 2/18/2013 2:52 AM, Leland Lucius wrote:
> This would have been nice, but it doesn't work. :-(
>
> I will prevail though! :-)
>
I'm ashamed to say that I thought for a while it was going to beat me. It did
teach me more respect (not necessarily understanding) of these udev rules,
especially during initrd processing since different /sys entries are
created/completed at different points.
Anyway, I found the best way is to use the existing rules for onlining DASD,
but rather than create the rules at mkinitrd time, they get created at boot
time.
So, here's the script that gets placed in /lib/mkinitrd/scripts as
boot-dynamic-dasd.sh:
<<snip>>
for device in /sys/bus/ccw/devices/*
do
case "$(<${device}/devtype)" in
3380*|3390*|9345*) drv="dasd-eckd" ;;
3370*|9336*) drv="dasd_fba" ;;
*) continue ;;
esac
ccw="${device##*/}"
echo "Creating udev rule for ${ccw}"
cat > /etc/udev/rules.d/51-dasd-${ccw}.rules <<EOF
ACTION=="add", SUBSYSTEM=="ccw", KERNEL=="$ccw", IMPORT{program}="collect $ccw
%k ${ccw} $drv"
ACTION=="add", SUBSYSTEM=="drivers", KERNEL=="$drv", IMPORT{program}="collect
$ccw %k ${ccw} $drv"
ACTION=="add", ENV{COLLECT_$ccw}=="0", ATTR{[ccw/$ccw]online}="1"
EOF
done
<<snip>>
Create a link:
ln -s ../scripts/boot-dynamic-dasd.sh /lib/mkinitrd/boot/03-dynamic-dasd.sh
Run mkinitrd one last time:
mkinitrd
A new "dynamic-dasd" feature will be present:
Kernel image: /boot/image-3.0.42-0.7-default
Initrd image: /boot/initrd-3.0.42-0.7-default
Root device: /dev/disk/by-path/ccw-0.0.1000-part1 (/dev/dasdh1) (mounted on
/ as ext3)
modprobe: Module ext3dm_mod not found.
WARNING: no dependencies for kernel module 'ext3dm_mod' found.
Kernel Modules: jbd scsi_mod scsi_dh scsi_dh_alua scsi_dh_hp_sw scsi_dh_emc
scsi_dh_rdac mbcache ext3 dasd_mod dasd_eckd_mod crc-t10dif sd_mod
Features: dynamic-dasd block dasd
23175 blocks
And zipl:
zipl
On next boot, expect messages similar to:
doing fast boot
device-mapper: uevent: version 1.0.3
device-mapper: ioctl: 4.20.0-ioctl (2011-02-02) initialised: [email protected]
Creating udev rule for 0.0.1000
Creating udev rule for 0.0.1001
Creating udev rule for 0.0.2000
Creating udev rule for 0.0.5000
Creating udev rule for 0.0.5001
Creating udev rule for 0.0.5002
Creating udev rule for 0.0.5100
SCSI subsystem initialized
alua: device handler registered
hp_sw: device handler registered
emc: device handler registered
rdac: device handler registered
Creating device nodes with udev
udev: starting version 147
dasd-eckd.2aa01a: 0.0.1000: New DASD 3390/0C (CU 3990/01) with 8189 cylinders,
dasd-eckd.412b53: 0.0.1000: DASD with 4 KB/block, 5896080 KB total size, 48 KB/
dasda:LNX1/ 0X9000: dasda1
dasd-eckd.2aa01a: 0.0.1001: New DASD 3390/0C (CU 3990/01) with 8189 cylinders,
dasd-eckd.412b53: 0.0.1001: DASD with 4 KB/block, 5896080 KB total size, 48 KB/
dasdb:LNX1/ 0X9000: dasdb1
dasd-eckd.2aa01a: 0.0.2000: New DASD 3390/0C (CU 3990/01) with 3338 cylinders,
dasd-eckd.412b53: 0.0.2000: DASD with 4 KB/block, 2403360 KB total size, 48 KB/
dasdc:LNX1/ 0X9000: dasdc1
dasd-eckd.2aa01a: 0.0.5000: New DASD 3390/0C (CU 3990/01) with 3338 cylinders,
dasd-eckd.412b53: 0.0.5000: DASD with 4 KB/block, 2403360 KB total size, 48 KB/
dasdd:LNX1/ 0X9000: dasdd1
dasd-eckd.2aa01a: 0.0.5001: New DASD 3390/0C (CU 3990/01) with 3338 cylinders,
dasd-eckd.412b53: 0.0.5001: DASD with 4 KB/block, 2403360 KB total size, 48 KB/
dasde:LNX1/ 0X9000: dasde1
dasd-eckd.2aa01a: 0.0.5002: New DASD 3390/0C (CU 3990/01) with 3338 cylinders,
dasd-eckd.412b53: 0.0.5002: DASD with 4 KB/block, 2403360 KB total size, 48 KB/
dasdf:LNX1/ 0X9000: dasdf1
dasd-eckd.2aa01a: 0.0.5100: New DASD 3390/0C (CU 3990/01) with 8189 cylinders,
dasd-eckd.412b53: 0.0.5100: DASD with 4 KB/block, 5896080 KB total size, 48 KB/
dasdg:LNX1/ 0X9000: dasdg1
Leland
----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
----------------------------------------------------------------------
For more information on Linux on System z, visit
http://wiki.linuxvm.org/