Skip to content

Profile::Swap fails on instances with large RAM and small root volume #245

Description

@akuzminsky

Problem

On instances with very large amounts of RAM (e.g., c5.metal with 192 GB), the swap profile attempts to create a swap file proportional to RAM size (~377 GB). This fails when the root volume is too small to accommodate it.

Observed on

  • Instance type: c5.metal (192 GB RAM)
  • Root volume: 30 GB
  • The root filesystem filled to 100%

Error

Notice: /Stage[main]/Profile::Swap/Exec[create_swap_file]/returns: fallocate: fallocate failed: No space left on device
Error: '/usr/bin/fallocate -l 404804878336 /swapfile' returned 1 instead of one of [0]
Error: /Stage[main]/Profile::Swap/Exec[create_swap_file]/returns: change from 'notrun' to ['0'] failed

Impact

  • Root filesystem fills to 100%, potentially breaking other services
  • Puppet run fails with dependency errors downstream of swap creation

Suggested Fix

Cap the swap file size to a reasonable maximum (e.g., 4-8 GB) or skip swap creation entirely when available RAM exceeds a threshold. On a 192 GB instance, swap is unnecessary.

For example:

  • If RAM > 32 GB, cap swap at 4 GB (or skip entirely)
  • Or cap swap at min(2 * RAM, available_disk_space * 0.5)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions