# Overallocating memory to a VM

## Prerequisites

## 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. Update the Overcommit Percentage value.
4. Click Save.
5. **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
      ```
      ```
6. 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.
