5.6 Maintaining Virtual Machines

This section includes the following topics:

5.6.1 Viewing Virtual Machine Information and Events

You can view virtual machine details and jobs associated with the virtual machine.

To view virtual machine information details:

  1. Log on to Oracle VM Manager.

  2. Select the Servers and VMs tab.

  3. In the left pane, select the server pool on which the virtual machine resides.

  4. From the Perspective list, select Virtual Machines.

  5. In the Management pane, select a virtual machine.

  6. Click the expand arrow to the left of the selected virtual machine.

    The following tabs are displayed:

    • Configuration: Displays general information about the virtual machine, such as the minimum and maximum memory and processors, operating system, domain type, high availability status, and so on.

    • Networks: Displays networks and VNICs used in the virtual machine.

    • Disks: Displays virtual and physical disks attached to the virtual machine.

To view virtual machine events:

  1. Log on to Oracle VM Manager.
  2. Select the Servers and VMs tab.
  3. In the left pane, select the server pool on which the virtual machine resides.
  4. From the Perspective list, select Virtual Machines.
  5. In the Management pane, select a virtual machine.
  6. In the toolbar, click Display Selected VM Events.

    The Events dialog is displayed.

  7. Review the jobs associated with the virtual machine.

For more information, see "Chapter 7, Managing Virtual Machines" in Oracle VM User's Guide for Release 3.2.

5.6.2 Configuring and Starting a Virtual Machine

You start a virtual machine from Oracle VM Manager.

To configure and start a virtual machine:

  1. Log on to Oracle VM Manager.
  2. Select the Servers and VMs tab.
  3. In the left pane, select the server pool on which the virtual machine resides.
  4. From the Perspective list, select Virtual Machines.
  5. In the Management pane, select a virtual machine, and from the toolbar click the Edit.

    The Edit Virtual Machine dialog is displayed.

  6. Select the Configuration tab.
  7. Select the necessary configuration for the virtual machine, and click OK.
  8. Select the Networks tab.
  9. Select and assign a VNIC to the virtual machine, and click OK.
  10. Select the Disks tab.
  11. Select and allocate the virtual disk to the virtual machine.
  12. Click OK.
  13. From the toolbar, click Start.

    The virtual machine starts.

    Note:

    When you start the virtual machine for the first time, the virtual machine takes approximately fifteen minutes to initialize.

For more information, see "Chapter 7, Managing Virtual Machines" in Oracle VM User's Guide for Release 3.2.

5.6.3 Configuring a Network on a Virtual Machine

After starting a virtual machine, you then configure the network on the virtual machine to enable it to access the network.

To configure a network on the virtual machine:

  1. Log on to Oracle VM Server.
  2. Enter the following command:

    xm list

    The Domain-0 and UUID number for the virtual machine are displayed.

  3. Execute the following command:

    xm console <UUID_NUMBER_FOR_VIRTUAL_MACHINE>

    The console of the virtual machine is displayed.

  4. Log in as root user with default password "ovsroot".
  5. Enter the following command:

    system-config-network

  6. Edit the eth0 device by entering the following information:
    • IP addresses

    • Netmask

    • Gateway

    • DNS settings

  7. Click Save and Quit.
  8. Run the following command to reload the network configuration:

    service network reload

  9. Edit the /etc/hosts file to add the machine name and IP address.

5.6.4 Increasing SWAP on a Virtual Machine

Each VM guest is created with 1 GB of default swap space. To run Oracle Database In-Memory on an Exalytics Machine, you must increase the swap space to a minimum of 16 GB.

Note:

The following procedure describes how to increase swap space by creating a new virtual disk (/dev/xvdd) of 20 GB.

To increase SWAP on the virtual machine:

  1. Add a new virtual disk for the VM guest by performing the following actions:

    1. Log on to Oracle VM Manager.

    2. Select the Servers and VMs tab.

    3. In the left pane, select the server pool on which the virtual machine resides.

    4. From the Perspective list, select Virtual Machines.

    5. In the toolbar, click Stop to stop the virtual machine.

      Confirm that the virtual machine is stopped.

    6. In the toolbar, click Edit.

      The Edit Virtual Machine dialog is displayed.

    7. Click the Disks tab.

    8. Under Disk Type, select Virtual Disk.

    9. Under Actions, click Add.

      The Create Virtual Disk dialog is displayed.

    10. In the Virtual Disk Name field, enter a name for the virtual disk, in the Size field, enter 20, and then click OK twice.

    11. In the toolbar, click Start to start the virtual machine.

  2. Add logical volume and create additional swap on the VM guest by performing the following actions:

    1. Log on the Oracle VM Server.

    2. To check details of the new virtual disk, enter the following command:

      fdisk -l

      The details of the new virtual disk are displayed. For example, if the new virtual disk is /dev/xvdd, an output similar to the following is displayed:

      .... 
      Disk /dev/xvdd: 21.4 GB, 21474836480 bytes
      255 heads, 63 sectors/track, 2610 cylinders
      Units = cylinders of 16065 * 512 = 8225280 bytes
      
    3. To create the new partition /dev/xvdd1, enter the following command as the root user:

      # fdisk /dev/xvdd

      Output similar to the following is displayed:

      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 2610.
      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)
      
    4. At the command prompt, enter n. For example:

      Command (m for help): n

      The following output is displayed:

      Command action
         e   extended
         p   primary partition (1-4)
      p
      
    5. At the Partition number prompt, enter 1. For example:

      Partition number (1-4): 1

    6. At the First cylinder (1-2610, default 1) prompt, press Enter to use the default value.

      The following output is displayed:

      Using default value 1
      
    7. At the Last cylinder or +size or +sizeM or +sizeK (1-2610, default 2610) prompt, press Enter to use the default value.

      The following is displayed:

      Using default value 2610
      
    8. At the command prompt, enter t. For example:

      Command (m for help): t

      The following is displayed:

      Selected partition 1
      
    9. At the Hex code (type L to list codes) prompt, enter 8e.

      The following is displayed:

      Changed system type of partition 1 to 8e (Linux LVM)
      
    10. At the command prompt, enter w. For example:

      Command (m for help): w

      The following is displayed:

      The partition table has been altered!
      Calling ioctl() to re-read partition table.
      Syncing disks.
      
    11. To create the physical volume for the partition /dev/xvdd1, enter the following command:

      # pvcreate /dev/xvdd1

    12. To add the newly formatted disk to the existing volume group, enter the following command:

      # vgextend VolGroup00 /dev/xvdd1

    13. To create logical volume, enter the following command:

      # lvcreate -L 20G VolGroup00 -n LogVol03

    14. To format the logical volume for swap use, enter the following command:

      # mkswap /dev/VolGroup00/LogVol03

    15. To enable swap, enter the following command:

      swapon /dev/VolGroup00/LogVol03

    16. To verify the updated swap space, enter the following command:

      # cat /proc/swaps

      Output similar to the following is displayed:

      Filename                            Type         Size                Used    Priority
      /dev/mapper/VolGroup00-LogVol01     partition    1048572    0       -1
      /dev/mapper/VolGroup00-LogVol03     partition    20971516   0       -2
      
    17. Add the following line to the /etc/fstab file:

      /dev/VolGroup00/LogVol03 swap swap defaults 0 0

5.6.5 Increasing the Size of the Root Partition on a Virtual Machine

Each virtual machine is created by default with a 100 GB root partition. If required, you can increase the size of the default logical volume VolGroup00-LogVol00 mounted at the root "/" directory of a virtual machine.

To increase the size of the root partition on the virtual machine:

  1. Log in to the virtual machine as the root user.

  2. To check the current physical volumes on the virtual machine, enter the following command:

    # cat /proc/partitions

    Output similar to the following is displayed:

    major                             minor  #blocks   name
     
     202        0   10485760    xvda
     202        1     257008    xvda1
     202        2   10225372    xvda2
     252        0    7340032    dm-0
     252        1    1048576    dm-1
     252        2     102400    dm-2
    
  3. Add a new virtual disk for the VM guest by performing the following actions:

    Note:

    The following procedure describes how to create a new virtual disk of 100 GB.

    1. Log on to Oracle VM Manager.

    2. Select the Servers and VMs tab.

    3. In the left pane, select the server pool on which the virtual machine resides.

    4. From the Perspective list, select Virtual Machines.

    5. In the toolbar, click Stop to stop the virtual machine.

      Confirm that the virtual machine is stopped.

    6. In the toolbar, click Edit.

      The Edit Virtual Machine dialog is displayed.

    7. Click the Disks tab.

    8. Under Disk Type, select Virtual Disk.

    9. Under Actions, click Add.

      The Create Virtual Disk dialog is displayed.

    10. In the Virtual Disk Name field, enter a name for the virtual disk, in the Size field, enter 100, and then click OK twice.

    11. In the toolbar, click Start to start the virtual machine.

  4. To check the current partitioning on the virtual machine, enter the following command:

    # df -h

    Output similar to the following is displayed:

    Filesystem   Size  Used Avail Use%  Mounted on /dev/mapper/VolGroup00-LogVol00
                 6.8G  2.9G 3.7G   44%   /dev/xvda1            
                 244M  35M  197M   15%   /boottmpfs                  
                 50G    0   50G    0%    /dev/shm/dev/mapper/VolGroup00-LogVol02
                 97M  5.6M  87M    7%    /shared_agent_instance_home
    
  5. To check the new available physical volumes on the virtual machine, enter the following command:

    # cat /proc/partitions

    Output similar to the following is displayed:

    major     minor    #blocks       name
     
     202        0     10485760       xvda
     202        1     257008         xvda1
     202        2     10225372       xvda2
     202       16     104857600      xvdb
     252        0     7340032        dm-0
     252        1     1048576        dm-1
     252        2     102400         dm-2
    

    Note:

    In the above example /dev/xvdb is the newly attached disk.

  6. To partition the newly attached disk, perform the following actions:

    1. Enter the following command:

      # fdisk /dev/xvdb

      Output similar to the following is displayed:

      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)
      
    2. At the command prompt, enter p. For example:

      Command (m for help): p

      The following output is displayed:

      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
      
    3. At the command prompt, enter n. For example:

      Command (m for help): n

      The following output is displayed:

      Command action
         e   extended
         p   primary partition (1-4)
      p
      
    4. At the Partition number prompt, enter 1. For example:

      Partition number (1-4): 1

    5. At the First cylinder (1-13054, default 1) prompt, press Enter to use the default value.

      The following output is displayed:

      Using default value 1
      
    6. At the Last cylinder or +size or +sizeM or +sizeK (1-13054, default 13054) prompt, press Enter to use the default value.

      The following is displayed:

      Using default value 13054
      
    7. At the command prompt, enter t. For example:

      Command (m for help): t

      The following is displayed:

      Selected partition 1
      
    8. At the Hex code (type L to list codes) prompt, enter 8e.

      The following is displayed:

      Changed system type of partition 1 to 8e (Linux LVM)
      
    9. At the command prompt, enter p. For example:

      The following is displayed:

      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
      
    10. At the command prompt, enter w. For example:

      Command (m for help): w

      The following is displayed:

      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.
      
    11. Restart the virtual machine by performing the following actions:

      • Connect to Oracle VM Manager.

      • Select the Servers and VMs tab.

      • In the left pane, expand Server Pools, and then select the server pool containing the virtual machine.

      • Right-click the virtual machine, and select Restart.

    12. To create the physical volume, enter the following command:

      # pvcreate /dev/xvdb1

      Output similar to the following is displayed:

      Writing physical volume data to disk "/dev/xvdb1"
      Physical volume "/dev/xvdb1" successfully created
       
      
    13. To extend the volume group VolGroup00 to the physical volume /dev/xvdb1, enter the following command:

      # vgextend VolGroup00 /dev/xvdb1

      Output similar to the following is displayed:

      Volume group "VolGroup00" successfully extended
      
    14. To extend the logical volume LogVol00, enter the following command:

      # lvextend -l +100%FREE /dev/VolGroup00/LogVol00

      Output similar to the following is displayed:

      Extending logical volume LogVol00 to 105.22 GB
      Logical volume LogVol00 successfully resized
      
    15. To resize the file system, enter the following command:

      # resize2fs /dev/VolGroup00/LogVol00

      Output similar to the following is displayed:

      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 28481536 (4k) blocks.
      The filesystem on /dev/VolGroup00/LogVol00 is now 28481536 blocks long.
      
    16. To verify the resized root partition, enter the following command:

      # df -h

      Output similar to the following is displayed:

      Filesystem  Size  Used Avail Use% Mounted on/dev/mapper/VolGroup00-LogVol00
                  106G  2.9G   97G  3%    //dev/xvda1            
                  244M   35M  197M  15%   /boottmpfs                  
                  50G     0   50G   0%    /dev/shm/dev/mapper/VolGroup00-LogVol02
                  97M  5.6M   87M   7%    /shared_agent_instance_home