Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to operate SUSE swap space swap

Shulou Source: shulou.com Published: 2022-05-31 15:08:31 10月04日 Update

In this issue, the editor will bring you about the operation of SUSE swap space swap. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.

What we are going to talk about today is the operation of SUSE exchange space swap. I hope the knowledge we talked about today will enable you to learn the operation steps of SUSE exchange space swap. Also hope that we can communicate with each other. In SUSE systems, it is customary to choose 1.5 times of the physical RAM in the system as the size of the swap space.

1 View the system swap space size:

Linux-jian:~ # free-m

Total used free shared buffers cached

Mem: 377 180 197 0 19 110

-/ + buffers/cache: 50 327

Swap: 572 0 572

2 View the current swap space (file (s) / partition (s)):

Linux-jian:~ # swapon-s

Equivalent to

Linux-jian:~ # cat / proc/swaps

3 add swap space

Two options: add a swap partition or add a swap file. It is recommended that you add a swap partition; however, if you do not have much free space available, add a swap file.

3.1 add a swap partition

The steps are as follows:

A use fdisk to create a swap partition (assuming / dev/sdb2 is a created swap partition)

B use the mkswap command to set the swap partition:

Mkswap / dev/sdb2

C enable swapping:

Swapon / dev/sdb2

D write / etc/fstab to enable at boot time:

/ dev/sdb2 swap swap defaults 0 0

3.2 add a swap file

A create a swap file with a size of 512m:

Dd if=/dev/zero of=/swapfile1 bs=1024 count=524288

B use the mkswap command to set up the swap file:

Mkswap / swapfile1

C enable swapping:

Swapon / swapfile1

D write / etc/fstab to enable at boot time:

/ swapfile1 swap swap defaults 0 0

After adding a new swap partition and enabling it, check the output of the cat / proc/swaps or free command to make sure that the swap partition is enabled.

4 delete swap space:

A disable swapping:

Swapoff / dev/sdb2

B remove items from / etc/fstab

C use the fdisk or yast tool to delete the partition.

Delete swap file steps as above

This is how the operation of the SUSE swap space swap shared by the editor is carried out. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Tags: Space file command size step system content knowledge analysis selection major small and medium communicate with each other rich in content that is tools articles more physics leisure Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Shulou Tech Info MariaDB OPPO Reno macOS