云主机默认是没有swap分区的,所以在配置的时候需要手工的配置一下swap分区。 方法如下:
[root@iZwz90iksa8sifjriq4iorZ /]# dd if=/dev/zero of=/swapfile bs=1M count=4000
4000+0 records in
4000+0 records out
4194304000 bytes (4.2 GB) copied, 42.7724 s, 98.1 MB/s
[root@iZwz90iksa8sifjriq4iorZ /]# mkswap /swapfile
Setting up swapspace version 1, size = 4095996 KiB
no label, UUID=765e7b1f-1204-4fe0-a2e5-cf30980f2065
[root@iZwz90iksa8sifjriq4iorZ /]# swapon /swapfile
swapon: /swapfile: insecure permissions 0644, 0600 suggested.
[root@iZwz90iksa8sifjriq4iorZ /]# free -m
total used free shared buff/cache available
Mem: 7822 425 170 1 7226 7071
Swap: 3999 0 3999
[root@iZwz90iksa8sifjriq4iorZ /]# vi /etc/fstab
[root@iZwz90iksa8sifjriq4iorZ /]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Fri Feb 24 02:58:22 2017
#
# 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=07151862-c2b9-45dc-bf7a-af8d2a6fa6c1 / ext3 defaults 1 1
/dev/vdb1 /u01 ext4 defaults 0 0
/swapfile swap swap defaults 0 0
[root@iZwz90iksa8sifjriq4iorZ /]#
版权声明:本文为博主原创文章,未经博主允许不得转载。