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 Creating Volumes.
  2. Attach the volume to the vServer for which you want to modify the /tmp size, as described in 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