剑灵新版本增好友快捷键 | 剑灵自
622 2023-04-01 20:33:21
查看原先swap大小
[email protected]:~# free -h 总计 已用 空闲 共享 缓冲/缓存 可用内存: 62G 417M 38G 3.0M 23G 61G交换: 2.0G 0B 2.0G[email protected]:~#
[email protected]:~# swapon -s文件名 类型 大小 已用 权限/swapfile1 file 12582908 0 -2[email protected]:~#
一般swap分区要大于或等于物理内存(1-1.5倍),最大一般有20G即可,我这里创建12G:
[email protected]:~# cd /[email protected]:/# dd if=/dev/zero of=/swapfile1 bs=1G count=12记录了12+0 的读入记录了12+0 的写出12884901888 bytes (13 GB, 12 GiB) copied, 17.1497 s, 751 MB/s[email protected]:/# ll总用量 14680188drwxr-xr-x 25 root root 4096 4月 10 17:22 ./drwxr-xr-x 25 root root 4096 4月 10 17:22 ../drwxr-xr-x 2 root root 4096 4月 10 06:59 bin/drwxr-xr-x 4 root root 4096 4月 10 06:59 boot/drwxrwxr-x 2 root root 4096 3月 25 20:44 cdrom/drwxr-xr-x 5 netc netc 58 4月 9 14:01 data/drwxr-xr-x 19 root root 4340 3月 29 07:50 dev/drwxr-xr-x 127 root root 12288 4月 10 06:59 etc/drwxr-xr-x 3 root root 4096 3月 25 20:45 home/lrwxrwxrwx 1 root root 33 4月 3 06:24 initrd.img -> boot/initrd.img-4.18.0-17-genericlrwxrwxrwx 1 root root 33 4月 4 06:31 initrd.img.old -> boot/initrd.img-4.18.0-16-genericdrwxr-xr-x 21 root root 4096 3月 25 20:56 lib/drwxr-xr-x 2 root root 4096 2月 10 08:12 lib64/drwx------ 2 root root 16384 3月 25 20:41 lost+found/drwxr-xr-x 2 root root 4096 2月 10 08:12 media/drwxr-xr-x 2 root root 4096 2月 10 08:12 mnt/drwxr-xr-x 2 root root 4096 2月 10 08:12 opt/dr-xr-xr-x 323 root root 0 3月 26 10:39 proc/drwx------ 8 root root 4096 3月 26 11:22 root/drwxr-xr-x 31 root root 1040 4月 10 17:20 run/drwxr-xr-x 2 root root 12288 4月 10 06:58 sbin/drwxr-xr-x 12 root root 4096 3月 26 08:54 snap/drwxr-xr-x 2 root root 4096 2月 10 08:12 srv/-rw------- 1 root root 2147483648 3月 25 20:41 swapfile # 之前的swap文件-rw-r--r-- 1 root root 12884901888 4月 10 17:22 swapfile1 # 新创建的swap文件dr-xr-xr-x 13 root root 0 4月 10 17:11 sys/drwxrwxrwt 10 root root 12288 4月 10 17:23 tmp/drwxr-xr-x 10 root root 4096 2月 10 08:12 usr/drwxr-xr-x 14 root root 4096 2月 10 08:20 var/lrwxrwxrwx 1 root root 30 4月 3 06:24 vmlinuz -> boot/vmlinuz-4.18.0-17-genericlrwxrwxrwx 1 root root 30 4月 4 06:31 vmlinuz.old -> boot/vmlinuz-4.18.0-16-generic[email protected]:/#
[email protected]:/# mkswap -f swapfile1mkswap: swapfile1:不安全的权限 0644,建议使用 0600。正在设置交换空间版本 1,大小 = 12 GiB (12884897792 个字节)无标签, UUID=3779f693-8356-42e9-8a2c-2ab51f12654a[email protected]:/# chmod 0600 swapfile1[email protected]:/# ll总用量 14680188drwxr-xr-x 25 root root 4096 4月 10 17:22 ./drwxr-xr-x 25 root root 4096 4月 10 17:22 ../drwxr-xr-x 2 root root 4096 4月 10 06:59 bin/drwxr-xr-x 4 root root 4096 4月 10 06:59 boot/drwxrwxr-x 2 root root 4096 3月 25 20:44 cdrom/drwxr-xr-x 5 netc netc 58 4月 9 14:01 data/drwxr-xr-x 19 root root 4340 3月 29 07:50 dev/drwxr-xr-x 127 root root 12288 4月 10 06:59 etc/drwxr-xr-x 3 root root 4096 3月 25 20:45 home/lrwxrwxrwx 1 root root 33 4月 3 06:24 initrd.img -> boot/initrd.img-4.18.0-17-genericlrwxrwxrwx 1 root root 33 4月 4 06:31 initrd.img.old -> boot/initrd.img-4.18.0-16-genericdrwxr-xr-x 21 root root 4096 3月 25 20:56 lib/drwxr-xr-x 2 root root 4096 2月 10 08:12 lib64/drwx------ 2 root root 16384 3月 25 20:41 lost+found/drwxr-xr-x 2 root root 4096 2月 10 08:12 media/drwxr-xr-x 2 root root 4096 2月 10 08:12 mnt/drwxr-xr-x 2 root root 4096 2月 10 08:12 opt/dr-xr-xr-x 323 root root 0 3月 26 10:39 proc/drwx------ 8 root root 4096 3月 26 11:22 root/drwxr-xr-x 31 root root 1040 4月 10 17:20 run/drwxr-xr-x 2 root root 12288 4月 10 06:58 sbin/drwxr-xr-x 12 root root 4096 3月 26 08:54 snap/drwxr-xr-x 2 root root 4096 2月 10 08:12 srv/-rw------- 1 root root 2147483648 3月 25 20:41 swapfile-rw------- 1 root root 12884901888 4月 10 17:22 swapfile1dr-xr-xr-x 13 root root 0 4月 10 17:11 sys/drwxrwxrwt 10 root root 12288 4月 10 17:23 tmp/drwxr-xr-x 10 root root 4096 2月 10 08:12 usr/drwxr-xr-x 14 root root 4096 2月 10 08:20 var/lrwxrwxrwx 1 root root 30 4月 3 06:24 vmlinuz -> boot/vmlinuz-4.18.0-17-genericlrwxrwxrwx 1 root root 30 4月 4 06:31 vmlinuz.old -> boot/vmlinuz-4.18.0-16-generic[email protected]:/#
[email protected]:/# swapoff /swapfile[email protected]:/# free -h 总计 已用 空闲 共享 缓冲/缓存 可用内存: 62G 417M 38G 3.0M 23G 61G交换: 0B 0B 0B[email protected]:/# swapon /swapfile1[email protected]:/# free -h 总计 已用 空闲 共享 缓冲/缓存 可用内存: 62G 420M 38G 3.0M 23G 61G交换: 11G 0B 11G[email protected]:/#
[email protected]:/# vim /etc/fstab/swapfile none swap sw 0 0改为/swapfile1 none swap sw 0 0[email protected]:/#
重启,然后查看是否有问题
shutdown -r now
可以先在虚拟机上测试,如果成功的话,再在物理机操作,如果都没问题的话,可以删掉旧的swap文件
rm -f /swapfile