1
0
Fork 1
Quick Swap increase.
Go to file
colin 69140e1644 Update swap.sh 2024-09-13 16:43:10 -04:00
README.md Update README.md 2024-09-13 16:39:11 -04:00
swap.sh Update swap.sh 2024-09-13 16:43:10 -04:00

README.md

Here's the adjusted README format for your swap.sh script:

Swap File Creation Script

This script automatically creates a swap file on your system, allowing you to increase the available virtual memory. It calculates the optimal swap file size based on the available disk space, ensuring that the swap file does not exceed 30GB or 5% of the free disk space, whichever is smaller.

Features

  • Detects the main disk partition used by the system.
  • Calculates the optimal swap file size (up to 30GB or 5% of the free space).
  • Creates and activates a swap file at /swapfile.
  • Optionally persists the swap file across reboots by adding it to /etc/fstab.
  • Displays the status of the created swap file.

Usage

To use this script, you can execute it directly from the URL without downloading it, which is convenient for quick setup.

Execute Directly from URL

Run the script directly from the URL using curl and piping to bash:

curl -sSL https://git.nixc.us/colin/swap-increase/raw/branch/main/swap.sh | bash

Output

The script will provide the following output:

  • The calculated size of the swap file.
  • Confirmation of swap file creation and activation.
  • A prompt asking whether you want the swap file to persist after reboot.
  • Information on the current swap status using swapon --show.

Note

This script requires sudo privileges to create and activate the swap file, as well as to modify the /etc/fstab file for persistence across reboots.