[root@ /]# cat /proc/swaps
Filename Type Size Used Priority
/dev/sdb1 partition 2096440 8 -1
/tmp/swap file 65520 0 -3
2.通过DD创建
boot etc initrd lost+found misc opt root selinux sys test1 usr
[root@ /]# dd if=/dev/zero f=/tmp/swap bs=4k count=16382
读入了 16382+0 个块
输出了 16382+0 个块
[root@ /]# mkswap /tmp/swap
Setting up swapspace version 1, size = 67096 kB
[root@ /]# free
total used free shared buffers cached
Mem: 384704 364624 20080 0 17180 305472
-/+ buffers/cache: 41972 342732
Swap: 2096440 8 2096432
swapon [-s]
[root@ /]# swapon /tmp/swap
[root@ /]# free
total used free shared buffers cached
Mem: 384704 364560 20144 0 17196 305456
-/+ buffers/cache: 41908 342796
Swap: 2161960 8 2161952
开机自动启动:
LABEL=/ / ext3 defaults 1 1
LABEL=/home /home ext3 defaults 1 2
LABEL=/var /var ext3 defaults 1 2
LABEL=/tmp /tmp ext3 defaults 1 2
LABEL=/usr /usr ext3 defaults 1 2
LABEL=/boot /boot ext3 defaults 1 2
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
LABEL=SWAP swap swap defaults 0 0
/home/swap swap swap defaults 0 0
3.直接再加一棵硬盘,并且将其中某个扇区规划为 swap 的 filesystem
[root@ /]# fdisk /dev/sdc