In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Today, I will talk to you about how the Linux system adjusts the size of swap. Many people may not know much about it. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something according to this article.
When deploying services, such as the installation of the Oracle database, the Linux swap partition swap size will be required. Some Linux systems are installed without configuring the swap partition, resulting in a swap partition of 0, or the swap partition is small, which does not meet the service deployment requirements, so you need to manually adjust the Linux swap partition.
1. Swap partition is 0
1. Create a swap partition file (using the root user action):
There are two ways:
(1) use the dd command to create:
# 4G swap partition dd if=/dev/zero of=/usr/swapfile bs=1G count=4
(2) use the fallocate command to create:
# 4G swap partition fallocate-l 4G / usr/swapfile
The first way is common, the disadvantage is slow, and the second is fast.
two。 Enable swap partition files:
First, modify the permissions of the swapfile file:
Chmod 600 / usr/swapfile
Initialize swapfile as a swap file:
Mkswap / usr/swapfile
Then open swap.
Swapon / usr/swapfile
Check to see if the configuration is successful:
Free-g
3. Configure system restart to automatically hang on:
Hang the swap partition in the information write / etc/fstab file
[root@local ~] # vim / etc/fstab/usr/swapfile swap swap defaults 0 0
II. Swap partition resizing
1. Create a swap partition file that meets the required size
(dd method is used this time):
# 8 gigabyte swap partition dd if=/dev/zero of=/usr/swapfile bs=1G count=8
two。 Configure the new swap file:
First, modify the permissions of the swapfile file:
Chmod 600 / usr/swapfile
Initialize swapfile as a swap file:
Mkswap / usr/swapfile
Uninstall the original swap:
Swapoff-a
Then open the newly created swap.
Swapon / usr/swapfile
Check to see if the configuration is successful:
Free-g
You also need to hang the swap partition in the information write / etc/fstab file
[root@local] # vim / etc/fstab/usr/swapfile swap swap defaults 00 after reading the above, do you have any further understanding of how the Linux system resizes swap? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.