|
|
|
|
|
Red Hat Enterprise Linux 9 Essentials Book now available.
Purchase a copy of Red Hat Enterprise Linux 9 (RHEL 9) Essentials Red Hat Enterprise Linux 9 Essentials Print and eBook (PDF) editions contain 34 chapters and 298 pages
|
Chapter 25. Configuring an Installed Linux on System z Instance
The following is an example of how to set a DASD online, format it, and make the change persistent.
Make sure the device is attached or linked to the Linux system if running under z/VM.
CP ATTACH EB1C TO *
To link a mini disk to which you have access, issue, for example:
CP LINK RHEL6X 4B2E 4B2E MR
DASD 4B2E LINKED R/W
See the z/VM: CP Commands and Utilities Reference, SC24-6175 for details about the commands.
25.1.1. Dynamically setting DASDs online
To set a DASD online, follow these steps:
-
Use the cio_ignore command to remove the DASD from the list of ignored devices and make it visible to Linux:
# cio_ignore -r device_number
Replace device_number with the device number of the DASD. For example:
# cio_ignore -r 4b2e
-
Set the device online. Use a command of the following form:
# chccwdev -e device_number
Replace device_number with the device number of the DASD. For example:
# chccwdev -e 4b2e
As an alternative, you can set the device online using sysfs attributes:
-
Use the cd command to change to the /sys/ directory that represents that volume:
# 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
-
Check to see if the device is already online:
# cat online
0
-
If it is not online, run the following command to bring it online:
# echo 1 > online
# cat online
1
-
Verify which block devnode it is being accessed as:
# 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
As shown in this example, device 4B2E is being accessed as /dev/dasdb.
These instructions set a DASD online for the current session, but this is not persistent across reboots. For instructions on how to set a DASD online persistently, refer to Section 25.1.3, “Persistently setting DASDs online”. When you work with DASDs, use the persistent device symbolic links under /dev/disk/by-path/ .
You can find more information in the DASD Chapter in Linux on System z Device Drivers, Features, and Commands on Red Hat Enterprise Linux 6.
25.1.2. Preparing a new DASD with low-level formatting
Once the disk is online, change back to the /root directory and low-level format the device. This is only required once for a DASD during its entire lifetime:
# cd
# dasdfmt -b 4096 -d cdl -p /dev/disk/by-path/ccw-0.0.4b2e
Drive Geometry: 10017 Cylinders * 15 Heads = 150255 Tracks
I am going to format the device /dev/disk/by-path/ccw-0.0.4b2e in the following way:
Device number of device : 0x4b2e
Labelling device : yes
Disk label : VOL1
Disk identifier : 0X4B2E
Extent start (trk no) : 0
Extent end (trk no) : 150254
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
cyl 97 of 3338 |#----------------------------------------------| 2%
When the progress bar reaches the end and the format is complete, dasdfmt prints the following output:
Rereading the partition table...
Exiting...
Now, use fdasd to partition the DASD. You can create up to three partitions on a DASD. In our example here, we create one partition spanning the whole disk:
# fdasd -a /dev/disk/by-path/ccw-0.0.4b2e
auto-creating one partition for the whole disk...
writing volume label...
writing VTOC...
checking !
wrote NATIVE!
rereading partition table...
For more information, see the chapter on DASD in Linux on System z Device Drivers, Features, and Commands on Red Hat Enterprise Linux 6.
After a (low-level formatted) DASD is online, it can be used like any other disk under Linux. For instance, you can create file systems, LVM physical volumes, or swap space on its partitions, for example /dev/disk/by-path/ccw-0.0.4b2e-part1 . Never use the full DASD device (dev/dasdb ) for anything but the commands dasdfmt and fdasd . If you want to use the entire DASD, create one partition spanning the entire drive as in the fdasd example above.
To add additional disks later without breaking existing disk entries in, for example, /etc/fstab , use the persistent device symbolic links under /dev/disk/by-path/ .
25.1.3. Persistently setting DASDs online
The above instructions described how to activate DASDs dynamically in a running system. However, such changes are not persistent and do not survive a reboot. Making changes to the DASD configuration persistent in your Linux system depends on whether the DASDs belong to the root file system. Those DASDs required for the root file system need to be activated very early during the boot process by the initramfs to be able to mount the root file system.
Cio_ignore is handled transparently for persistent device configurations and you do not need to free devices from the ignore list manually.
25.1.3.1. DASDs that are part of the root file system
The only file you have to modify to add DASDs that are part of the root file system is /etc/zipl.conf . Then run the zipl boot loader tool. There is no need to recreate the initramfs .
There are two boot parameters to activate DASDs early in the boot process:
-
rd_DASD=
-
rd_DASD_MOD= — only provided for compatibility with old system configurations. Refer to the dasd= parameter description in the DASD device driver chapter in Linux on System z Device Drivers, Features, and Commands on Red Hat Enterprise Linux 6 for details.
The rd_DASD option takes a comma-separated list as input. The list contains a device bus ID and optional additional parameters consisting of key-value-pairs that correspond to DASD sysfs attributes.
Below is an example zipl.conf for a system that uses physical volumes on partitions of two DASDs for an LVM volume group vg_devel1 that contains a logical volume lv_root for the root file system.
[defaultboot]
default=linux
target=/boot/
[linux]
image=/boot/vmlinuz-2.6.32-19.el6.s390x
ramdisk=/boot/initramfs-2.6.32-19.el6.s390x.img
parameters="root=/dev/mapper/vg_devel1-lv_root rd_DASD=0.0.0200,use_diag=0,readonly=0,erplog=0,failfast=0 rd_DASD=0.0.0207,use_diag=0,readonly=0,erplog=0,failfast=0 rd_LVM_LV=vg_devel1/lv_root rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=us cio_ignore=all,!0.0.0009"
Suppose that you would like to add another physical volume on a partition of a third DASD with device bus ID 0.0.202b . To do this, simply add rd_DASD=0.0.202b to the parameters line of your boot kernel in zipl.conf :
[defaultboot]
default=linux
target=/boot/
[linux]
image=/boot/vmlinuz-2.6.32-19.el6.s390x
ramdisk=/boot/initramfs-2.6.32-19.el6.s390x.img
parameters="root=/dev/mapper/vg_devel1-lv_root rd_DASD=0.0.0200,use_diag=0,readonly=0,erplog=0,failfast=0 rd_DASD=0.0.0207,use_diag=0,readonly=0,erplog=0,failfast=0 rd_DASD=0.0.202b rd_LVM_LV=vg_devel1/lv_root rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=us cio_ignore=all,!0.0.0009"
Run zipl to apply the changes of /etc/zipl.conf for the next IPL:
# 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 in '/boot/'
Building menu 'rh-automatic-menu'
Adding #1: IPL section 'linux' (default)
kernel image......: /boot/vmlinuz-2.6.32-19.el6.s390x
kernel parmline...: 'root=/dev/mapper/vg_devel1-lv_root rd_DASD=0.0.0200,use_diag=0,readonly=0,erplog=0,failfast=0 rd_DASD=0.0.0207,use_diag=0,readonly=0,erplog=0,failfast=0 rd_DASD=0.0.202b rd_LVM_LV=vg_devel1/lv_root rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=us cio_ignore=all,!0.0.0009'
initial ramdisk...: /boot/initramfs-2.6.32-19.el6.s390x.img
component address:
kernel image....: 0x00010000-0x00a70fff
parmline........: 0x00001000-0x00001fff
initial ramdisk.: 0x02000000-0x022d2fff
internal loader.: 0x0000a000-0x0000afff
Preparing boot device: dasda (0201).
Preparing boot menu
Interactive prompt......: enabled
Menu timeout............: 15 seconds
Default configuration...: 'linux'
Syncing disks...
Done.
25.1.3.2. DASDs that are not part of the root file system
DASDs that are not part of the root file system, that is, data disks, are persistently configured in the file /etc/dasd.conf . It contains one DASD per line. Each line begins with the device bus ID of a DASD. Optionally, each line can continue with options separated by space or tab characters. Options consist of key-value-pairs, where the key and value are separated by an equals sign.
The key corresponds to any valid sysfs attribute a DASD may have. The value will be written to the key's sysfs attribute. Entries in /etc/dasd.conf are activated and configured by udev when a DASD is added to the system. At boot time, all DASDs visible to the system get added and trigger udev.
Example content of /etc/dasd.conf :
0.0.0207
0.0.0200 use_diag=1 readonly=1
Modifications of /etc/dasd.conf only become effective after a reboot of the system or after the dynamic addition of a new DASD by changing the system's I/O configuration (that is, the DASD is attached under z/VM). Alternatively, you can trigger the activation of a new entry in /etc/dasd.conf for a DASD which was previously not active, by executing the following commands:
-
Use the cio_ignore command to remove the DASD from the list of ignored devices and make it visible to Linux:
# cio_ignore -r device_number
For example:
# cio_ignore -r 021a
-
Trigger the activation by writing to the uevent attribute of the device:
echo add > /sys/bus/ccw/devices/device-bus-ID /uevent
For example:
echo add > /sys/bus/ccw/devices/0.0.021a/uevent
|
|
|