If mmc/sd swap support is enabled, would you use it?
Yes, I know what swap is for and it would be useful.
77%
[ 7 ]
No, I have loads of free ram and don't need swap.
11%
[ 1 ]
Huh? What's all this swap stuff about anyway?
11%
[ 1 ]
Total Votes : 9
Author
Message
zardoz99 DD-WRT Novice
Joined: 17 May 2007 Posts: 4
Posted: Fri May 18, 2007 14:10 Post subject: Feature Request: Please enable swap file/partition handling.
As a matter of urgency, please could the version of busybox being distributed with dd-wrt v24 be enabled for "mkswap", "swapon" and "swapoff" commands.
This would save a lot of time and memory for those of use who have to install a huge amount of "optware" just to make these functions available.
Now that mmc/sd card support is well established, it makes sense for there to be the basic swapfile or swap-partition support on external media.
i hope it can be possible to add a new busybox.
Now i have to install lots of things to make swapon available for use.
and a torrent client with gui in the webbrowser should be very nice too.
i use enchanced-ctorrent added the torrentclient to a modded firmware but i need to start it in from the commandline.
Is it also possible to add the old smbmount in stead of CIFS , i have here an ethernet harddisk that can only be mounted with a patched smbfs.o file. I tried lot of things with cifs but always get errors. and i think that there a lot of people with that problem.
Swap? On flash device? Flash is pretty much THE reason there are no flash at first place... Flash wears out at each write, hence it is read only, and even when using JFFS etc it still has no swap...
It's worth reading http://en.wikipedia.org/wiki/NAND_flash about flash endurance with modern devices. It's not as bad as it used to be. And with the way that swap would be used on this type of device, it tends to be only at critical times, and not just on the fly paging.
Ok, so it's not a brilliant solution, but until drivers exist that allow the use of the very small CF format hard disks from people like Seagate, we are limited in our choices.
Why do you feel swap is the answer to your problem? What is the problem?
Swapping should be avoided at almost any cost. Even on standard unix/windows machines, swap is an expensive operation. Swapping to flash is even worse for speed.
It won't take long for 100,000 writes to add up when using swap. Even if you only changed a byte every 15 minutes, that's 2.8 years of service. Not to mention, that you don't traditionally erase one byte, but usually a sector/page of flash at a time instead.
Swapping to flash is "Just not the right way to do things" (tm). Either cut back on what processes are running (and/or reduce the RAM usage on some processes), or add more physical RAM.
edit: okay it looks like they're up to about 1,000,000 writes on some devices, I don't know what the ratings are on the chips on wrt platforms.
The mmc device I am using is a SanDisk 1GB MiniSD SDSDM-1024-E10M in a carrier, used as a socket. I wouldn't put any load on the internal flash, mostly as it's extrememly hard to replace. However, a removable external MiniSD card is at least changable if/when it wears out.
Reason for swap? Well, I'm using one of the partially crippled WRT54GSv4 units. The ones where Linksys in thier wisdom decided to halve the built in flash and ram from previous versions. Adding more ram is not going to be easy!
Agreed on the desirability of swap. It's not performant... However, it can save you from having processes killed because of sudden memory requirement transients.
Of course, the next option is swap over ethernet.. It can be done, and it works on "some" networking protocols, like NFS for example. It's actually used in some thin-client workstatsions based on PXE booted linux.
So this installs the swap-utils package and finally I've created a 2 mb swap file in the temp directory. Well, creating a swap file in RAM is not the best idea, but for this test I assume it's okay ;)
And finally I tried to activated swap, but still fails:
Code:
root@Stargate:/jffs/usr/sbin# ./swapon /tmp/test.swp
./swapon: can't resolve symbol 'swapon'
To sum up: I haven't loaded any USB modules, no optware, nothing, it's a clean JFFS. The only thing which is on JFFS is the "swap-utils" package.
So there are two options: A library is missing (e.g. uclibc) or it is failing due to kernel support.
Do you know if a special library is needed for the swap-utils package, at least there is no dependency specified for this package?!
Joined: 18 Jun 2006 Posts: 1110 Location: Kiel (54.4247,10.1721)
Posted: Wed Jan 02, 2008 12:49 Post subject:
flokrates wrote:
To sum up: I haven't loaded any USB modules, no optware, nothing, it's a clean JFFS. The only thing which is on JFFS is the "swap-utils" package.
So there are two options: A library is missing (e.g. uclibc) or it is failing due to kernel support.
Do you know if a special library is needed for the swap-utils package, at least there is no dependency specified for this package?!
You have absolutely NO clue what this is all about, right?
The packages are NOT for dd-wrt. We use them, but they are for other distributions.
In other distributins there are other uClibc and stuff available which HAVE this stuff, but not in dd-wrt.
So you NEED other uclibc... uclibc-opt_0.9.28-12_mipsel.ipk if I remember it correcty.
To bring it to a clear statement: The depencies in the file are not the only stuff you need for running them on dd-wrt.
Afterwards there is still the problem that cou cannot put the lib to /lib, only to /tmp/lib /jffs/lib /mmc/lib or /opt/lib (except you are copying the whole /lib to /jffs/lib and binding the /jffs/lib to /lib). So you need binaries which look in other pathes than /lib or you need an updated ld.so.conf/ld.so.cache which tells the binaries where to look...
This is why in the Wiki Optware installs uclibc-opt_0.9.28-12_mipsel.ipk and afterwards an ipkg-opt which works for opt-bins...
Installing openwrt packages is not easy since they often want to write their stuff to /lib /bin /sbin and so on, but you can not do this using dd-wrt. So installing the crosscompiled unslug bins is far easier.
BusyBox v1.4.2 (2007-11-24 17:34:58 CET) Built-in shell (ash)
Enter 'help' for a list of built-in commands.
root@testing:~# uname -a
Linux testing.113.wck 2.4.35 #2715 Sat Nov 24 17:38:59 CET 2007 mips unknown
root@testing:~# dd if=/dev/zero of=/opt/.swapfile bs=1M count=32
32+0 records in
32+0 records out
root@testing:~# /opt/sbin/mkswap /opt/.swapfile
Setting up swapspace version 1, size = 33550337 bytes
root@testing:~# /opt/sbin/swapon /opt/.swapfile
root@testing:~# free
total used free shared buffers
Mem: 30316 29620 696 0 1520
Swap: 32760 0 32760
Total: 63076 29620 33456
root@testing:~#
First thanks for your reply. Nevertheless I'm new to this topic and I try to get the big picture, as it is quite confusing in some places.
Just to let you know: Swapping is working for me using the latest busybox from optware, but I was wondering how oleo can do it in his script as he is mounting his opt partition after he has activated swapping. Also he is setting the library path /jffs/lib and /jffs/usr/lib, I can't see any library path to /opt/lib, /jffs/opt/lib where the libs from the "uclibc-opt" package are located:
Code:
# assure correct paths when running OpenWRT programs like e2fsck
export LD_LIBRARY_PATH=/jffs/lib:/jffs/usr/lib
export PATH=/jffs/bin:/jffs/sbin:/jffs/usr/sbin:/jffs/usr/bin:/bin:/sbin