Back to Legacy KVM Documentation

    Missing Swap (SolusVM)

    How to create swap space on your KVM VPS

    SolusVM KVM templates sometimes don't set up swap space correctly. This guide will help you create your swap partition.

    Important Note

    This issue is specific to SolusVM KVM VPS. Cloud instances handle swap differently and typically don't require manual configuration.

    Creating Swap Space

    To create your swap space, connect to your VPS via SSH and run the following commands:

    SSH Commands
    # Turn off the current swap
    swapoff /dev/vda2
    
    # Create the swap filesystem
    mkswap /dev/vda2
    
    # Enable the swap
    swapon /dev/vda2

    Verifying Swap

    After running the commands above, you can verify that swap is now active by running:

    Verify swap
    free -h

    You should see a non-zero value in the "Swap" row.

    Resizing Swap Partition

    If you need to resize your swap partition, you might have to use the GParted ISO available in SolusVM. To do this:

    1

    Log into SolusVM

    Access your SolusVM control panel
    2

    Mount GParted ISO

    Select the GParted ISO from available ISOs
    3

    Reboot VPS

    Reboot your VPS to boot into GParted
    4

    Resize Partition

    Use the GParted interface to resize your swap partition
    5

    Unmount and Reboot

    Unmount the ISO and reboot normally
    6

    Recreate Swap

    Run the swap creation commands again

    Backup Warning

    Before resizing partitions, always backup your important data. While partition resizing is generally safe, there's always a small risk of data loss.

    If you're seeing "cannot allocate memory" errors when trying to run updates, the missing swap space is likely the cause. See our memory allocation error guide for more information.

    Need Help?

    If you're having trouble creating swap space or resizing partitions, contact our support team. We can help troubleshoot or resize your swap partition for you.