Linux系统交换分区重新配置

18 篇文章 0 订阅

物理内存 交换分区(SWAP)
参考:
<= 4g 至少 4G
4~16G 至少 8G
16G~64G 至少 16G
64G~256G 至少 32G

命令列表:

root@book-host:/# free -m
              总计         已用        空闲      共享    缓冲/缓存    可用
内存:       15630        8963        3379        2057        3287        4284
交换:        2047           0        2047
root@book-host:/# swapoff  -a
root@book-host:/# dd if=/dev/zero of=/var/swapfile bs=1M count=4096
记录了4096+0 的读入
记录了4096+0 的写出
4294967296字节(4.3 GB,4.0 GiB)已复制,8.23706 s,521 MB/s
root@book-host:/# mkswap /var/swapfile 
mkswap: /var/swapfile:不安全的权限 0644,建议使用 0600。
正在设置交换空间版本 1,大小 = 4 GiB (4294963200  个字节)
无标签, UUID=985c7e42-1ea3-44d2-b43f-0afcb8565080
root@book-host:/# swapon /var/swapfile 
swapon: /var/swapfile:不安全的权限 0644,建议使用 0600。
root@book-host:/# vi /etc/fstab 
root@book-host:/# cat /etc//fstab 
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/nvme0n1p2 during installation
UUID=1dd695c2-7d75-413e-880e-8fbb5e35c52e /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/nvme0n1p1 during installation
UUID=2AF5-D9CE  /boot/efi       vfat    umask=0077      0       1
/var/swapfile                                 none            swap    sw              0       0
root@book-host:/# 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值