Dynamically adding disks to a Linux partition

 

Virtual devices simplify hardware configuration on the iSeries™ 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 partition, with a maximum of twenty disks visible to Linux, depending on which distribution you use. Each disk supports up to 1000 GB of storage. Each virtual disk appears to Linux as a single physical unit. However, the associated space in the i5/OS® integrated file system is spread across all of the disk arms available on the iSeries server. This provides the benefits of RAID without the overhead of RAID support in the Linux kernel.

i5/OS provides the ability to dynamically add virtual disks to a Linux partition. You can allocate disk space in the integrated files system and make it available to Linux without restarting i5/OS or Linux. The Linux server administrator can also configure the newly allocated disk space and make it available, again without interrupting the server. To dynamically add virtual disks to a Linux partition, do the following:

  1. Create a disk drive using iSeries Navigator.

    1. Click Integrated Server Administration.

    2. Right-click the All Virtual Disks folder and click New Disk.

    3. In the Disk drive name field, specify a disk drive name.

    4. In the Description field, specify a description of this disk.

    5. If you want to copy data from another disk, select Initialize disk with data from another disk. Then specify the source disk to copy data from.

    6. In the Capacity field, specify the disk capacity.

    7. Click OK.

  2. Link a disk drive using iSeries Navigator.

    1. Click Integrated Server Administration > All Virtual Disks.

    2. Right-click an available disk drive and select Add Link.

    3. Select the server that you want to link the disk to.

    4. Select one of the available link types and the link sequence position.

    5. Select one of the available data access types.

    6. Click OK.

  3. Determine the device name of the new disk. As far as i5/OS is concerned, the space is available to the Linux partition. Now you need to run through a couple of steps within Linux to partition, format, and access the disk. The name depends on two factors:

    • The distribution of Linux

    • The number of disks currently allocated

    For example, with the SUSE distribution with a single disk allocated, the first disk device is known as /dev/hda. The second disk (the newly allocated virtual disk) is known as /dev/hdb.

  4. Create partitions on the new disk with the fdisk command in Linux. The fdisk command is a standard Linux command and is the same for all distributions. You must have superuser (also known as root) privileges to execute this command.

    1. From the command line, type fdisk /dev/hdb and press Enter.
    The command responds with the following prompt: Command (m for help):

  5. Type p (for print) at the prompt to display the current partition table for the disk. By default, a new virtual disk shows a single partition formatted as FAT16. For example,
    Disk /dev/hdb: 64 heads, 32 sectors, 200 cylinders Units = cylinders of 2048 * 512 bytes 
    Device Boot    Start       End    Blocks   Id   System /dev/hdb1          1       199    203760    6   FAT16

  6. Delete the partition. The FAT16 partition is not required. You need to delete the current partition and then create a new one.

    1. To delete the partition, Type d at the command prompt.
    The fdisk command responds with the following prompt: Partition number (1-4):

  7. Enter the partition number (in this case, 1), and press Enter. The fdisk prompt returns a message indicating that the deletion was successful.

  8. Create a new partition.
    1. Type the command n for a new partition. The fdisk prompt returns the following:
      Command action E   extended P   primary partition (1-4)
    2. Type the command p and press Enter. The fdisk prompt returns the following:
      Partition number (1-4):
    3. Since this is the first partition on the disk, enter 1 and press Enter. The fdisk prompt returns the following:
      First cylinder (1-200, default 1):
    4. Type 1 and press Enter. The fdisk prompt returns the following:
      Last cylinder or +size or +sizeM or +sizeK (1-200, default 200):
    5. Type 200 and press Enter. The fdisk prompt appears again, indicating that the partition creation was successful.

      The type of the partition defaults to Linux. If you need a different disk type (like LVM, or Linux Extended), use the t (for type) command to change the type of the partition.

  9. Type w (for write) to commit the changes and press Enter. Up until this point, you have made no changes to the disk structure. After you commit the changes, fdisk responds with the following diagnostic messages:
    The partition table has been altered!
    	
    Calling ioctl() to re-read partition table.
    Syncing disks.

  10. Type mkfs to format the new partition. The mkfs command is a standard Linux command that should be available on each Linux distribution. There are a number of optional parameters for mkfs, but typically the defaults satisfy most disk uses. To format the partition created in the previous steps, enter the following command (again, as with the fdisk command, you need to be logged in as root to execute the mkfs command):
    mkfs /dev/hdb1

    Remember that a single partition exists on the second disk. Hence the name /dev/hdb1 (the hdb indicates that it is the second disk, and the 1 indicates that it is partition 1). The following diagnostic messages appear:

    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 backkups 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.

  11. Create a new directory. Finally, within the Linux file tree, you need to create a directory that you can use to access the new file system. You also need to allocate the new fileserver to that point within the directory tree. To do this, we create a directory and mount the physical resource as follows:

    1. Type mkdir /mnt/data and press Enter.

    2. Type mount /dev/hdb1 /mnt/data and press Enter.

  12. Add an entry. You now have new virtual disk space available to the running Linux partition. To facilitate automatic mounting of the resource across Linux starts, add an entry to the /etc/fstab file (this is the file that stores mount definitions). For this example, the entry in /etc/fstab would appear as follows:
    /dev/hdb1	/mnt/data	ext2	defaults	1 1

 

Parent topic:

Managing Linux in a logical partition