Disk /dev/hda: 15 heads, 17 sectors, 1001 cylinders
Units = cylinders of 255 * 512 bytes
Device Boot Begin Start End Blocks Id System
/dev/hda1 * 1 1 161 20519 4 DOS 16-bit <32M
/dev/hda2 302 302 1001 89250 81 Linux/MINIX
/dev/hda3 260 260 301 5355 81 Linux/MINIX
Command (m for help): n ← 增加一个Partition
Command action
e extended
p primary partition (1-4)
p ← 指定Primary
Partition number (1-4): 4 ← 指定第四个分割区 (前三个已经满了)
First cylinder (162-1001): 162 ← 回答162 (162为系统自动侦测得知)
Last cylinder or +size or +sizeM or +sizeK (162-259): 259 ←
259也是系统自动侦测, 这两个数据, 您依照自己情况调整
Command (m for help): t ← t 变更分割区的 ID
Partition number (1-4): 4 ← 第4个分割区 (您依照情况调整)
Hex code (type L to list codes): 82 ← 82代表Swap Partition
Changed system type of partition 4 to 82 (Linux swap)
Command (m for help): p ← 设定完毕, 我们先瞧一瞧
Disk /dev/hda: 15 heads, 17 sectors, 1001 cylinders
Units = cylinders of 255 * 512 bytes
Device Boot Begin Start End Blocks Id System
/dev/hda1 * 1 1 161 20519 4 DOS 16-bit <32M
/dev/hda2 302 302 1001 89250 81 Linux/MINIX
/dev/hda3 260 260 301 5355 81 Linux/MINIX
/dev/hda4 162 162 259 12495 82 Linux swap
果然新造一个/dev/hda4 partition, 且指定为Linux Swap
Command (m for help): w ← 无误後, 将以上设定存起来
The partition table has been altered.
Please reboot before doing anything else.
步骤二.
执行步骤一後, 重新开机, 接着执行步骤二及步骤三。
$ mkswap -c /dev/hda4 12495 ← 这里 /dev/hda4为刚设定的Swap
Partition, 12495为该分割区的大小
Setting up swapspace, size = 12787712 bytes
步骤三.
$ /sbin/swapon /dev/hda4
假如您是临时需要扩充虚拟记忆体, 上面这三道步骤已经足够了
。但假如您想让系统在每次开机後都自动取用这些虚拟记忆体, 这时
您就要有额外的设定, 否则每次您都要重复执行步骤三, 系统才知道
如何取用该分割区。
要设定这分割区为固定系统的虚拟记忆体很简单, 方发之一, 就
是把 /sbin/swapon /dev/hda4 指令加入 /etc/rc.d/rc.local 档案
内, 或者另外的方法, 在 /etc/fstab档案内加入
/dev/hda4 none swap
一行就可以。 同样的, 假如您的分割区不是/dev/hda4的话, 请更改
这数据以符合您的情况。
您可以用vi 来编辑/dev/fstab档案以便加入这一行, 下图就是笔者
/dev/fstab档案的内容。
/dev/hda2 / ext2 defaults