Linux下创建和加载swap

#创建swap
mkswap /dev/vda5

#编辑fstab

vi /etc/fstab

#增加如下行

/dev/vda5 none swap sw 0 0

#挂载swap

mount -a

swapon -a

#查看状态
top

#状态可能显示如下,最后一行为新挂载的swap

top - 22:17:59 up 23:48, 1 user, load average: 0.00, 0.01, 0.05
Tasks: 75 total, 1 running, 71 sleeping, 3 stopped, 0 zombie
Cpu(s): 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 1019536k total, 455332k used, 564204k free, 62388k buffers
Swap: 1045500k total, 0k used, 1045500k free, 187772k cached

相关推荐