swap
Posted rsapaper
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了swap相关的知识,希望对你有一定的参考价值。
[email protected]:/$ ll total 970056 drwxr-xr-x 22 root root 4096 Jun 7 03:56 ./ drwxr-xr-x 22 root root 4096 Jun 7 03:56 ../ drwxr-xr-x 2 root root 4096 Jun 7 06:19 bin/ drwxr-xr-x 3 root root 4096 Jun 7 04:20 boot/ drwxr-xr-x 18 root root 3900 Jun 17 03:18 dev/ drwxr-xr-x 88 root root 4096 Jun 17 03:23 etc/ drwxr-xr-x 3 root root 4096 Jun 7 04:20 home/ lrwxrwxrwx 1 root root 33 Jun 7 03:56 initrd.img -> boot/initrd.img-4.10.0-19-generic drwxr-xr-x 19 root root 4096 Jun 8 01:43 lib/ drwxr-xr-x 2 root root 4096 Jun 7 03:55 lib64/ drwx------ 2 root root 16384 Jun 7 03:54 lost+found/ drwxr-xr-x 4 root root 4096 Jun 7 03:55 media/ drwxr-xr-x 2 root root 4096 Apr 11 20:06 mnt/ drwxr-xr-x 2 root root 4096 Jun 7 04:50 opt/ dr-xr-xr-x 178 root root 0 Jun 17 03:18 proc/ drwx------ 2 root root 4096 Jun 17 03:24 root/ drwxr-xr-x 21 root root 620 Jun 17 03:25 run/ drwxr-xr-x 2 root root 4096 Jun 7 06:19 sbin/ drwxr-xr-x 2 root root 4096 Apr 11 20:06 srv/ -rw------- 1 root root 993244160 Jun 7 03:54 swapfile dr-xr-xr-x 13 root root 0 Jun 17 03:18 sys/ drwxrwxrwt 12 root root 4096 Jun 17 03:25 tmp/ drwxr-xr-x 10 root root 4096 Jun 7 03:55 usr/ drwxr-xr-x 12 root root 4096 Jun 13 19:48 var/ lrwxrwxrwx 1 root root 30 Jun 7 03:56 vmlinuz -> boot/vmlinuz-4.10.0-19-generic [email protected]:/$ su Password: [email protected]:/# chmod 777 swapfile [email protected]:/# ll total 970056 drwxr-xr-x 22 root root 4096 Jun 7 03:56 ./ drwxr-xr-x 22 root root 4096 Jun 7 03:56 ../ drwxr-xr-x 2 root root 4096 Jun 7 06:19 bin/ drwxr-xr-x 3 root root 4096 Jun 7 04:20 boot/ drwxr-xr-x 18 root root 3900 Jun 17 03:18 dev/ drwxr-xr-x 88 root root 4096 Jun 17 03:23 etc/ drwxr-xr-x 3 root root 4096 Jun 7 04:20 home/ lrwxrwxrwx 1 root root 33 Jun 7 03:56 initrd.img -> boot/initrd.img-4.10.0-19-generic drwxr-xr-x 19 root root 4096 Jun 8 01:43 lib/ drwxr-xr-x 2 root root 4096 Jun 7 03:55 lib64/ drwx------ 2 root root 16384 Jun 7 03:54 lost+found/ drwxr-xr-x 4 root root 4096 Jun 7 03:55 media/ drwxr-xr-x 2 root root 4096 Apr 11 20:06 mnt/ drwxr-xr-x 2 root root 4096 Jun 7 04:50 opt/ dr-xr-xr-x 180 root root 0 Jun 17 03:18 proc/ drwx------ 2 root root 4096 Jun 17 03:24 root/ drwxr-xr-x 21 root root 620 Jun 17 03:26 run/ drwxr-xr-x 2 root root 4096 Jun 7 06:19 sbin/ drwxr-xr-x 2 root root 4096 Apr 11 20:06 srv/ -rwxrwxrwx 1 root root 993244160 Jun 7 03:54 swapfile* dr-xr-xr-x 13 root root 0 Jun 17 03:18 sys/ drwxrwxrwt 12 root root 4096 Jun 17 03:26 tmp/ drwxr-xr-x 10 root root 4096 Jun 7 03:55 usr/ drwxr-xr-x 12 root root 4096 Jun 13 19:48 var/ lrwxrwxrwx 1 root root 30 Jun 7 03:56 vmlinuz -> boot/vmlinuz-4.10.0-19-generic [email protected]:/# sudo rm swapfile rm: cannot remove ‘swapfile‘: Operation not permitted [email protected]:/# cat swapfile :3[email protected]??茌SWAPSPACE2 ^C [email protected]:/# ll total 970056 drwxr-xr-x 22 root root 4096 Jun 7 03:56 ./ drwxr-xr-x 22 root root 4096 Jun 7 03:56 ../ drwxr-xr-x 2 root root 4096 Jun 7 06:19 bin/ drwxr-xr-x 3 root root 4096 Jun 7 04:20 boot/ drwxr-xr-x 18 root root 3900 Jun 17 03:18 dev/ drwxr-xr-x 88 root root 4096 Jun 17 03:23 etc/ drwxr-xr-x 3 root root 4096 Jun 7 04:20 home/ lrwxrwxrwx 1 root root 33 Jun 7 03:56 initrd.img -> boot/initrd.img-4.10.0-19-generic drwxr-xr-x 19 root root 4096 Jun 8 01:43 lib/ drwxr-xr-x 2 root root 4096 Jun 7 03:55 lib64/ drwx------ 2 root root 16384 Jun 7 03:54 lost+found/ drwxr-xr-x 4 root root 4096 Jun 7 03:55 media/ drwxr-xr-x 2 root root 4096 Apr 11 20:06 mnt/ drwxr-xr-x 2 root root 4096 Jun 7 04:50 opt/ dr-xr-xr-x 180 root root 0 Jun 17 03:18 proc/ drwx------ 2 root root 4096 Jun 17 03:24 root/ drwxr-xr-x 21 root root 620 Jun 17 03:27 run/ drwxr-xr-x 2 root root 4096 Jun 7 06:19 sbin/ drwxr-xr-x 2 root root 4096 Apr 11 20:06 srv/ -rwxrwxrwx 1 root root 993244160 Jun 7 03:54 swapfile* dr-xr-xr-x 13 root root 0 Jun 17 03:18 sys/ drwxrwxrwt 12 root root 4096 Jun 17 03:27 tmp/ drwxr-xr-x 10 root root 4096 Jun 7 03:55 usr/ drwxr-xr-x 12 root root 4096 Jun 13 19:48 var/ lrwxrwxrwx 1 root root 30 Jun 7 03:56 vmlinuz -> boot/vmlinuz-4.10.0-19-generic [email protected]:/# cd tmp [email protected]:/tmp# ll total 48 drwxrwxrwt 12 root root 4096 Jun 17 03:27 ./ drwxr-xr-x 22 root root 4096 Jun 7 03:56 ../ drwxrwxrwt 2 root root 4096 Jun 17 03:18 .font-unix/ drwxrwxrwt 2 root root 4096 Jun 17 03:18 .ICE-unix/ drwx------ 3 root root 4096 Jun 17 03:18 systemd-private-c6513a20a62f42b09f6d0104887c5a9c-apache2.service-zqgAyn/ drwx------ 3 root root 4096 Jun 17 03:18 systemd-private-c6513a20a62f42b09f6d0104887c5a9c-systemd-resolved.service-lh1NTN/ drwx------ 3 root root 4096 Jun 17 03:18 systemd-private-c6513a20a62f42b09f6d0104887c5a9c-systemd-timesyncd.service-G0iEvf/ drwxrwxrwt 2 root root 4096 Jun 17 03:18 .Test-unix/ drwxrwxrwt 2 root root 4096 Jun 17 03:18 VMwareDnD/ drwx------ 2 root root 4096 Jun 17 03:18 vmware-root/ drwxrwxrwt 2 root root 4096 Jun 17 03:18 .X11-unix/ drwxrwxrwt 2 root root 4096 Jun 17 03:18 .XIM-unix/ [email protected]:/tmp# ll total 48 drwxrwxrwt 12 root root 4096 Jun 17 03:27 ./ drwxr-xr-x 22 root root 4096 Jun 7 03:56 ../ drwxrwxrwt 2 root root 4096 Jun 17 03:18 .font-unix/ drwxrwxrwt 2 root root 4096 Jun 17 03:18 .ICE-unix/ drwx------ 3 root root 4096 Jun 17 03:18 systemd-private-c6513a20a62f42b09f6d0104887c5a9c-apache2.service-zqgAyn/ drwx------ 3 root root 4096 Jun 17 03:18 systemd-private-c6513a20a62f42b09f6d0104887c5a9c-systemd-resolved.service-lh1NTN/ drwx------ 3 root root 4096 Jun 17 03:18 systemd-private-c6513a20a62f42b09f6d0104887c5a9c-systemd-timesyncd.service-G0iEvf/ drwxrwxrwt 2 root root 4096 Jun 17 03:18 .Test-unix/ drwxrwxrwt 2 root root 4096 Jun 17 03:18 VMwareDnD/ drwx------ 2 root root 4096 Jun 17 03:18 vmware-root/ drwxrwxrwt 2 root root 4096 Jun 17 03:18 .X11-unix/ drwxrwxrwt 2 root root 4096 Jun 17 03:18 .XIM-unix/ [email protected]:/tmp# cd .. [email protected]:/# ll total 970056 drwxr-xr-x 22 root root 4096 Jun 7 03:56 ./ drwxr-xr-x 22 root root 4096 Jun 7 03:56 ../ drwxr-xr-x 2 root root 4096 Jun 7 06:19 bin/ drwxr-xr-x 3 root root 4096 Jun 7 04:20 boot/ drwxr-xr-x 18 root root 3900 Jun 17 03:18 dev/ drwxr-xr-x 88 root root 4096 Jun 17 03:23 etc/ drwxr-xr-x 3 root root 4096 Jun 7 04:20 home/ lrwxrwxrwx 1 root root 33 Jun 7 03:56 initrd.img -> boot/initrd.img-4.10.0-19-generic drwxr-xr-x 19 root root 4096 Jun 8 01:43 lib/ drwxr-xr-x 2 root root 4096 Jun 7 03:55 lib64/ drwx------ 2 root root 16384 Jun 7 03:54 lost+found/ drwxr-xr-x 4 root root 4096 Jun 7 03:55 media/ drwxr-xr-x 2 root root 4096 Apr 11 20:06 mnt/ drwxr-xr-x 2 root root 4096 Jun 7 04:50 opt/ dr-xr-xr-x 180 root root 0 Jun 17 03:18 proc/ drwx------ 2 root root 4096 Jun 17 03:24 root/ drwxr-xr-x 21 root root 620 Jun 17 03:27 run/ drwxr-xr-x 2 root root 4096 Jun 7 06:19 sbin/ drwxr-xr-x 2 root root 4096 Apr 11 20:06 srv/ -rwxrwxrwx 1 root root 993244160 Jun 7 03:54 swapfile* dr-xr-xr-x 13 root root 0 Jun 17 03:18 sys/ drwxrwxrwt 12 root root 4096 Jun 17 03:27 tmp/ drwxr-xr-x 10 root root 4096 Jun 7 03:55 usr/ drwxr-xr-x 12 root root 4096 Jun 13 19:48 var/ lrwxrwxrwx 1 root root 30 Jun 7 03:56 vmlinuz -> boot/vmlinuz-4.10.0-19-generic [email protected]:/# swapoff /root/extraswap swapoff: /root/extraswap: swapoff failed: No such file or directory [email protected]:/# swapoff swapfile [email protected]:/# rm swapfile [email protected]:/# ll total 84 drwxr-xr-x 22 root root 4096 Jun 17 03:29 ./ drwxr-xr-x 22 root root 4096 Jun 17 03:29 ../ drwxr-xr-x 2 root root 4096 Jun 7 06:19 bin/ drwxr-xr-x 3 root root 4096 Jun 7 04:20 boot/ drwxr-xr-x 18 root root 3900 Jun 17 03:18 dev/ drwxr-xr-x 88 root root 4096 Jun 17 03:23 etc/ drwxr-xr-x 3 root root 4096 Jun 7 04:20 home/ lrwxrwxrwx 1 root root 33 Jun 7 03:56 initrd.img -> boot/initrd.img-4.10.0-19-generic drwxr-xr-x 19 root root 4096 Jun 8 01:43 lib/ drwxr-xr-x 2 root root 4096 Jun 7 03:55 lib64/ drwx------ 2 root root 16384 Jun 7 03:54 lost+found/ drwxr-xr-x 4 root root 4096 Jun 7 03:55 media/ drwxr-xr-x 2 root root 4096 Apr 11 20:06 mnt/ drwxr-xr-x 2 root root 4096 Jun 7 04:50 opt/ dr-xr-xr-x 179 root root 0 Jun 17 03:18 proc/ drwx------ 2 root root 4096 Jun 17 03:24 root/ drwxr-xr-x 21 root root 620 Jun 17 03:29 run/ drwxr-xr-x 2 root root 4096 Jun 7 06:19 sbin/ drwxr-xr-x 2 root root 4096 Apr 11 20:06 srv/ dr-xr-xr-x 13 root root 0 Jun 17 03:18 sys/ drwxrwxrwt 12 root root 4096 Jun 17 03:29 tmp/ drwxr-xr-x 10 root root 4096 Jun 7 03:55 usr/ drwxr-xr-x 12 root root 4096 Jun 13 19:48 var/ lrwxrwxrwx 1 root root 30 Jun 7 03:56 vmlinuz -> boot/vmlinuz-4.10.0-19-generic [email protected]:/#
以上是关于swap的主要内容,如果未能解决你的问题,请参考以下文章