Linux调整swap大小

2025-05-23 20:34:03

1、使用free命令带上m参数,查看swap文件大小,官方建议在RAM是2到4.5G时,swap是RAM的2倍;如果RAM大于等于4G则swap等于RAM即可

Linux调整swap大小

3、创建一个swap文件########dd if=/dev/zero of=/tmp/swap bs=1MBcount=1024########以下仅供参考:不用看Creating a swap fileFirst of, make sure the file system the disk you wish to swap on is properly mounted. For the purposes of this tutorial we will assume the disk is mounted as/mntand we want to use the file/mnt/myswap.swpfor swapping.使用下面的命令创建一个1G的swap文件Use the following command to create a 1024MB file that we will use for swapping########dd if=/dev/zero of=/mnt/myswap.swp bs=1024MBcount=1########

Linux调整swap大小

6、再次使用free查看增加后的swap大小

Linux调整swap大小
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢