FreeBSD添加swap分区

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qiuchangyong/article/details/89974022

要添加swap分区,FreeBSD和别的linux服务器命令有些不同,经过尝试,以下步骤在FreeBSD11.1上亲测可用。

1. Create the swap file, /usr/swap0:

# dd if=/dev/zero of=/usr/swap0 bs=1024k count=512

2. Set the proper permissions on /usr/swap0:

# chmod 0600 /usr/swap0

3. Enable the swap file in /etc/rc.conf:

# swapfile="/usr/swap0" # Set to name of swap file

4. Swap space will be added on system startup. To enable the swap file immediately, specify a free memory device.

# mdconfig -a -t vnode -f /usr/swap0 -u 0 && swapon /dev/md0

猜你喜欢

转载自blog.csdn.net/qiuchangyong/article/details/89974022