Chapter 25. Configuring an Installed Linux on System z Instance
For more information about Linux on System z, see the publications listed in Chapter 27, IBM System z References. Some of the most common tasks are described here.
25.1. Adding DASDs
This section explains how to set a Direct Access Storage Device (DASD) online, format it, and how to make sure it is attached to the system persistently, making it automatically available after a reboot.
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 RHEL6X 4B2E 4B2E MR
DASD 4B2E LINKED R/W
See z/VM: CP Commands and Utilities Reference, SC24-6175 for details about these commands.
25.1.1. Dynamically Setting DASDs Online
The following procedure describes bringing a DASD online dynamically (not persistently). This is the first step when configuring a new DASD; later procedures will explain how to make it available persistently.
Procedure 25.1. Adding DASD Disks on IBM System z Using the VMCP Driver
- Enable the
VMCP
driver:#
modprobe vmcp
- Use the
cio_ignore
command to remove the DASD from the list of ignored devices and make it visible to Linux:#
cio_ignore -r DeviceNumber
Replace DeviceNumber with the device number of the DASD. For example:#
cio_ignore -r 0102
- Link the disk to the virtual machine:
#
vmcp 'link * DeviceNumber DeviceNumber rw'
Replace DeviceNumber with the device number of the DASD. - Set the device online. Use a command of the following form:
#
# chccwdev -e DeviceNumber
Replace DeviceNumber with the device number of the DASD. - Verify that the disk is ready using the
lsdasd
command:#
lsdasd
Bus-ID Status Name Device Type BlkSz Size Blocks ============================================================================== 0.0.0100 active dasda 94:0 ECKD 4096 2347MB 600840 0.0.0301 active dasdb 94:4 FBA 512 512MB 1048576 0.0.0300 active dasdc 94:8 FBA 512 256MB 524288 0.0.0101 active dasdd 94:12 ECKD 4096 2347MB 600840 0.0.0200 active dasde 94:16 ECKD 4096 781MB 200160 0.0.0102 active dasdf 94:20 ECKD 4096 2347MB 600840In the above example, device 0102 (shown as0.0.0102
in theBus-ID
column) is being accessed as/dev/dasdf
.
If you followed the above procedure, the new DASD is attached for the current session only. This means that the DASD will not still be attached after you reboot the system. See Section 25.1.2, “Persistently setting DASDs online” for information about attaching the storage device permanently.
You can also 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. Persistently setting DASDs online
The instructions in Section 25.1.1, “Dynamically Setting DASDs Online” described how to activate DASDs dynamically in a running system. Such changes are not persistent; the DASDs will not be attached after the system reboots. Procedures described in this section assume that you have already attached the DASD dynamically.
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 early during the boot process by the initramfs
to be able to mount the root file system. The DASDs which are not part of the root file system can be activated later, simplifying the configuration process.
The list of ignored devices (
cio_ignore
) is handled transparently for persistent device configurations. You do not need to free devices from the ignore list manually.
25.1.2.1. DASDs Which Are Part of the Root File System
If you are attaching a new DASD as part of the root file system, you will have to edit the zipl boot loader's configuration and then regenerate the
initramfs
so that your changes will take effect after the next reboot. The following procedure explains the steps you need to take.
Procedure 25.2. Permanently Attaching DASDs as Root Devices
- Edit the
/etc/dasd.conf
configuration file using a plain text editor such as Vim, and append a line to this file with your DASD's configuration. You can use parts of the file that describe previously configured devices for reference. A valid configuration line will look similar to the following:0.0.0102 use_diag=0 readonly=0 erplog=0 failfast=0
- Edit the
/etc/zipl.conf
configuration file. An examplezipl.conf
file will look similar to the following:[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"
Note the multiplerd_DASD=
options on theparameters=
line. You must add the new DASD to this line, using the same syntax - therd_DASD=
keyword, followed by the device ID and a comma-separated list of options. See thedasd=
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 next step is to rebuild the
initrd
:#
mkinitrd -f /boot/initramfs-2.6.32-71.el6.s390x.img `uname -r`
- Then, rebuild the boot loader configuration using the
zipl
command. You can use the-V
option for more detailed output:#
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_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.
After completing this procedure, the new DASD is persistently attached and can be used as part of the root file system. However, the root file system still needs to be expanded to the new DASD. If your system uses an LVM logical volume for the root file system, you will also need to expand this volume (and the volume group which contains it) to the new DASD. This can be done using the built-in
pvcreate
, vgextend
and lvextend
commands to create a physical volume for LVM, expand the existing volume group and expand the root logical volume, respectively. See Section 25.1.5, “Expanding Existing LVM Volumes to New Storage Devices” for details.
25.1.3. DASDs Which 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:
Procedure 25.3. Permanently Attaching DASDs as Non-root Devices
- 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
25.1.4. Preparing a New DASD with Low-level Formatting
The next step after bringing the DASD online is to format it, if you need to do so. The following procedure explains the necessary steps.
Warning
This procedure will wipe all existing data on the disk. Make sure to back up any data you want to keep before proceeding.
Procedure 25.4. Formatting a DASD
- Wipe all existing data on the DASD using the
dasdfmt
command. Replace DeviceNumber with the device number of the DASD. When prompted for confirmation (as shown in the example below), typeyes
to proceed.#
dasdfmt -b 4096 -d cdl -p /dev/disk/by-path/ccw-0.0.DeviceNumber
Drive Geometry: 10017 Cylinders * 15 Heads = 150255 Tracks I am going to format the device /dev/disk/by-path/ccw-0.0.0102 in the following way: Device number of device : 0x4b2e Labelling device : yes Disk label : VOL1 Disk identifier : 0X0102 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...
See thedasdfmt(8)
man page for information about the syntax of thedasdfmt
command. - Use the
fdasd
command to write a new Linux-compatible partition table to the DASD. Replace DeviceNumber with the device number of the DASD.#
fdasd -a /dev/disk/by-path/ccw-DeviceNumber
auto-creating one partition for the whole disk... writing volume label... writing VTOC... checking ! wrote NATIVE! rereading partition table...This example uses the-a
option to create a single partition spanning the entire disk. Other layouts are possible; up to three partitions can be created on a single DASD. For information about the syntax of thefdasd
command and available options, see thefdasd(8)
man page. - Create a new partition with
fdisk
. Replace DeviceName with the device name of the DASD.#
fdisk /dev/DeviceName
After you executefdisk
, a series of prompts will appear in your terminal. These prompts can be used to manipulate the disk partition table, creating new partitions or editing existing one. For information about usingfdisk
, see thefdisk(8)
man page.
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.
Note
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.5. Expanding Existing LVM Volumes to New Storage Devices
If your system uses LVM, you need to expand an existing volume group and one or more logical volumes so that they contain the new DASD which you attached by following the procedures described earlier in this chapter. Otherwise, the DASD will be attached to the system, but you will not be able to use it.
The following procedure explains how to use the entire capacity of the new DASD to expand an existing logical volume. If you want to use the new DASD for multiple logical volumes, you will need to create multiple LVM physical volumes on this partition, and repeat this procedure for each logical volume (and volume group) you want to expand. This procedure assumes you followed the steps in Section 25.1.1, “Dynamically Setting DASDs Online” to attach the new DASD dynamically, then Section 25.1.2.1, “DASDs Which Are Part of the Root File System” to attach it persistently and prepare it to be used for the root volume, and that you formatted it as described in Section 25.1.4, “Preparing a New DASD with Low-level Formatting” and created a single partition on it.
Procedure 25.5. Expanding Existing Logical Volume to Use a New DASD
- Create a new physical volume for LVM on the DASD using the
pvcreate
command:#
pvcreate /dev/DeviceName
Important
The device name must be specified as a partition - for example,/dev/dasdf1
. Do not specify the entire block device. - List existing physical volumes using the
pvs
command to verify that the physical volume has been created:#
pvs
PV VG Fmt Attr PSize PFree /dev/dasda2 vg_local lvm2 a-- 1,29g 0 /dev/dasdd1 vg_local lvm2 a-- 2,29g 0 /dev/dasdf1 lvm2 a-- 2,29g 2,29g /dev/mapper/mpathb vgextnotshared lvm2 a-- 200,00g 1020,00mAs you can see in the above example,/dev/dasdf1
now contains an empty physical volume which is not assigned to any volume group. - Use the
vgextend
command to expand an existing volume group containing the volume you want to use the new DASD for:#
vgextend VolumeGroup PhysicalVolume
Replace VolumeGroup with the name of the volume group you are expanding, and PhysicalVolume with the name of the physical volume (for example,/dev/dasdf1
). - Use the
lvextend
command to expand a logical volume you want to use the new DASD for:#
lvextend -L +Size /dev/mapper/VolumeGroup-LogicalVolume
For example:#
lvextend -L +2G /dev/mapper/vg_local-lv_root
Extending logical volume lv_root to 2,58 GiB Logical volume lv_root successfully resized
After you complete the procedure, an existing logical volume is expanded and contains the new DASD in addition to any previously assigned storage devices. You can also use the
pvs
, vgs
, and lvs
commands as root
to view existing LVM physical volumes, volume groups and logical volumes at any point during the procedure.