Linux调整swap大小

2024-10-23 11:02:59

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大小
猜你喜欢