Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to operate SUSE swap space swap

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report