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 add swap switching Partition in linux system

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the linux system how to increase the swap exchange partition, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

If you want to add a swap swap partition in a linux system, how do you add it?

1. First, click "starter" on the dock bar, find the "depth terminal" and run it.

2. Then set the password to the root user, because the installation process is the administrator user, and the root password is not set.

Sudo passwd root

3. After the setting is completed, execute the su command to switch to the root user

4, execute the following command, generate swap file in the root directory, set the number of blocks by count, set the block size by bs, and generate 4G swap.

Dd if=/dev/zero of=/swapfile count=4096 bs=1024k

5. Next, you need to set it to swap partition (the path is the same as the path above).

Mkswap / swapfile

6. Mount the swap partition (the path is the same as the path above).

Swapon / swapfile

7. Execute the top command at this time to see the corresponding swap partition information.

2. Automatically mount swap when powered on

1. Next, to mount automatically when booting, open the fstab file with vim:

Vim / etc/fstab

2. Press the G key, switch to the end of the file, and append the following

/ swapfile swap swap defaults 0 0

3. The wq command saves and exits vim.

4. Restart the computer and you can see the effect.

Note:

If you don't assign a swap swap partition, it's easy to stutter.

Thank you for reading this article carefully. I hope the article "how to add swap Exchange Partition in linux system" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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