Questo contenuto non è disponibile nella lingua selezionata.
Chapter 20. Configuring an Installed Linux on IBM Z Instance
For more information about Linux on IBM Z, see the publications listed in Chapter 22, IBM Z References. Some of the most common tasks are described here.
20.1. Adding DASDs
DASDs (Direct Access Storage Devices) are a type of storage commonly used with IBM Z. Additional information about working with these storage devices can be found at the IBM Knowledge Center at http://www-01.ibm.com/support/knowledgecenter/linuxonibm/com.ibm.linux.z.lgdd/lgdd_t_dasd_wrk.html.
The following is an example of how to set a DASD online, format it, and make the change persistent.
Note
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 RHEL7X 4B2E 4B2E MR
DASD 4B2E LINKED R/W
See z/VM: CP Commands and Utilities Reference, SC24-6175 for details about the commands.
20.1.1. Dynamically Setting DASDs Online
To set a DASD online, follow these steps:
- Use the
cio_ignore
utility 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, enter 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_diagAs 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, see Section 20.1.3, “Persistently Setting DASDs Online”. When you work with DASDs, use the persistent device symbolic links under
/dev/disk/by-path/
. See the chapter about persistent storage device naming in the Red Hat Enterprise Linux 7 Storage Administration Guide for more in-depth information about different ways to consistently refer to storage devices.
20.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 /root
#
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...
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/
.
20.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.
The
cio_ignore
commands are handled transparently for persistent device configurations and you do not need to free devices from the ignore list manually.
20.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 is one boot option to activate DASDs early in the boot process:
rd.dasd=
. This option takes a Direct Access Storage Device (DASD) adapter device bus identifier. For multiple DASDs, specify the parameter multiple times, or use a comma separated list of bus IDs. To specify a range of DASDs, specify the first and the last bus ID.
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.el7.s390x ramdisk=/boot/initramfs-2.6.32-19.el7.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,!condev"
Suppose that you want to add another physical volume on a partition of a third DASD with device bus ID
0.0.202b
. To do this, 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.el7.s390x ramdisk=/boot/initramfs-2.6.32-19.el7.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,!condev"
Warning
Make sure the length of the kernel command line in
/etc/zipl.conf
does not exceed 896 bytes. Otherwise, the boot loader cannot be saved, and the installation fails.
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.el7.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,!condev' initial ramdisk...: /boot/initramfs-2.6.32-19.el7.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.
20.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 can 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
utility 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