How to add SWAP under Linux

zhaozj2021-02-16  81

1. View system SWAP space usage

[root @ Jumper USR] # Free Total Used Free Shared Buffers Cachedmem: 513980 493640 20340 0 143808 271780 - / Buffers / Cache: 78052 435928SWAP: 1052248 21256 1030992

2. Create a swap file in space

[root @ jumper usr] # mkdir swap [root @ jumper usr] # cd swap [root @ jumper swap] # DD if = / dev / zero of = swapfile bs = 1024 count = 1000010000 0 Records IN10000 0 Records OUT [ Root @ Jumper Swap] # ls -altotal 10024drwxr-xr-x 2 root root 4096 July 28 14:58 .drwxr-xr-x 19 root root 4096 July 28 14:57 ..- rw-r - r- - 1 root root 10240000 July 28 14:58 Swapfile

[root @ Jumper Swap] # mkswap swapfilesetting up swapspace version 1, size = 9996 kib

3. Activate SWAP file [root @ Jumper Swap] # swapon swapfile [root @ Jumper Swap] # ls -ltotal 10016-RW-R - R - 1 root root 10240000 July 28 14:58 swapfile [root @ Jumper Swap ] # Free Total Used Free Shared Buffers Cachedmem: 513980 505052 8928 0 143900 282288 - / Buffers / Cache: 78864 435116SWAP: 1062240 21256 1040984 [root @ Jumper Swap] #

转载请注明原文地址:https://www.9cbs.com/read-12586.html

New Post(0)