Linux swap file

Any benefit from putting th swap file on a separate hd?

Interesting question. I’d suspect that there is a benefit; assuming the swap is in use and not on the disk you’re reading/writing to, I’d think that the drive’s internal buffer would provide some benefit. (I hope someone will correct me if I’m wrong, as I’m pretty much fabricating this on the spot.)

At the same time, I’d expect any benefit to be almost negligible. A better question might be – should you use a swap file at all? I’ve read some arguments (for instance, this) saying that with the amount of memory generally found in today’s systems, it is not only unnecessary, but can sometimes hinder performance.

I’m a MacOS X person rather than a Linux person, but it’s my understanding that if it’s a genuinely separate physical hard drive (not a different partition on the same drive), it allows you to have one drive doing reads writes and seeks related to application and documents while the other drive is reading writing and seeking elsewhere doing fileswap routines; since the drive only has one head which can only be in one place at one time, that’s more efficient, so yes, it improves speed.

I’ve never heard anyone claim that any form of Unix is happy about running without swap files. Even a G5 maxxed out with 8 gigs of RAM will run one.

It depends.

If you’re actually going to be using the swap partition (file? pshah.) because you’re going to be running applications whose total memory requirements grossly exceed the physical memory on your computer, and you have one or more applications that are I/O intensive to your “primary” hard drive, then putting the swap partition on a seperate device will certainly be beneficial.

If I’m building a server, I’ll usually put it on a seperate device, if I have enough local disks (at least 4) for two RAID 1 devices. If I’m building a workstation, I don’t really care where I stick it.

Like was said, it depends on how much you use it. If you have a modern computer, then you probably won’t use much swap at all. Therefore, you may be better off putting two of your file partitions, like / and /usr, on seperate drives since they will get used more often, and put the swap partition either one. That’s basically how my FreeBSD system is set up.

I’m looking at crufting together some systems out of found materials. I have a number of <1g hds. W/ Windows, if you don’t have enough ram I’ve read that putting the pagefile on a separate drive cuts the workload of the systemroot dirve. (Appparently, you can’t generate a crash dump if you do this, but I wouldn’t really know what to do with one anyway.) Since the crufted systems will be light on resources all around (by contemporary standards) I’m just brainstorming about how to get the most I can with the items available.

Just curious – how many people do you actually know who’ve tried running without swap? I don’t know anyone, so I have no actual accounts.

My home NetBSD server (mail, http, imap, nfs, etc. + nightly builds for the ACE and TAO scoreboard) has been running solid since a power outage last month… “pstat -s” shows that swap has never been touched.

I once ran a diskless cluster of FreeBSD boxes for a corporate build farm that didn’t have swap configured. At same company, one of our products used Linux on a box with only 8GB of read-only flash, so no swap there.

As long as your working set fits within RAM, there is no absolute need to configure swap. On the other hand, disk is cheap. Even though my server hasn’t touched swap, I’ve got it configured for 4GB.

I like the Knoppix Live CD Linux for booting up and testing stuff. No swap file there. Ditto any similar Live CDs for the usual OSes.

It does run as slow as hell but that’s because of not enough real memory on the things I’ve been using the CD with. (Who would have thought that 64-96Mb is too little? I used to do kernel builds with just 8Mb.) A swap file would only marginally help.

As to the OP, yeah, using a sep. HD is usually a good idea. Using a small spare HD only works if it is fast enough. If the main drive is like an ATA100 then it could possibly be a lot faster if it has the swap partition too.