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.Make the file as swap space by typing:

    sudo mkswap /swapfile

  3.Enabling the swap file and allow our system to start utilizing it .

    sudo swapon /swapfile.

  4.Now you can find that the swap space was added by typing:

    free -h / (sudo swapon --show)

  

原文地址:https://www.cnblogs.com/magicpig666/p/9772003.html

时间: 2024-07-31 08:23:15

Ubuntu add swap的相关文章

ubuntu添加swap

ubuntu 默认swap不够用了 备注:1)Ubuntu版本:14.042)Linux用户:root 通常,Linux系统中swap分区可以通过两种方式指定,分别为:一.在磁盘分区的时候格式化一个swap分区:二.在文件系统中创建一个swap文件作为swap分区.此文主要介绍第二种方式.步骤如下: 1. 创建文件fallocate -l 8G /swapfile说明:8G 表示swap文件大小,/swapfile为swap文件路径和名称,可以任意指定. 2. 修改文件权限chmod 600 /

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

给ubuntu的swap分区增加容量

1.创建一个 Swap 文件. mkdir swap cd swap sudo dd if=/dev/zero of=swapfile bs=1024 count=100000 出现下列提示,上面命令中的 count 即代表swap文件大小. 记录了 100000+0 的读入 记录了 100000+0 的写出 102400000 字节 (102 MB) 已复制,0.74704 秒,137 MB/秒 把生成的文件转换成 Swap 文件 sudo mkswap swapfile Setting up

ubuntu add application to launcher

eg. add sublime text to launcher so as to be found by launcher, docky, etc. add a file sudo gedit /usr/share/applications/sublime.desktop set content as follows: [Desktop Entry] Name=SublimeText Type=Application Exec=/opt/SublimeText2/sublime_text Te

Ubuntu 新建swap分区及启用

个人电脑配置:500G机械硬盘+16G NGFF SSD+8G Physical Memory 之前安装Ubuntu16.04,默认装到NGFF的SSD里,/和swap分区一共才16G,于是删除swap分区,发现开机速度奇慢无比,即便将swappiness设为0依旧,so需要在机械硬盘上重新划分一块swap分区. 注意,由于MBR分区系统最多只能有4块primary分区,因此建议先在磁盘末尾划出一块比较大的Extend分区,便于以后使用. ①在Extend分区划出一块Logical分区 ②sud

digital ocean 内存不足时增加swap文件的方法

买了比较低配的digitalocean 云主机,在执行composer update的时候出现内存不足的问题,但是内存大小已经固定了,除非加钱,还有别的方法吗? 有,增加swap分区,这样就可以弥补内存不足的问题,用这种方法顺利解决composer update的内存不足问题. 具体操作,参照下面的文章中得步骤: 推荐文章: How To Add Swap on Ubuntu 14.04 其中主要用到swapon 这个命令,还介绍了相关的检查方法,很细致,值得一读. 这里还有一篇,不如上一篇的方

Ubuntu 16.04系统布署小记

前段时间趁着双11打折,又将阿里云主机续费了3年.之前布署的系统是Ubuntu 12.04,从系统发布到现在也有四年半了,其官方支持的生命周期也将止于明年春,且这在几年里出现了很多新的事物,我也需要跟上时代的步伐,于是着手将整个环境更新至最新的Ubuntu 16.04,现将布署过程记录如下 系统布署 环境布署 应用布署 10. 停止服务器实例,选择更换系统盘,选择Ubuntu 16.04 64bit,重启实例 20. 挂载虚拟内存 mkdir /swap && cd /swap &

Docker mongodb Dockerfile ubuntu

1.目录结构,把配置文件也放这里,等下复制到image里面去 2.mongod.conf net:   port: 27017   bindIp: 0.0.0.0 security:   authorization: enabled systemLog:   destination: file   path: "/data/log/mongod.log"   logAppend: true storage:   dbPath: "/data/db" #process

Installing ROS Indigo on the Raspberry Pi

Description: This instruction covers the installation of ROS Indigo on the original Raspberry Pi with Raspbian.Keywords: Raspberry Pi, Setup, IndigoContents 1 Introduction This tutorial explains how to install ROS Indigo from source on the Raspberry