Lanyiyun: Linux system armbain configuration swap partition tutorial

Configuring a Swap partition is a way to increase virtual memory on a Linux system. For Armbian systems, here is a brief tutorial on configuring a Swap partition:

  1. Check the available partitions: First, check the available partitions on your system by running the following command:

sudo fdisk -l

Find an appropriate partition to create the Swap partition. Typically, you can select an unused disk partition or external storage device.

  1. Create Swap file: Create a Swap file on the selected partition. Taking a 4GB Swap file as an example, you can execute the following command:
sudo dd if=/dev/zero of=/path/to/swapfile bs=1G count=4

Will be  /path/to/swapfilereplaced with the path and name of the Swap file.

  1. Set permissions and type: Set permissions and type of Swap file. Execute the following command:
sudo chmod 600 /path/to/swapfile
sudo mkswap /path/to/swapfile
  1. Enable Swap exchange partition: To enable Swap exchange partition, execute the following command:
sudo swapon /path/to/swapfile
  1. Set up automatic mounting at startup: In order to make the Swap partition still available after the system restarts, you need to add it to  /etc/fstabthe file. Open  /etc/fstabthe file and add the following lines at the end of the file:
/path/to/swapfile none swap sw 0 0
  1. Verify configuration: Use the following command to verify the configuration of the Swap partition:
sudo swapon --show
free -h

Make sure the Swap partition appears normal and available.

After completing the above steps, the Swap exchange partition is successfully configured and enabled. It will provide the system with additional virtual memory for use when physical memory is insufficient.

Please note that the above is a brief Swap partition configuration example, and the actual situation may vary depending on your system and requirements. Make corresponding adjustments and modifications according to actual needs and specific circumstances.

Guess you like

Origin blog.csdn.net/tiansyun/article/details/132841508
Recommended