Virtual disks simplify hardware configuration on the
server because they do not require you to add additional physical
devices to the server in order to run Linux. You can allocate
up to 64 virtual disks to a Linux logical partition.
Each virtual disk supports up to 1000 GB of storage. Each virtual
disk appears to Linux as
one actual disk unit. However, the associated space in the i integrated file
system is distributed across the disks that belong to the i logical partition.
Distributing storage across the disks provides the benefits of device
parity protection through i. Therefore, you
do not have to use additional processing resources and memory resources
by setting up device parity protection through Linux.
IBM i provides the ability
to dynamically add virtual disks to a Linux logical partition.
You can allocate disk space in the integrated file system and make
it available to Linux without
restarting the server or logical partition. The Linux administrator can
also configure the newly allocated disk space and make it available
without restarting the server.
To add virtual disks dynamically
to a Linux logical
partition, do the following:
- If you use System i® Navigator,
create a network-server storage space using System i Navigator.
- Expand .
- Right-click the Disk Drives and
select New Disk.
- In the Disk drive name field,
specify the name that you want to give to the network-server storage
space.
- In the Description field, specify
a meaningful description for the network-server storage space.
- In the Capacity field, specify
the size of the new network-server storage space in megabytes. Refer to the installation documentation of your preferred Linux distributor to determine
the size you want to use.
- Click OK.
- Continue with step 4.
- If you use a character-based
interface, create a network-server storage space using the character-based
interface:
- At an IBM i
command line, type the command CRTNWSSTG and press F4. The
Create NWS Storage Space (CRTNWSSTG) display opens.
- In the Network-server storage space field, specify the
name you want to give to the network-server storage space.
- In the Size field, specify the size in megabytes for
the new network-server storage space. Refer to the installation
documentation of your preferred Linux distributor to determine
the size you want to use.
- In the Text description field, specify a meaningful
description for the network-server storage space.
- Press Enter.
- If you use System i Navigator,
link the network-server storage space using System i Navigator.
- Expand .
- Click Disk Drives, right-click
an available network-server storage space, and select Add
Link.
- Select the server to which you want to link the network-server
storage space.
- Select one of the available data access types.
- Click OK.
- Continue with step 5.
- If you use a character-based
interface, link the network-server storage space using a character-based
interface:
- At an IBM i
command line, type the command ADDNWSSTGL and press F4. The Add Network-Server Storage Link (ADDNWSSTGL) display
opens.
- In the Network server description field, specify the
name of the network server description (NWSD).
- In the Dynamic storage link field, specify *YES to make
the network-server storage space dynamically available to the logical
partition (that is, available without rebooting the Linux logical partition).
- In the Drive sequence number field, specify the link
sequence position you want to use.
- Press Enter.
- If the Linux logical
partition is not running, activate the Linux logical partition.
Do not continue until the logical partition is running.
- Log in to Linux using
a user name with superuser (root) privileges.
- Determine the host ID, SCSI bus, and logical unit number
(LUN) for your new virtual disk drive. You can list the
existing devices by typing the following command at the Linux command prompt: cat /proc/scsi/scsi.
The following example shows sample output of the command:
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: IBM Model: VDASD NETSPACE Rev: 0001
Type: Direct-Access ANSI SCSI revision: 04
In
this example, NETSPACE is the name of the network
storage space for the displayed device. Look for the name of an existing
network storage space on your Linux logical
partition. Note the numeric part of the Host: value
(host ID) and the Channel: (SCSI bus) and Lun: (logical
unit number (LUN)) values for the existing network storage space.
The new virtual disk drive will have the same host ID, SCSI bus, and
LUN as the existing network storage space. For example, if the existing
network storage space is as displayed in the preceding example output,
then the new virtual disk drive will have a host ID of 0,
a SCSI bus of 0, and a LUN of 0.
- Determine the SCSI ID for your new virtual disk drive. You can list the existing devices in table form by typing the
following commands at the Linux command
prompt:
cd /proc/scsi/sg
cat device_hdr; cat devices
The following example shows
sample output of the commands: host chan id lun type opens qdepth busy online
0 0 0 0 0 2 30 0 1
0 1 0 0 0 0 30 0 1
Note the host (host ID), chan (SCSI
bus), id (SCSI ID), and lun (logical
unit number (LUN)) values for the existing devices. Find the devices
that have the same host ID, SCSI bus, and LUN as the new virtual disk
drive (as you determined in the previous step). Of those devices,
find the device with the greatest SCSI ID. The new virtual disk drive
will have a SCSI ID that is one greater than the greatest existing
SCSI ID. For example, if the new virtual disk drive has a host ID
of 0, a SCSI bus of 0, and a LUN
of 0, and the devices on your Linux logical partition are as listed in the
example output above, then the new virtual disk drive will have a
SCSI ID of 1.
- Type the following command at the Linux command prompt to add the virtual disk
drive manually: echo "scsi add-single-device host chan id
lun" > /proc/scsi/scsi. Use the following information
to help you understand the arguments of the command:
- host is the host ID.
- chan is the SCSI bus.
- id is the SCSI ID.
- lun is the LUN.
For example, if the new virtual disk drive is
to have a host ID of 0, a SCSI bus of 0,
a SCSI ID of 1, and a LUN of 0,
you would type the command echo "scsi add-single-device 0
0 1 0" > /proc/scsi/scsi at the Linux command prompt.
- At the Linux command
prompt, type the following command to create a disk partition on the
virtual disk drive: fdisk /dev/sdb. You
must have superuser (root) privileges to run this command. The Command (m for help): prompt is displayed.
- Type p at the prompt to see the current
partition table for the virtual disk drive. By default,
the new virtual disk drive shows a single disk partition on the virtual
disk. For example,
Disk /dev/sdb: 64 heads, 32 sectors, 200 cylinders
Units = cylinders of 2048 * 512 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 199 203760 6 FAT16
- Type d at the command prompt to delete
the current partition and then create a new one. The default
format for the disk partition is FAT16. Do not use a disk partition
that is formatted as FAT16 on your virtual disk drive. The Partition number (1-4): prompt is
displayed.
- Type the disk partition number you want to delete and press
Enter. In this example, you type a 1. The fdisk command indicates that the
deletion is successful by displaying the command prompt.
- Type n to create a new disk partition. The Command action E extended P primary partition
(1-4) prompt is displayed.
- Type p to create a primary disk partition
on the virtual disk and press Enter. The Partition
number (1-4): prompt is displayed.
- Type 1 because this is the first partition
on the virtual disk, and press Enter. The First
cylinder (1-200, default 1): prompt is displayed.
- Press Enter to use the default of 1 for the first disk
cylinder. This uses the entire disk for this disk partition. The Last cylinder or +size or +sizeM or +sizeK
(1-200, default 200): prompt is displayed.
- Press Enter to use the default of 200 for the last disk
cylinder. This uses the entire virtual disk for this partition.
Note: The
type of the partition defaults to Linux. If you need a different
disk type (like Logical Volume Manager (LVM), or Linux Extended), type t to
change the type of the partition.
The fdisk command
indicates that the partition creation is successful by returning the
command prompt.
- Type w to commit the changes to the disk
structure and press Enter. The fdisk command
writes the changes to the virtual disk drive. The fdisk command
displays the following diagnostic message:
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
After the operation is completed, the
fdisk command returns the command prompt.
- Format the disk partition using the Linux mkfs command
. There are a number of optional parameters for the mkfs
command, but typically the defaults satisfy most disk uses. To format
the disk partition created in the previous steps, ensure that you
are logged in with superuser (root) privileges and type the following
command at a Linux command
prompt:
mkfs /dev/sdb1
Since a single disk
partition exists on the second virtual disk, the name of the disk
is /dev/sdb1 (the sdb indicates that it is the second disk, and the
1 indicates that it is partition 1). The mkfs command displays the
following diagnostic messages: mke2fs 1.28 (31-Aug-2002)
Fileserver label=
OS type: Linux Block size=1024 (log=0)
Fragment size=1024 (log=0)
51200 inodes, 204784 blocks
10239 blocks (5.00%) reserved for the super user
First data block=1
25 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729
Writing inode tables: done
Writing superblocks and fileserver accounting information: done
This fileserver will be automatically checked every 29 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
- Type the following command to create a directory that
you can use to access the new file: mkdir /mnt/data
- Type the following command to mount the virtual disk drive
in the new directory: mount /dev/sdb1 /mnt/data
- Add an entry to the /etc/fstab file using a Linux text editor, such
as vi. For example, /dev/sdb1 /mnt/data ext2 defaults 1
1. This entry mounts the virtual disk every time you restart Linux.