Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

22.5. 加​​​​​​​入​​​​​​​ DASD

底​​​​​​​下​​​​​​​是​​​​​​​如​​​​​​​何​​​​​​​加​​​​​​​入​​​​​​​ DASD volume 的​​​​​​​例​​​​​​​子​​​​​​​:

注意

請​​​​​​​確​​​​​​​定​​​​​​​裝​​​​​​​置​​​​​​​已​​​​​​​經​​​​​​​接​​​​​​​上​​​​​​​,如​​​​​​​果​​​​​​​您​​​​​​​的​​​​​​​ Linux 系​​​​​​​統​​​​​​​正​​​​​​​在​​​​​​​ VM 下​​​​​​​執​​​​​​​行​​​​​​​,請​​​​​​​確​​​​​​​定​​​​​​​裝​​​​​​​置​​​​​​​已​​​​​​​經​​​​​​​連​​​​​​​上​​​​​​​系​​​​​​​統​​​​​​​。​​​​​​​
CP LINK RHEL4X 4B2E 4B2E MR
DASD 4B2E LINKED R/W
使​​​​​​​用​​​​​​​ cd 指​​​​​​​令​​​​​​​移​​​​​​​到​​​​​​​代​​​​​​​表​​​​​​​該​​​​​​​ volume 的​​​​​​​ /sys/ 目​​​​​​​錄​​​​​​​:
# cd /sys/bus/ccw/drivers/dasd-eckd/0.0.4b2e/
# ls -l
total 0
-r--r--r--  1 root root 4096 Aug 25 17:04 availability
-rw-r--r--  1 root root 4096 Aug 25 17:04 cmb_enable
-r--r--r--  1 root root 4096 Aug 25 17:04 cutype
-rw-r--r--  1 root root 4096 Aug 25 17:04 detach_state
-r--r--r--  1 root root 4096 Aug 25 17:04 devtype
-r--r--r--  1 root root 4096 Aug 25 17:04 discipline
-rw-r--r--  1 root root 4096 Aug 25 17:04 online
-rw-r--r--  1 root root 4096 Aug 25 17:04 readonly
-rw-r--r--  1 root root 4096 Aug 25 17:04 use_diag
接​​​​​​​下​​​​​​​來​​​​​​​,檢​​​​​​​查​​​​​​​它​​​​​​​是​​​​​​​不​​​​​​​是​​​​​​​已​​​​​​​經​​​​​​​上​​​​​​​線​​​​​​​:
# cat online
0
如​​​​​​​果​​​​​​​還​​​​​​​未​​​​​​​上​​​​​​​線​​​​​​​,請​​​​​​​執​​​​​​​行​​​​​​​以​​​​​​​下​​​​​​​指​​​​​​​令​​​​​​​讓​​​​​​​它​​​​​​​上​​​​​​​線​​​​​​​:
# echo 1 > online
# cat online
1
檢​​​​​​​查​​​​​​​它​​​​​​​被​​​​​​​哪​​​​​​​個​​​​​​​區​​​​​​​塊​​​​​​​的​​​​​​​ devnode 所​​​​​​​存​​​​​​​取​​​​​​​:
# ls -l
total 0
-r--r--r--  1 root root 4096 Aug 25 17:04 availability
lrwxrwxrwx  1 root root    0 Aug 25 17:07 block -> ../../../../block/dasdb
-rw-r--r--  1 root root 4096 Aug 25 17:04 cmb_enable
-r--r--r--  1 root root 4096 Aug 25 17:04 cutype
-rw-r--r--  1 root root 4096 Aug 25 17:04 detach_state
-r--r--r--  1 root root 4096 Aug 25 17:04 devtype
-r--r--r--  1 root root 4096 Aug 25 17:04 discipline
-rw-r--r--  1 root root    0 Aug 25 17:04 online
-rw-r--r--  1 root root 4096 Aug 25 17:04 readonly
-rw-r--r--  1 root root 4096 Aug 25 17:04 use_diag
如​​​​​​​範​​​​​​​例​​​​​​​所​​​​​​​顯​​​​​​​示​​​​​​​的​​​​​​​,4B2E 裝​​​​​​​置​​​​​​​是​​​​​​​以​​​​​​​ /dev/dasdb 為​​​​​​​名​​​​​​​被​​​​​​​系​​​​​​​統​​​​​​​存​​​​​​​取​​​​​​​。​​​​​​​
請​​​​​​​使​​​​​​​用​​​​​​​ cd 指​​​​​​​令​​​​​​​切​​​​​​​換​​​​​​​到​​​​​​​ /root目​​​​​​​錄​​​​​​​下​​​​​​​,並​​​​​​​將​​​​​​​該​​​​​​​裝​​​​​​​置​​​​​​​格​​​​​​​式​​​​​​​化​​​​​​​:
# cd
# dasdfmt -b 4096 -d cdl -f /dev/dasdb -l LX4B2E -p -y

cyl    97 of  3338 |#----------------------------------------------|   2%
當​​​​​​​進​​​​​​​度​​​​​​​表​​​​​​​到​​​​​​​底​​​​​​​,格​​​​​​​式​​​​​​​化​​​​​​​完​​​​​​​成​​​​​​​之​​​​​​​後​​​​​​​,請​​​​​​​使​​​​​​​用​​​​​​​ fdasd 將​​​​​​​這​​​​​​​裝​​​​​​​置​​​​​​​格​​​​​​​式​​​​​​​化​​​​​​​:
# fdasd -a /dev/dasdb
auto-creating one partition for the whole disk...
writing volume label...
writing VTOC...
checking !
wrote NATIVE!
rereading partition table...
接​​​​​​​下​​​​​​​來​​​​​​​,在​​​​​​​新​​​​​​​的​​​​​​​分​​​​​​​割​​​​​​​區​​​​​​​上​​​​​​​建​​​​​​​立​​​​​​​檔​​​​​​​案​​​​​​​系​​​​​​​統​​​​​​​:
# mke2fs -j /dev/dasdb1
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
300960 inodes, 600816 blocks
30040 blocks (5.00%) reserved for the super user
First data block=0
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
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 39 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
掛​​​​​​​載​​​​​​​新​​​​​​​的​​​​​​​檔​​​​​​​案​​​​​​​系​​​​​​​統​​​​​​​:
# mount /dev/dasdb1 /opt
# mount
/dev/dasda1 on / type ext3 (rw)
none on /proc type proc (rw)
none on /sys type sysfs (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
none on /dev/shm type tmpfs (rw)
/dev/dasdb1 on /opt type ext3 (rw)
在​​​​​​​ /etc/fstab 中​​​​​​​加​​​​​​​入​​​​​​​一​​​​​​​條​​​​​​​紀​​​​​​​錄​​​​​​​,讓​​​​​​​系​​​​​​​統​​​​​​​開​​​​​​​機​​​​​​​的​​​​​​​時​​​​​​​候​​​​​​​,即​​​​​​​可​​​​​​​掛​​​​​​​載​​​​​​​檔​​​​​​​案​​​​​​​系​​​​​​​統​​​​​​​:
# vi /etc/fstab
# cat /etc/fstab
LABEL=/                 /                       ext3    defaults
1 1
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/dasdb1             /opt                    ext3    defaults
1 2
在​​​​​​​ /etc/modprobe.conf 中​​​​​​​,把​​​​​​​裝​​​​​​​置​​​​​​​加​​​​​​​入​​​​​​​ dasd_mod 選​​​​​​​項​​​​​​​中​​​​​​​。​​​​​​​確​​​​​​​定​​​​​​​在​​​​​​​清​​​​​​​單​​​​​​​的​​​​​​​最​​​​​​​後​​​​​​​,加​​​​​​​入​​​​​​​新​​​​​​​裝​​​​​​​置​​​​​​​,否​​​​​​​則​​​​​​​這​​​​​​​清​​​​​​​單​​​​​​​會​​​​​​​改​​​​​​​變​​​​​​​裝​​​​​​​置​​​​​​​的​​​​​​​號​​​​​​​碼​​​​​​​:devnode 對​​​​​​​應​​​​​​​與​​​​​​​檔​​​​​​​案​​​​​​​系​​​​​​​統​​​​​​​不​​​​​​​再​​​​​​​位​​​​​​​於​​​​​​​裝​​​​​​​置​​​​​​​該​​​​​​​在​​​​​​​的​​​​​​​位​​​​​​​置​​​​​​​。​​​​​​​
# vi /etc/modprobe.conf
# cat /etc/modprobe.conf
alias eth0 qeth
options dasd_mod dasd=201,4B2E
回​​​​​​​到​​​​​​​ mkinitrd 指​​​​​​​令​​​​​​​,把​​​​​​​變​​​​​​​更​​​​​​​加​​​​​​​入​​​​​​​ modprobe.conf 中​​​​​​​,讓​​​​​​​裝​​​​​​​置​​​​​​​在​​​​​​​下​​​​​​​次​​​​​​​開​​​​​​​機​​​​​​​時​​​​​​​,能​​​​​​​恢​​​​​​​復​​​​​​​上​​​​​​​線​​​​​​​並​​​​​​​可​​​​​​​掛​​​​​​​載​​​​​​​到​​​​​​​系​​​​​​​統​​​​​​​上​​​​​​​:
Note that the example below has been modified slightly for readability and for printing purposes. Each line that ends with "(elf64-s390)" should be treated as one line with no spaces, such as /tmp/initrd.AR1182/lib/dasd_mod.ko(elf64-s390).
# cd /boot
# mv initrd-2.6.7-1.451.2.3.img initrd-2.6.7-1.451.2.3.img.old
# mkinitrd -v initrd-2.6.7-1.451.2.3.img 2.6.7-1.451.2.3
Looking for deps of module ide-disk
Looking for deps of module dasd_mod
Looking for deps of module dasd_eckd_mod         dasd_mod
Looking for deps of module dasd_mod
Looking for deps of module dasd_fba_mod  dasd_mod
Looking for deps of module dasd_mod
Looking for deps of module ext3  jbd
Looking for deps of module jbd
Using modules:  ./kernel/drivers/s390/block/dasd_mod.ko
./kernel/drivers/s390/block/dasd_eckd_mod.ko
./kernel/drivers/s390/block/dasd_fba_mod.ko ./kernel/fs/jbd/jbd.ko
./kernel/fs/ext3/ext3.ko
Using loopback device /dev/loop0
/sbin/nash -> /tmp/initrd.AR1182/bin/nash
/sbin/insmod.static -> /tmp/initrd.AR1182/bin/insmod
copy from
/lib/modules/2.6.7-1.451.2.3/./kernel/drivers/s390/block/dasd_mod.ko
(elf64-s390) to 
/tmp/initrd.AR1182/lib/dasd_mod.ko(elf64-s390)
copy from
/lib/modules/2.6.7-1.451.2.3/./kernel/drivers/s390/block/dasd_eckd_mod.ko
(elf64-s390) to 
/tmp/initrd.AR1182/lib/dasd_eckd_mod.ko
(elf64-s390)
copy from
/lib/modules/2.6.7-1.451.2.3/./kernel/drivers/s390/block/dasd_fba_mod.ko
(elf64-s390) to 
/tmp/initrd.AR1182/lib/dasd_fba_mod.ko
(elf64-s390)
copy from
/lib/modules/2.6.7-1.451.2.3/./kernel/fs/jbd/jbd.ko(elf64-s390) to 
/tmp/initrd.AR1182/lib/jbd.ko(elf64-s390)
copy from
/lib/modules/2.6.7-1.451.2.3/./kernel/fs/ext3/ext3.ko(elf64-s390) to 
/tmp/initrd.AR1182/lib/ext3.ko(elf64-s390)
Loading module dasd_mod with options dasd=201,4B2E
Loading module dasd_eckd_mod
Loading module dasd_fba_mod
Loading module jbd
Loading module ext3
請​​​​​​​執​​​​​​​行​​​​​​​ zipl 將​​​​​​​變​​​​​​​更​​​​​​​存​​​​​​​入​​​​​​​ initrd,使​​​​​​​得​​​​​​​下​​​​​​​次​​​​​​​系​​​​​​​統​​​​​​​開​​​​​​​機​​​​​​​時​​​​​​​,改​​​​​​​變​​​​​​​也​​​​​​​能​​​​​​​生​​​​​​​效​​​​​​​。​​​​​​​
# zipl -V
Using config file '/etc/zipl.conf'
Target device information
  Device..........................: 5e:00
  Partition.......................: 5e:01
  Device name.....................: dasda
  DASD device number..............: 0201
  Type............................: disk partition
  Disk layout.....................: ECKD/compatible disk layout
  Geometry - heads................: 15
  Geometry - sectors..............: 12
  Geometry - cylinders............: 3308
  Geometry - start................: 24
  File system block size..........: 4096
  Physical block size.............: 4096
  Device size in physical blocks..: 595416
Building bootmap '/boot//bootmap'
Building menu 'rh-automatic-menu'
Adding #1: IPL section 'linux' (default)
  kernel image......: /boot/vmlinuz-2.6.7-1.451.2.3 at 0x10000
  kernel parmline...: 'root=LABEL=/' at 0x1000
  initial ramdisk...: /boot/initrd-2.6.7-1.451.2.3.img at 0x800000
Preparing boot device: dasda (0201).
Preparing boot menu
  Interactive prompt......: disabled
  Menu timeout............: disabled
  Default configuration...: 'linux'
Syncing disks...
Done.