Skip Headers
Oracle® Exalogic Elastic Cloud Administrator's Guide
Release EL X2-2, X3-2, and X4-2

E25258-13
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

F Managing LVM Partitions on Guest vServers

The local disks on guest vServers that you create by using the EECS 2.0.6.x.x Guest Base Template use Logical Volume Manager (LVM)-based partitioning, which gives the administrator more flexibility in allocating disk space to applications and users. This appendix provides a few example procedures for managing the LVM-based partitions on guest vServers.

This appendix contains the following sections:

For more information about using LVM to manage partitions, go to:

http://www.howtoforge.com/linux_lvm

F.1 Increasing the Size of the Root Partition

This section describes how to increase the size of the default logical volume VolGroup00-LogVol00 mounted at the root "/" directory of a guest vServer.

Note:

The procedure described here is relevant to vServers created by using the EECS 2.0.6.x.x Guest Base Template. Do not use this procedure to modify the disks of vServers creating using a Guest Base Template that is earlier than EECS version 2.0.6.0.0.

  1. Create a volume (say, 100 GB), as described in Section 9.2.6, "Creating Volumes."

  2. Attach the volume to the vServer, for which you want to modify the size of the root partition, as described in Section 9.2.13, "Attaching Volumes to a vServer."

  3. Log in, as the root user, to the vServer.

  4. Examine the current partitioning by running the following commands:

    # df -h
    

    The following is an example of the output of this command:

    Filesystem                       Size  Used Avail Use% Mounted on
    /dev/mapper/VolGroup00-LogVol00  5.1G  3.3G  1.6G  68% /
    /dev/xvda1                        99M   23M   71M  25% /boot
    tmpfs                            4.0G     0  4.0G   0% /dev/shm
    
  5. Examine the available physical volumes on the vServer by running the following command:

    # cat /proc/partitions
    major minor  #blocks  name
     
     202        0    6145024 xvda
     202        1     104391 xvda1
     202        2    6040440 xvda2
     253        0    5505024 dm-0
     253        1     524288 dm-1
     202       16  104857600 xvdb
    

    /dev/xvdb is the newly attached volume.

  6. Run the fdisk command, as shown in the following example:

    Note:

    The user input required at various stages while running the fdisk command is indicated by bold text.

    # fdisk /dev/xvdb
    Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
    Building a new DOS disklabel. Changes will remain in memory only,
    until you decide to write them. After that, of course, the previous
    content won't be recoverable.
    
    The number of cylinders for this disk is set to 13054.
    There is nothing wrong with that, but this is larger than 1024,
    and could in certain setups cause problems with:
    1) software that runs at boot time (e.g., old versions of LILO)
    2) booting and partitioning software from other OSs
    (e.g., DOS FDISK, OS/2 FDISK)
    Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
    Command (m for help): p
     
    Disk /dev/xvdb: 107.3 GB, 107374182400 bytes
    255 heads, 63 sectors/track, 13054 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
     
        Device Boot      Start         End      Blocks   Id  System
     
    Command (m for help): n
    Command action
       e   extended
       p   primary partition (1-4)
    p
    Partition number (1-4): 1
    First cylinder (1-13054, default 1):
    Using default value 1
    Last cylinder or +size or +sizeM or +sizeK (1-13054, default 13054):
    Using default value 13054
     
    Command (m for help): t
    Selected partition 1
    Hex code (type L to list codes): 8e
    Changed system type of partition 1 to 8e (Linux LVM)
     
    Command (m for help): p
     
    Disk /dev/xvdb: 107.3 GB, 107374182400 bytes
    255 heads, 63 sectors/track, 13054 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
     
        Device Boot      Start         End      Blocks   Id  System
    /dev/xvdb1               1       13054   104856223+  8e  Linux LVM
     
    Command (m for help): w
    The partition table has been altered!
     
    Calling ioctl() to re-read partition table.
    Syncing disks.
    
  7. Create a physical volume:

    # pvcreate /dev/xvdb1
      Writing physical volume data to disk "/dev/xvdb1"
      Physical volume "/dev/xvdb1" successfully created
     
     
    
  8. Extend the volume group VolGroup00 with the physical volume /dev/xvdb1:

    # vgextend VolGroup00 /dev/xvdb1
      Volume group "VolGroup00" successfully extended
     
    
  9. Extend the logical volume LogVol00:

    # lvextend -l +100%FREE /dev/VolGroup00/LogVol00
      Extending logical volume LogVol00 to 105.22 GB
      Logical volume LogVol00 successfully resized
    
  10. Resize the file system:

    # resize2fs /dev/VolGroup00/LogVol00
    resize2fs 1.39 (29-May-2006)
    Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing required
    Performing an on-line resize of /dev/VolGroup00/LogVol00 to 27582464 (4k) blocks.
    The filesystem on /dev/VolGroup00/LogVol00 is now 27582464 blocks long.
    
  11. Check whether the root partition of the guest vServer has the updated size, by running the df -h command as shown in the following example:

    # df -h
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/mapper/VolGroup00-LogVol00
                          102G  3.3G   94G   4% /
    /dev/xvda1             99M   23M   71M  25% /boot
    tmpfs                 4.0G     0  4.0G   0% /dev/shm
    

F.2 Creating a /tmp Partition

This section describes how to creating a /tmp partition on a guest vServer by using a logical volume.

Note:

The procedure described here is relevant to vServers created by using the EECS 2.0.6.x.x Guest Base Template. Do not use this procedure to modify the disks of vServers creating using a Guest Base Template that is earlier than EECS version 2.0.6.0.0.

  1. Create a volume, as described in Section 9.2.6, "Creating Volumes."

  2. Attach the volume to the vServer for which you want to modify the /tmp size, as described in Section 9.2.13, "Attaching Volumes to a vServer."

  3. Log in, as the root user, to the vServer for which you want to modify the /tmp size, and verify whether the volume is attached.

    # cat /proc/partitions
    major minor  #blocks  name
    202        0    6145024 xvda
    202        1     104391 xvda1
    202        2    6040440 xvda2
    253        0    5505024 dm-0
    253        1     524288 dm-1
    202       16    16777216 xvdb
    

    The output should contain a line similar to the last line (xvdb in this example), which is the partition corresponding to the volume that you attached.

  4. Format the partition as an LVM-type partition.

    Note:

    The user input required at various stages in this step is indicated by bold text.

    # fdisk /dev/xvdb
    Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
    Building a new DOS disklabel. Changes will remain in memory only,
    until you decide to write them. After that, of course, the previouscontent won't be recoverable.
    Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
    
    Command (m for help): n
    Command action
    e   extended
    p   primary partition (1-4)
    p
    Partition number (1-4): 1
    First cylinder (1-522, default 1): Press Enter
    Last cylinder or +size or +sizeM or +sizeK (1-522, default 522): Press Enter
    Using default value 522
    
    Command (m for help): t
    Hex code (type L to list codes): 8e
    Changed system type of partition 2 to 8e (Linux LVM)
    
    Command (m for help): w
    The partition table has been altered!
    
    Calling ioctl() to re-read partition table.
    Syncing disks.
    
  5. Show the current physical volumes on the disk:

    # pvdisplay
    --- Physical volume ---
    PV Name               /dev/xvda2
    VG Name               VolGroup00
    PV Size               5.76 GB / not usable 10.87 MB
    Allocatable           yes (but full)
    PE Size (KByte)       32768
    Total PE              184
    Free PE               0
    Allocated PE          184
    PV UUID               SaMlQo-Ct55-8IhX-ZEaf-rT4X-gISK-XEwdvc
    
  6. Create a physical volume using the new partition:

    # pvcreate /dev/xvdb1
      Writing physical volume data to disk "/dev/xvdb1"
      Physical volume "/dev/xvdb1" successfully created
    
  7. Verify the new physical volume:

    # pvdisplay
    --- Physical volume ---
    PV Name               /dev/xvdb1
    VG Name
    PV Size               15.99 GB / not usable 2.74 MB
    Allocatable           yes (but full)
    PE Size (KByte)       4096
    Total PE              4094
    Free PE               0
    Allocated PE          4094
    PV UUID               o2HIse-1gsv-lzdk-YEC1-rXKq-4Fkg-8RN2rL
    
    --- Physical volume ---
    PV Name               /dev/xvda2
    VG Name               VolGroup00
    PV Size               5.76 GB / not usable 10.87 MB
    Allocatable           yes (but full)
    PE Size (KByte)       32768
    Total PE              184
    Free PE               0
    Allocated PE          184
    PV UUID               SaMlQo-Ct55-8IhX-ZEaf-rT4X-gISK-XEwdvc
    
  8. Create a volume group for the new physical volume:

    # vgcreate myVolGroup /dev/xvdb1
    
  9. Activate the new volume group:

    # vgchange -a y myVolGroup
    
  10. Create a logical volume:

    # lvcreate -l 4094 myVolGroup -n myVolGroup-LogVol00
    
  11. Change the type of the new logical volume to ext3:

    # mkfs.ext3 /dev/myVolGroup/myVolGroup-LogVol00
    
  12. Mount the logical volume to /tmp:

    # mount /dev/myVolGroup/myVolGroup-LogVol00  /tmp/
    
  13. Verify whether /tmp has the modified space.

    # df -h
    Filesystem                                   Size  Used Avail Use% Mounted on
    /dev/mapper/VolGroup00-LogVol00              5.1G  3.3G  1.6G  68% /
    /dev/xvda1                                    99M   23M   71M  25% /boot
    tmpfs                                        2.0G     0  2.0G   0% /dev/shm
    /dev/mapper/myVolGroup-myVolGroup-LogVol00    16G  173M   15G   2% /tmp
    

F.3 Increasing the Swap Space

This section describes how to increase the swap space on a guest vServer by using LVM commands.

Note:

The procedure described here is relevant to vServers created by using the EECS 2.0.6.x.x Guest Base Template. Do not use this procedure to modify the disks of vServers creating using a Guest Base Template that is earlier than EECS version 2.0.6.0.0.

  1. Create a volume as described in Section 9.2.6, "Creating Volumes."

  2. Attach the volume to the vServer for which you want to modify the swap space, as described in Section 9.2.13, "Attaching Volumes to a vServer."

  3. Log in, as the root user, to the vServer for which you want to modify the swap space, and verify whether the volume is attached.

  4. Format the partition as an LVM-type partition.

    # fdisk /dev/xvdc
    Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
    Building a new DOS disklabel. Changes will remain in memory only,
    until you decide to write them. After that, of course, the previouscontent won't be recoverable.
    Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
    
    Command (m for help): n
    Command action
    e   extended
    p   primary partition (1-4)
    p
    Partition number (1-4): 1
    First cylinder (1-261, default 1): Press Enter
    Last cylinder or +size or +sizeM or +sizeK (1-261, default 261): Press Enter
    Using default value 261
    
    Command (m for help): t
    Hex code (type L to list codes): 8e
    Changed system type of partition 2 to 8e (Linux LVM)
    
    Command (m for help): w
    The partition table has been altered!
    
    Calling ioctl() to re-read partition table.
    
    WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
    The kernel still uses the old table.
    The new table will be used at the next reboot.
    Syncing disks.
    
  5. Create a physical volume for the partition:

    # pvcreate /dev/xvdc1
    
  6. Add the newly formatted disk to the existing volume group:

    # vgextend myVolGroup /dev/xvdc1
    
  7. Create a logical volume:

    # lvcreate -l 511 myVolGroup -n myVolGroup-LogVol01
    
  8. Format the logical volume for swap use:

    # mkswap /dev/myVolGroup/myVolGroup-LogVol01
    
  9. Enable swap:

    # swapon /dev/myVolGroup/myVolGroup-LogVol01
    
  10. Verify the updated swap space by either using the top command, or by examining the /proc/swaps file as shown in the following example:

    ]# cat /proc/swaps
    Filename Type Size Used Priority
    /dev/mapper/VolGroup00-LogVol01 partition 524280 0 -1
    /dev/mapper/myVolGroup-myVolGroup--LogVol01 partition 2093048 0 -2