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 view swap partition in centos

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article will explain in detail how to view the swap partition in centos, the content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.

View existing swap partitions:

[root@iZ94hzx4xerZ bin] # swapon-s Filename Type Size Used Priority / mnt/swap file 10232 10184-1

Create a file for swapping partitions:

[root@iZ94hzx4xerZ bin] # dd if=/dev/zero of=/mnt/swap bs=1024 count=10240 102400records in 102400records out 10485760 bytes (10 MB) copied, 0.237175 s, 44.2 MB/s

Bs=1024 refers to the initial size of creating a swap partition, and count refers to the maximum swap space, which is recommended to be set to 1-2 times the memory.

Set up the swap partition file:

[root@iZ94hzx4xerZ mnt] # mkswap / mnt/swap mkswap: / mnt/swap: warning: don't erase bootbits sectors on whole disk. Use-f to force. Setting up swapspace version 1, size = 2044 KiB no label, UUID=e6f0ae06-0e6b-4fce-8c18-d5a247b40259

Enable swapping partition files now:

[root@iZ94hzx4xerZ mnt] # swapon / mnt/swap

Set the swap partition to be self-enabled at power on:

The swap line in the file / etc/fstab needs to be modified.

Add / mnt/swap swap swap defaults 0 0

# # / etc/fstab # Created by anaconda on Thu Aug 14 21:16:42 2014 # # Accessible filesystems, by reference, are maintained under'/ dev/disk' # See man pages fstab (5), findfs (8), mount (8) and/or blkid (8) for more info # UUID=94e4e384-0ace-437f-bc96-057dd64f42ee / ext4 defaults,barrier=0 11 tmpfs / dev/shm tmpfs defaults 00 devpts / dev/pts devpts gid=5,mode=620 00 sysfs / sys sysfs defaults 00 proc / proc proc defaults 00 / mnt/swap swap swap defaults 00

After setting it, you can execute the free-m command or top to view the effect:

[root@iZ94hzx4xerZ bin] # top top-20:33:11 up 4:53, 2 users, load average: 0.00,0.00,0.00 Tasks: 104total, 1 running, 88 sleeping, 15 stopped, 0 zombie Cpu (s): 0.3%us, 0.2%sy, 0.0%ni, 99.5%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 1920740k total, 1845096k used, 75644k free, 38716k buffers Swap: 10232k total, 10184k used, 48k free, 260692k cached

Delete the swap partition:

[root@iZ94hzx4xerZ bin] # swapon / mnt/swap on how to view swap partitions in centos is shared here. I hope the above content can be helpful to you and learn more. If you think the article is good, you can share it for more people to see.

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