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 increase swap space in Linux

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

Share

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

This article introduces the relevant knowledge of "how to increase swap space in Linux". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

In the installation of Linux, do not know how much swap space allocation is better, so will be allocated casually, in the real use, such as installing Oracle10g will require a lot of swap space, found that swap space is not enough, then how to increase the size of swap space.

The following operations should be done under the root user. First, create a partition and use the dd command such as

Dd if=/dev/zero of=/home/swap bs=1024 count=512000

This creates a partition file such as / home/swap. The size of the file is 512000 block, and normally 1 block is 1K, so the space here is 512m. Then change this partition to the swap partition.

/ sbin/mkswap / home/swap

Then use this swap partition. Make it a valid state.

/ sbin/swapon / home/swap

Now take a look at the memory and swap partition size with the free-m command, and you can see that 512m of space has been added. However, when the computer restarted, it was found that the swap was still as big as before, and the new swap did not start automatically, but manually. Then we need to modify the / etc/fstab file by adding the following line

/ home/swap swap swap defaults 0 0

You will find that the swap space increases after your machine starts automatically.

This is the end of the content of "how to add swap space in Linux". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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