给E4200路由器增加SWAP缓存,稳定BT下载

Linksys E4200的内存只有64M,刷了tomatoUSB固件再加载Transmission BT下载后,这么点内存颇为捉襟见肘。BT任务一多,Transmission daemon就会crash,有时甚至影响到整个路由器的稳定性。现在通过在外接到USB硬盘上增加SWAP分区,可以有效的解决E4200内存不够用的问题。这下BT下载稳定、可靠了。

下面具体说明操作步骤:

1.把移动硬盘接在E4200路由器上,在tomato的管理界面中启用USB支持,USB2.0支持以及EXT2/EXT3支持,选择automount,保存设置后,先unmount这块外接硬盘。

2.telnet或者ssh到路由器

Code:
fdisk -l

查看可用设备/dev/sda.

3) 用fdisk创建分区

Code:
fdisk /dev/sda # adjust for disk if necessary
p # to see existing partitions
d # to delete partition if any
n # new partition
p # primary partition
1 # a one for partition 1 for Optware
 # start at default 1 block
+368M # size of Optware partition in MB; can be larger
p # check partition
n # new swap
p # primary
2 # partition 2 Swap
 # start at default block
+64M # size of Swap in MB; can be larger
t # set type of Swap partition
2 # partition 2 is Swap
82 # swap type
p # check partitions
n # new Data for remaining
p # primary
3 # partition 3 Data
 # default start block
 # default remaining blocks
p # check partitions
w # write it all out and exit

4) 格式化各分区

Code:
mke2fs -j -L Optware /dev/sda1
mkswap -L Swap /dev/sda2
mke2fs -j -L Data /dev/sda3

5) 现在可以重启路由器,可以在USB页面里面看到mount了先前创建的Optware和Data分区,swap分区尚未被激活。

6) 在Data分区根目录创建 “00-start-swap.autorun”:

#!/bin/sh # $1 - The fully qualified path of the root directory of the mounted # The decriptive label assigned to the swap partition. SWAPNAME=SWAP # If no parameter, complain and quit. [[ xx == x$1x ]] && exit # Edit fstab to put the swap partition label there. sed -i "/^LABEL=.* swap swap/d" /etc/fstab echo "LABEL=$SWAPNAME swap swap" >>/etc/fstab # Activate the swap partition swapon -a

保存脚本并赋予运行权限:

chmod 0755 00-start-swap.autorun

大功告成,重新mount移动硬盘就可以看到swap分区被激活,在tomato的status里面除了系统的硬件内存,还可以看到swap空间有多少。

Enjoy!

Leave a Reply

Your email address will not be published. Required fields are marked *