[root@myhost ~]# dd if=/dev/zero of=/swapfile1 bs=1024 count=10485760
10485760+0 records in
10485760+0 records out
10737418240 bytes (11 GB) copied, 110.084 s, 97.5 MB/s
[root@myhost ~]# chown root:root /swapfile1
[root@myhost ~]# chmod 0600 /swapfile1
[root@myhost ~]# mkswap /swapfile1
Setting up swapspace version 1, size = 10485756 KiB
no label, UUID=a7a5c45b-d56a-424f-8c50-41149fdd0935
[root@myhost ~]# swapon /swapfile1
[root@myhost ~]# free -m
total used free shared buff/cache available
Mem: 15456 7999 87 161 7369 7132
Swap: 17919 0 17919
[root@myhost ~]# vi /etc/fstab
add the following line
[root@myhost ~]# free -m
total used free shared buff/cache available
Mem: 15456 8573 89 161 6793 6553
Swap: 17919 0 17919
10485760+0 records in
10485760+0 records out
10737418240 bytes (11 GB) copied, 110.084 s, 97.5 MB/s
[root@myhost ~]# chown root:root /swapfile1
[root@myhost ~]# chmod 0600 /swapfile1
[root@myhost ~]# mkswap /swapfile1
Setting up swapspace version 1, size = 10485756 KiB
no label, UUID=a7a5c45b-d56a-424f-8c50-41149fdd0935
[root@myhost ~]# swapon /swapfile1
[root@myhost ~]# free -m
total used free shared buff/cache available
Mem: 15456 7999 87 161 7369 7132
Swap: 17919 0 17919
[root@myhost ~]# vi /etc/fstab
add the following line
/swapfile1 none swap sw 0 0
[root@myhost ~]# free -m
total used free shared buff/cache available
Mem: 15456 8573 89 161 6793 6553
Swap: 17919 0 17919
No comments:
Post a Comment