3、创建一个swap文件
复制内容到剪贴板
########
dd if=/dev/zero of=/tmp/swap bs=1MB count=1024
########
以下仅供参考:不用看
Creating a swap file
First 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 /mnt and we want to use the file /mnt/myswap.swp for 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=1024MB count=1
########
4、制作一个swap文件,如果觉得繁琐,可以将mkswap文件挂载到tmp目录下,例如:
复制内容到剪贴板
########
mkswap /tmp/swap
########
以下仅供参考:不用看
Preparing the swap file
Before we enable the swap file we must first set it up. The following command accomplishes just that:
########
mkswap /mnt/myswap.swp
########
5、使用swapon 启动/tmp/swap
复制内容到剪贴板
########
swapon /tmp/swap
########
使用一个swap分区,如果已经有一个swap分区,该步骤可以省略
以下仅供参考:不用看
Using a swap partition
Setting up a swap partition is a bit more difficult, as the partition must be first created then formatted using the linux-swap file system. Once that is done, assuming the swap partition is at/dev/scsi/host0/bus0/target0/lun0/part5 (common for v24 USB drives with mutiple partitions), the only command that needs be issued is: