老男人百科 > 百科 > 正文

linux swap 交换分区满了有什么影响(在linux上怎么建新的swap分区)

2023-04-25 04:50:25 阅读( 1787)

Java代码1.查看系统Swap空间使用[root@jumperusr]#freetotalusedfree&n

Java代码

1.检查系统交换空间的使用情况。

[root@jumper usr]# free

total used free shared buffers cached

Mem: 513980 493640 20340 0 143808 271780

-/+ buffers/cache: 78052 435928

Swap: 1052248 21256 1030992

2.在合适的位置创建一个交换文件。

[root@jumper usr]# mkdir swap

[root@jumper usr]# cd swap

[root @ jumper switch] # ddif=/dev/zeroof=swap file bs=1024count=1000000//Add the first generation.

10000+0 records in

10000+0 records out

[root@jumper swap]# ls -al

total 10024

Drwxr-xr-x 2 root 4096 July 28 14:58.

Drwxr-xr-x 19 root 4096 July 28 14:57 .

-rw-r-r-1 Root 10240000 Exchange files at 14: 58 on July 28.

[root@jumper swap]# mkswap swapfile

Setting up swapspace version 1, size=9996 KiB

3.激活交换文件

[root@jumper swap]# swapon swapfile

[root@jumper swap]# ls -l

total 10016

-rw-r-r-1 Root 10240000 Exchange files at 14: 58 on July 28.

[root@jumper swap]# free

total used free shared buffers cached

Mem: 513980 505052 8928 0 143900 282288

-/+ buffers/cache: 78864 435116

Swap: 1062240 21256 1040984

,如果要使引导自启用,需要修改/etc/fstab文件中的交换行:

 

/root/swap/swapfile swap swap defaults 0 0

猜你喜欢

Guessyoulike
男大学生为什么爱自慰(男大学生为什么爱自慰)
男人纵欲过度危害大(男人纵欲过度危害大)
月经推迟是什么原因导致的(看内裤就知道怀没怀孕)
女生自慰为什么会颤抖(女生自慰为什么会颤抖)
专题页