add swap file if you only have 1G RAM

dd if=/dev/zero of=/swapfile1 bs=1024 count=524288

mkswap /swapfile1

swapon /swapfile1

vi /etc/fstab

# edit /etc/fstab file, add the following line

/swapfile1 none swap sw 0 0

# save and quit

free -m

swapon -s

原文地址:https://www.cnblogs.com/otfsenter/p/9626924.html

时间: 2024-08-26 21:18:19

add swap file if you only have 1G RAM的相关文章

Linux Add a Swap File

http://www.cyberciti.biz/faq/linux-add-a-swap-file-howto/ Procedure To Add a Swap File Under Linux You need to use the dd command to create swap file. The mkswap command is used to set up a Linux swap area on a device or in a file. Step #1: Login as

Ubuntu add swap

1. create a 1G file for the swap. sudo fallocate -l 1G /swapfile we can verify that the correct amount of space was reserved by typing: ls -lh /swapfile 2. Enabling the Swap File. 1.Make the file only accessible by typing: sudo chmod 600 /swapfile. 2

vi操作异常时Found a swap file by the name

当我在linux下用vi打开Test.java文件时 [[email protected] tmp]# vi Test.java 会出现如下信息: Dos代码   E325: ATTENTION Found a swap file by the name ".Test.java.swp" owned by: root   dated: Wed Dec  7 13:52:56 2011 file name: /var/tmp/Test.java modified: YES user na

linux下vi或vim编辑文件时提示Found a swap file by the name的原因及解决方法

在linux下用vi或vim打开test.java文件时 [[email protected] test]# vi test.java 出现了如下信息: E325: ATTENTION     Found a swap file by the name ".test.java.swp"             owned by: root   dated: Wed Dec  7 13:52:56 2011         file name: /var/tmp/Test.java  

swap file "*.swp" already exists!的解决方法

Linux下编程难免要开启多个vim共同编辑同一个文件,这时再次保存就会出现: swap file "*.swp" already exists! [O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort: 原因: 使用vim编辑文件实际是先copy一份临时文件并映射到内存给你编辑, 编辑的是临时文件, 当执行:w后才保存临时文件到原文件,执行:q后才删除临时文件. 每次启动检索式否有临时文件, 有

​老男孩教育每日一题第123天- 出现Swap file….already exists以下错误如何解决?

E325: ATTENTION Found a swap file by the name ".a.sh.swp"Swap file ".a.sh.swp" already exists! [O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort: 解决方法 1.首先输入R,恢复数据.2.然后输入D,删除临时文件3.最后输入:wq!保存文件并退出,此时再次编辑文件就一切正常了!!

解决Swap file ".ceshi.c.swp" already exists!问题

关于swp文件:使用vi,常常能够看到swp这个文件,那这个文件是怎么产生的呢.当你打开一个文件,vi就会生成这么一个.(filename)swp文件以备不測,假设你正常退出,那么这个.(filename)swp文件将会自己主动删除. 因此.(filename)swp文件就是你没有正常退出vi或者vim编辑器时留下来的! 比方:强行关闭vi或vim时.电源突然断掉,或者你使用了Ctrl-zz.(正常的退出方式应该是Shift-ZZ) 这时候就会出现以下的情况了 <span style="f

Android问题集锦之四十九:Can&#39;t add XStream file dependency to Android Studio project

将xstream1.4.8 引入Android Strudio项目中,编译报错如下: UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000) at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472) at

e297: write error in swap file [磁盘空间不足]

发现vi /etc/hosts报了一个错: e297: write error in swap file 同时无法上传文件到服务器 查看了一下磁盘空间,原因在于磁盘空间不够,于是执行命令: 逐步追踪 发现tomcat下的日志文件居然占用了将近100G,Oh my god! 结果发现目录:/下面磁盘空间已满,删掉一些日志之后系统就又正常起来了. e297: write error in swap file [磁盘空间不足]