设置linux的swap区

dd if=/dev/zero of=./swapfile1g bs=1024 count=1048576

如果就恰好只dd一个1G的文件,则设置成swap之后,则可能会显示swap为0,因为swap实际上可能会小于1G,而显示不出来

[root@stbm000019-vm15 swapfile]# dd if=/dev/zero of=./swapfile1g bs=1024 count=1048576
1048576+0 records in
1048576+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 4.27326 s, 251 MB/s
[root@stbm000019-vm15 swapfile]# mkswap /swapfile/swapfile1g
mkswap: /swapfile/swapfile1g: insecure permissions 0644, 0600 suggested.
Setting up swapspace version 1, size = 1024 MiB (1073737728 bytes)
no label, UUID=7a6f005c-c952-473a-b0f3-70e465b53352
You have new mail in /var/spool/mail/root
[root@stbm000019-vm15 swapfile]# swapon /swapfile/swapfile1g
swapon: /swapfile/swapfile1g: insecure permissions 0644, 0600 suggested.

你可能感兴趣的:(linux,linux)