Minidisks on z/VM cannot span more than one physical DASD volume. Without a volume management system, this limits the size of a file system on Linux for zSeries to the size of a DASD volume. For a 3390 model 3, this translates to 2.3GB of available space for a Linux file system.
Volume management systems allow multiple DASD devices to be combined into a single Linux file system (and thereby overcome the single DASD volume size limit). This Tip describes how to configure Logical Volume Management (LVM) for Linux on zSeries.
LVM has its own terminology, which we describe briefly here:
- A DASD volume is called a physical volume (PV), because that’s the volume where the data is physically stored.
- The PV is divided into several physical extents (PE) of the same size. The PEs are like blocks on the PV.
- Several PVs make up a volume group (VG), which becomes a pool of PEs available for the logical volume (LV).
- The LVs appear as normal devices in /dev/ directory. You can add or delete PVs to/from a VG, and increase/decrease your LVs.
LVM can be exercised either from the command line, or by using the setup tools like YaST on SLES. The line commands are common to all Linux distributions so we describe the LVM line commands to use. Spreading the LVM minidisks (mdisk) over several packs allows z/VM to issue multiple I/O's versus one I/O per full pack (complete DASD) mdisk. LVMs can perform much better then a single large mdisk.
Preparing DASD devices for LVM
Before the physical volumes can be created, they must first be formatted and partitioned for zSeries Linux. This is done using the dasdfmt and fdasd commands.
- To see the DASD devices recognized by Linux, issue the following command:
# cat /proc/dasd/devices
0201(ECKD) at ( 94: 0) is dasda : active at blocksize: 4096, 36000 blocks, 140 MB
0202(ECKD) at ( 94: 4) is dasdb : active at blocksize: 4096, 564840 blocks, 2206 MB
0203(ECKD) at ( 94: 8) is dasdc : active at blocksize: 4096, 36000 blocks, 140 MB
0204(ECKD) at ( 94: 12) is dasdd : active at blocksize: 4096, 36000 blocks, 140 MB
- To format a single DASD device, a block size of 4 KB is recommended. Use the following command:
# dasdfmt -b 4096 -d cdl -f /dev/dasdc
Drive Geometry: 200 Cylinders * 15 Heads = 3000 Tracks
I am going to format the device /dev/dasdc in the following way:
Device number of device : 0x203
Labelling device : yes
Disk label : VOL1
Disk identifier : 0X0203
Extent start (trk no) : 0
Extent end (trk no) : 2999
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
Formatting the device. This may take a while (get yourself a coffee).
Finished formatting the device.
Rereading the partition table... ok
Answer yes to the query.
- To create a single partition from a formatted DASD, use the -a flag of the fdasd command. If the -a flag is omitted, an interactive formatting session similar to the PC fdisk command is invoked, as follows:
# fdasd -a /dev/dasdc
auto-creating one partition for the whole disk...
writing volume label...
rereading partition table..
Setting up LVM
Once the DASD devices have been formatted and partitioned, LVM can be installed on the devices. Use the following commands to create a logical volume consisting of the /dev/dasdc1 and /dev/dasdd1 devices.
- Create physical volumes for each DASD that will be included in the logical volume. This can be done for all DASD by using one command, or one at a time by using multiple pvcreate commands, as follows:
# pvcreate /dev/dasdc1 /dev/dasdd1
pvcreate -- physical volume "/dev/dasdc1" successfully created
pvcreate -- physical volume "/dev/dasdd1" successfully create
- Show the currently defined physical volumes by using the pvscan command:
pvscan -- reading all physical volumes (this may take a while...)
pvscan -- inactive PV "/dev/dasdc1" is in no VG [140.53 MB]
pvscan -- inactive PV "/dev/dasdd1" is in no VG [140.53 MB]
pvscan -- total: 2 [281.06 MB] / in use: 0  / in no VG: 2 [281.06 MB]
- Create the volume group by using the vgcreate command. All physical volumes to be included in the group must be specified in the command, as follows:
# vgcreate lvmdata /dev/dasdc1 /dev/dasdd1
vgcreate -- INFO: using default physical extent size 4 MB
vgcreate -- INFO: maximum logical volume size is 255.99 Gigabyte
vgcreate -- doing automatic backup of volume group "lvmdata"
vgcreate -- volume group "lvmdata" successfully created and activated
- Display the volume group just created by using the vgdisplay command, as follows:
# vgdisplay /dev/lvmdata
--- Volume group ---
VG Name lvmdata
VG Access read/write
VG Status available/resizable
VG # 0
MAX LV 256
Cur LV 0
Open LV 0
MAX LV Size 255.99 GB
Max PV 256
Cur PV 2
Act PV 2
VG Size 272 MB
PE Size 4 MB
Total PE 68
Alloc PE / Size 0 / 0
Free PE / Size 68 / 272 MB
VG UUID fxozbU-5VqJ-v5FG-LfIV-JcyK-1Jbh-KHXd2N
The reported VG SIZE is used in the next step
- Create a logical volume using the VG SIZE noted above:
# lvcreate -L 272M -n vol1 lvmdata
lvcreate -- doing automatic backup of "lvmdata"
lvcreate -- logical volume "/dev/lvmdata/vol1" successfully created
- Display the logical volume just created by using the lvdisplay command, as follows:
# lvdisplay /dev/lvmdata/vol1
--- Logical volume ---
LV Name /dev/lvmdata/vol1
VG Name lvmdata
LV Write Access read/write
LV Status available
LV # 1
# open 0
LV Size 272 MB
Current LE 68
Allocated LE 68
Allocation next free
Read ahead sectors 1024
Block device 58:00
After the logical volume is created, a file system can be installed on it. For the ext3 file system, use the mkfs.ext3 or, as in the following example, the mke2fs command:
# mke2fs -j /dev/lvmdata/vol1
The file system can now be mounted, as follows:
# mkdir /data
# mount /dev/lvmdata/vol1 /data
This material has not been submitted to any formal IBM test and is published AS IS. It has not been the subject of rigorous review. IBM assumes no responsibility for its accuracy or completeness. The use of this information or the implementation of any of these techniques is a client responsibility and depends upon the client's ability to evaluate and integrate them into the client's operational environment.