# Overallocating Memory to a Host

## Prerequisites

Ensure that the host has swap space. For details on creating swap space, see [Overallocating Memory to a Host](https://support.hpe.com/hpesc/public/api/document/sd00008014en_us/render?page=GUID-0FD5F034-5B03-4C0D-AC45-806952C6BC75.html#GUID-0FD5F034-5B03-4C0D-AC45-806952C6BC75).

## About this task

Enabling a virtual machine (VM) to use more memory than the host’s physical RAM improves flexibility and resource utilization.

Memory overallocation allow users to provide control of the memory allocation to a VM:

- Default (100%) - Only physical host-allocated memory is available.
- Below 100% - For noncritical workloads, memory can be restricted to a fraction of the physical memory
- Above 100% - Allows VM memory to extend beyond the physical memory allocation

Morpheus UI allows you to configure the overcommit setting per host. Each host reserves approximately 4 GiB of memory for the hypervisor OS, which is excluded from the overcommit ratio. If the memory usage exceeds 90%, DRS triggers memory rebalancing.

## Procedure

1. From Morpheus UI, select Compute > Host.
2. Select the host to configure and then click Edit to open the Hypervisor settings.
3. Click Advance Options and access Overcommit Percentage option.
4. Update the Overcommit Percentage value.
5. Click Save.
6. **Optional:**  Perform the following steps in the terminal to ensure that swap memory is correctly configured on the host when overcommitting memory beyond 100%.
   1. Check for existing swap: 

      ```
      ```
      swapon --show
      ```
      ```
   2. If no swap file exists, create one: 

      This example creates a 10 GiB swap file.

      ```
      ```
      sudo dd if=/dev/zero of=/swapfile bs=1G count=10 sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile </codeblock>  
      <p cid="1qmlVn">
      ```
      ```
   3. Verify that swap is active: 

      ```
      ```
      swapon --show
      ```
      ```
7. Select Compute > Host to verify the updated max memory.

## Results

The memory allocation is adjusted when provisioning a new VM or when managing an existing instance.
