ubuntu增加swap

ubuntu增加swap

创建myswapfile

首先在你的目录中创建一个myswapfile并创建myswapfile文件,这个名字可以改成你自己的

powershell 复制代码
mkdir myswapfile
cd myswapfile/
# 单个为1G,数量为7,总共7g内存
dd if=/dev/zero of=swapfile bs=1G count=7
sudo chmod 600 swapfile
# 挂载
sudo mkswap swapfile
# 启动
sudo swapon swapfile

参数说明

bs=1G :可以是单位G也可以是M 比如1G, 512M

count=7:总数,比如bs是1G,count为7 那么swap就是1*7G

上电启动

powershell 复制代码
sudo /etc/fstab
# 最加如下内容
/path/to/your/swapfile none swap defaults 0 0
相关推荐
晚风吹长发1 小时前
Docker基础——Docker Network(网络详解)
linux·运维·网络·ubuntu·docker·容器
Sisphusssss5 小时前
香橙派5plus GPIO
linux·python·ubuntu
半句唐诗12 小时前
Ubuntu 离线安装 OpenSpec CLI、CodeGraph CLI 与相关工具实战笔记
ubuntu·arcgis
如若12313 小时前
Ubuntu 无 sudo 安装花生壳并实现 SSH 内网穿透:Conda 环境部署、冲突排查与自动启动
linux·运维·ubuntu·ssh·内网穿透
Better Bench1 天前
WSL2 Ubuntu 中 Claude CLI “command not found” 故障排查与修复
linux·ubuntu·claude·wsl·claudecode
LSG_Dawn1 天前
XBOX360 kinect + ROS2_humble
ubuntu·深度相机
jing.wang_20251 天前
NVIDIA CUDA C++编程环境搭建--Windows + Ubuntu 22.04
c++·windows·ubuntu·gpu算力
黑白园2 天前
个人台式机VMware 15及Ubuntu 16.04.5卸载以及VMware 16.2.3及Ubuntu 24.04.4安装
linux·ubuntu
想你依然心痛2 天前
从监控数据到告警管理:Prometheus与Alertmanager部署实战
ubuntu·prometheus·内网穿透·系统监控·cpolar·告警管理
黑白园2 天前
解决服务器拒绝连接导致ubuntu镜像无法下载问题 https://mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/
ubuntu