In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "linux swap partition use guide", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's take you to learn the "linux swap partition use guide" bar!
Overview of SWAP Swap Partitioning in Linux
Swap partitions. If we don't have enough memory, we may not be able to run some large software. The solution is to set aside an area on the hard disk as temporary memory, as if the memory is getting bigger. Windows calls this area virtual memory, Linux calls it swap.
Although memory is no longer limited by hardware prices, but the concept of swap partition has been retained, and there are reasons to continue to retain, of course, related to the kernel, we will not discuss, we want to explain, when installing Linux to create swap partition, if you only have 64 MB or 128 MB of memory, then swap partition is best set to 3 times it, if your partition is large enough, 256 MB or 512M, Then set it to the same size. Note, however, that numbers of size 2 to the power of N are preferred.
Swap partitions are generally available only in xen VPS, but not in openvz. Swap partitions can increase memory usage by a certain amount, but the most important role of adding swap partitions is to prevent sudden increases in website traffic that cause the system to allocate insufficient memory and crash. If your VPS has been using swap for a long time, it is recommended that you check the program or VPS, or upgrade the VPS with larger memory, because using swap partitions will reduce the performance of the server a lot, resulting in slower access speed. Let's look at how to add swap partitions.
1. Log in to SSH as root and type the following command to create a 512 MB swap file (1024 * 512MB = 524288).
dd if=/dev/zero of=/swapfile1 bs=1024 count=524288
2. Create Linux swap files
mkswap /swapfile1
3, Immediately activate/swapfile1 Exchange files
swapon /swapfile1
4. Set the system to activate the exchange file automatically. Edit the/etc/fstab file and add the following second line.
vi /etc/fstab
/swapfile1 swap swap defaults 0 0
Restart the system and use free -m to check the swap size.
#vi /etc/fstab
UUID=b45eed4a-b319-43fa-9d03-200c558b5d84 / ext4 defaults 1 1
UUID=0ab45aeb-98f7-4f31-863d-791f7947d8f7 /boot ext4 defaults 1 2
/dev/sdb5 swap swap defaults 0 0
UUID=bddbfd46-378f-4583-930f-554f9c6f4ab6 swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
At this point, I believe that we have a deeper understanding of the "linux swap partition use guide," may wish to actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue 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.
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.