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

E Customizing Guest vServer Images

This appendix describes how to customize guest vServer images based on your specific requirements. The tasks described in this appendix are optional.

It contains the following sections:

E.1 Important Notes Before You Begin

Read the following notes before you start modifying Exalogic VM images:

E.2 Adding RPMs

This section describes how to add RPMs to an existing Exalogic VM image. It contains the following topics:

E.2.1 Adding RPMs Using modifyjeos

Note:

modifyjeos does not work for LVM-based templates. For such templates, use the manual method described in Section E.2.2.

To add RPMs using modifyjeos, complete the following steps:

  1. Add the names of the new RPMs in a list file, such as addrpms.lst. In this file, you should list each new RPM in a separate line.

  2. Ensure that all of the new RPMs are in a single directory, such as rpms.

  3. Run the following command to add the new RPMs:

    # modifyjeos -f System.img -a <path_to_addrpms.lst> -m <path_to_rpms> -nogpg

    In this command, <path_to_addrpms.lst> is the path to the location of the addrpms.lst file, and <path_to_rpms> is the path to the directory that contains the RPMs. The -nogpg option eliminates signature check on the RPMs.

E.2.2 Adding RPMs Manually

To add an RPM manually, complete the following steps:

  1. Ensure that the VM is not running.

  2. Mount the System.img file, as described in Section E.7.1, "Mounting System.img."

  3. Run the following command to install the RPM on the mounted image:

    # chroot <path_to_mounted_System.img> /bin/bash -c 'rpm -i <path_to_rpm>'

    In this command, <path_to_mounted_System.img> is the path to the mount location, and <path_to_rpm> is the path to the RPM file. Ensure the RPM file is in the mount directory of System.img.

  4. Unmount the System.img file, as described in Section E.7.2, "Unmounting System.img."

E.3 Removing RPMs

This section describes how to remove RPMs from an existing Exalogic VM image. It contains the following topics:

Note:

Exercise caution when removing RPMs from an existing Exalogic VM image. The Exalogic VM image contains application artifacts and critical files in addition to the operating system.

RPMs That Must Not be Modified or Removed

Do not modify or delete the following RPMs outside of an Exalogic release, a patch set update (PSU), or a patch:

Key RPMs That Are Necessary for vServers to Work

Do not delete the following RPMs, which are necessary for vServers to function in the Exalogic environment. However, you can update these RPMs to latest versions (through yum update, for example) outside of Exalogic releases, PSUs, and patches, to address security or other issues. The following RPMs depend on other RPMs on the system. So exercise caution when removing any RPMs for minimizing or hardening the system.

Yum Exclusion List

Use the following exclusion list in /etc/yum.conf for updating the vServer. This exclusion list includes all the RPMs listed in "RPMs That Must Not be Modified or Removed.".

exclude=compat-dapl* dapl* ib-bonding* ibacm* ibsim* ibutils* infiniband-diags*
initscripts* kernel* kmod-ovmapi-uek* libibcm* libibmad* libibumad* libibverbs*
libmlx4* libovmapi* librdmacm* libsdp* mpi-selector* mpitests_openmpi_gcc*
mstflint* nfs-utils* ofed* openmpi_gcc* opensm* ovm-template-config* ovmd*
perftest* qperf* rds-tools* sdpnetstat* srptools* xenstoreprovider*

E.3.1 Removing RPMs Using modifyjeos

Note:

modifyjeos does not work for LVM-based templates. For such templates, use the manual method described in Section E.3.2.

To remove RPMs by using modifyjeos, complete the following steps:

  1. Add the names of the RPMs (the ones you want to remove) in a list file, such as removerpms.lst. In this file, you must list each RPM in a separate line. Do not add the .rpm extension to the names of the RPMs.

  2. Run the following command to remove the RPMs:

    # modifyjeos -f System.img -e <path_to_removerpms.lst>

    In this command, <path_to_removerpms.lst> is the path to the location of the removerpms.lst file.

E.3.2 Removing RPMs Manually

To remove an RPM manually, complete the following steps:

  1. Ensure that the VM is not running.

  2. Mount the System.img file, as described in Section E.7.1, "Mounting System.img."

  3. Run the following command to remove the RPM from the mounted image:

    # chroot <path_to_mounted_System.img> /bin/bash -c 'rpm -e <rpmname>'

    In this command, <path_to_mounted_System.img> is the path to the mount location, and <rpmname> is the name of the RPM that you want to remove.

  4. Unmount the System.img file, as described in Section E.7.2, "Unmounting System.img."

E.4 Adding Disks

This section describes how to add a disk to an existing Exalogic VM image. It contains the following topics:

E.4.1 Example Procedure: Adding a 10 GB Disk Using modifyjeos

To add a 10 GB disk, such as ExtraDisk.img, to an Exalogic VM image using modifyjeos, complete the following steps:

Note:

This procedure applies to guest vServers created by using version 2.0.4.x.x (or earlier) of the Exalogic Guest Base Template. For guest vServers creating using v2.0.6.x.x of the Exalogic Guest Base Template, you can manage disks by using LVM commands, as described in Appendix F, "Managing LVM Partitions on Guest vServers."

  1. Run the following command to add a 10 GB disk:

    # modifyjeos -f System.img -P ExtraDisk.img 10240 <mount_location>

    In this command, <mount_location> is the path to the location at which you want to mount the new disk (ExtraDisk.img) on System.img.

  2. Ensure that the vm.cfg file for the VM references the new disk as follows:

    disk = ['file:<Path_to_System.img>,hda,w',
            'file:<Path_to_ExtraDisk.img>,hdb,w'] 
    

    In this command, <path_to_System.img> is the path to the mount location, and <path_to_ExtraDisk.img> is the path to ExtraDisk.img mounted on System.img.

E.4.2 Example Procedure: Adding a 10 GB Disk Manually

To manually add a 10 GB disk, such as ExtraDisk.img, to an Exalogic VM image, complete the following steps:

Note:

This procedure applies to guest vServers created by using version 2.0.4.x.x (or earlier) of the Exalogic Guest Base Template. For guest vServers creating using v2.0.6.x.x of the Exalogic Guest Base Template, you can manage disks by using LVM commands, as described in Appendix F, "Managing LVM Partitions on Guest vServers."

  1. Ensure that the VM is not running.

  2. Create a blank disk as follows:

    # dd if=/dev/zero of=ExtraDisk.img bs=1M count=10240

    This example uses a 10 GB disk. You can create a disk of your desired size.

  3. Edit the vm.cfg file to include the new disk:

    # vi vm.cfg
    ...
    disk = ['file:<Path_to_System.img>,hda,w',
            'file:<Path_to_ExtraDisk.img>,hdb,w']... 
    

    In this command, <path_to_System.img> is the path to the mount location, and <path_to_ExtraDisk.img> is the path to ExtraDisk.img mounted on System.img.

  4. Start the VM.

  5. Find the device with the new disk by running the following command:

    # cat /proc/partitions

    This example procedure uses the /dev/xvdb device.

  6. Make the disk ext3 as follows:

    # mkfs.ext3 /dev/xvdb

  7. Edit the /etc/fstab file to add the mount point for the disk:

    /dev/xvdb     /<mount_point>     ext3     defaults     1 2 
    
  8. Mount the disk either by restarting the VM or by running the following command:

    # mount -t ext3 /dev/xvdb <mount_point>

E.5 Example Procedure: Modifying Current Disk Size

This section describes how to modify the current disk size using modifyjeos. In the following example, the default disk size (4 GB) is modified to 10 GB:

# modifyjeos -f System.img -I 10240

Note:

This procedure applies to guest vServers created by using version 2.0.4.x.x (or earlier) of the Exalogic Guest Base Template. For guest vServers creating using v2.0.6.x.x of the Exalogic Guest Base Template, you can manage disks by using LVM commands, as described in Appendix F, "Managing LVM Partitions on Guest vServers."

E.6 Modifying Swap

This section describes how to modify the swap size (in MB). It contains the following topics:

E.6.1 Example Procedure: Modifying Swap Size Using modifyjeos

You can modify the current swap size using modifyjeos. In the following example, the default swap size (512 MB) is modified to 1 GB:

Note:

This procedure applies to guest vServers created by using version 2.0.4.x.x (or earlier) of the Exalogic Guest Base Template. For guest vServers creating using v2.0.6.x.x of the Exalogic Guest Base Template, you can manage disks by using LVM commands, as described in Appendix F, "Managing LVM Partitions on Guest vServers."

# modifyjeos -f System.img -S 1024

When you start the VM after modifying the swap size, it may start without any active swap. To fix this problem, complete the following steps:

  1. Verify the label by running the following command:

    # cat /etc/fstab

  2. Look for a line starting with LABEL=SWAP and make sure that it is LABEL=SWAP-VM. If not, change it by editing the /etc/fstab file.

  3. Reboot the VM. The swap should become active.

E.6.2 Example Procedure: Adding Swap Manually

To add swap manually (for example, 1 GB), complete the following steps:

Note:

This procedure applies to guest vServers created by using version 2.0.4.x.x (or earlier) of the Exalogic Guest Base Template. For guest vServers creating using v2.0.6.x.x of the Exalogic Guest Base Template, you can manage disks by using LVM commands, as described in Appendix F, "Managing LVM Partitions on Guest vServers."

  1. Create a swap file as follows:

    # dd if=/dev/zero of=<path_to_swap_file> bs=1M count=1024

    This example uses a 1 GB swap. You can create a swap file of your desired size.

  2. Run the following commands:

    # mkswap <path_to_swap_file>

    # swapon <path_to_swap_file>

  3. Add an entry to the /etc/fstab file to persist the swap file in the case of reboots:

    <path_to_swap_file>     swap     swap     defaults     0 0 
    

E.7 Mounting and Unmounting System.img

This section describes how to mount and unmount System.img for Logical Volume Manager (LVM) vServers and non-LVM vServers

E.7.1 Mounting System.img

This section describes how to mount System.img for LVM-based vServers and non-LVM vServers.

E.7.1.1 Mounting System.img for Non-LVM vServers

You can mount System.img and directly modify the mounted files. To mount System.img, do the following:

Note:

This procedure applies to guest vServers created by using version 2.0.4.x.x (or earlier) of the Exalogic Guest Base Template. For guest vServers creating using v2.0.6.x.x of the Exalogic Guest Base Template, you can manage disks by using LVM commands, as described in Appendix E, "Mounting System.img for LVM-Based vServers."

  1. Create a script, say MountSystemImg.sh, containing the following code:

    #!/bin/sh
    # Export for later, i.e. during unmount
    export LOOP=`losetup -f`
    export SYSTEMIMG=/mount/point
    # Create temporary mount directory
    mkdir -p $SYSTEMIMG
    # Create a loop for the system image
    losetup $LOOP System.img
    kpartx -a $LOOP
    mount /dev/mapper/`basename $LOOP`p2 $SYSTEMIMG
    #Change directory to the mounted image
    cd $SYSTEMIMG
    
  2. Run MountSystemImg.sh from the directory containing the System.img file.

E.7.1.2 Mounting System.img for LVM-Based vServers

You can mount System.img and directly modify the mounted files. To mount System.img, do the following:

  1. Ensure LVM is installed on the mount host.

  2. Create a script, say MountSystemImg.sh, containing the following code:

    #!/bin/sh
    
    export LOOP=`losetup -f`
    losetup $LOOP path_to_system.img
    kpartx -a $LOOP
    lvm pvscan
    lvm vgchange -ay
    mount /dev/mapper/VolGroup00-LogVol00 mount_location
    

    This example uses the default template disk name VolGroup00. mount_location is the path to the location at which you want to mount the image.

  3. If you are mounting the image on an Oracle VM Server node, there may be a name conflict with VolGroup00. You must temporarily rename the host by adding the following command to the MountSystemImg.sh script, in the line after #!/bin/sh:

    lvm vgrename VolGroup00 VolGroupTmp1  
    
  4. Run MountSystemImg.sh from the directory containing the System.img file.

E.7.2 Unmounting System.img

This section describes how to unmount Exalogic VM images for LVM-based vServers and non-LVM vServers.

E.7.2.1 Unmounting System.img for Non-LVM vServers

To unmount System.img for non-LVM vServers, do the following:

Note:

This procedure applies to guest vServers created by using version 2.0.4.x.x (or earlier) of the Exalogic Guest Base Template. For guest vServers creating using v2.0.6.x.x of the Exalogic Guest Base Template, you can manage disks by using LVM commands, as described in Appendix E, "Unmounting System.img for LVM-Based vServers."

  1. Create a script, say UnmountSystemImg.sh, containing the following code:

    #!/bin/sh
    # Assuming $LOOP and $SYSTEMIMG exist from a previous run of MountSystemImg.sh
    umount $SYSTEMIMG
    kpartx -d $LOOP
    losetup -d $LOOP
    
  2. Run UnmountSystemImg.sh from the directory containing the System.img file.

E.7.2.2 Unmounting System.img for LVM-Based vServers

To unmount System.img for LVM-based vServers, do the following:

  1. Create a script, say UnmountSystemImg.sh, containing the following code:

    #!/bin/sh
    
    # Assuming $LOOP exists from a previous run of MountSystemImg.sh
    umount /mount/point
    lvm vgchange -an
    kpartx -d $LOOP
    losetup -d $LOOP
    
  2. If you renamed the template disk in step 3 of Section E.7.1.2, "Mounting System.img for LVM-Based vServers", add the following command to the UnmountSystemImg.sh script, in the line after #!/bin/sh:

    lvm vgrename VolGroupTmp1 VolGroup00
    
  3. Run UnmountSystemImg.sh from the directory containing the System.img file.