Newsgroups: gmane.linux.debian.user Date: Fri, 13 Aug 2004 16:34:25 +0800
>2. Is it better for the swap to be on a different drive? If so, how does one >move it?
Don't move it. I recommend a swap _file_ not a parition. It's more flexible wrt resizing if you need. and if/when you use a 2.6 kernel there are no peformance benefits to swap partitions. Iff there ever were on desktops.
Swap belongs on your least busy drive, in your busiest partition.
Least busy drive reduces contention. Busiest parition reduces average seek.
John Summerfield
>4. Swap file vs swap partition--I did not know there was such an alternative >in linux. IF a file is better, how do I change over? (Swap is almost never >used, it seems.)
A word about swap space.
Although you can create swap space as a file, instead of the kernel handling a raw partition to swap, all swapping must go through the file system, which slows swapping considerably. Ideally, you would always want swap as a partition.
With that said, if you have 2 disks, it's important to have them both installed as IDE primaries, never having two disks on the same IDE channel as primary and secondary. The idea is that your system can read/write to the two primaries at the same time, whereas with a primary and secondary setup, the read/write must alternate between the primary and secondary.
Now, if you have your two disks installed and IDE primaries, and you create a swap partition on both disks, and both disks are set to the same priority, say 1, then the net effect is that when swapping occurs, data is written to both swap areas interleaved. This is the fastest way of handling swap space.
With two disk set as IDE primaries, further speed gains can be had by splitting your busiest partitions on the two different drives. As an example, I would say that /usr and /var are probably the system's busiest partitions. If the /usr partition is on /dev/hda and /var is on /dev/hdc, you would probably see slightly better system performance.
Mike
> > Although you can create swap space as a file, instead of the kernel > > handling a raw partition to swap, all swapping must go through the > > file system, which slows swapping considerably. > > Not so in 2.6. > > This doesn't address this particular issue, but it does explain why it > might be so: > http://www.osdl.org/docs/linux_journaling_filesystems_and_workloads.pdf[] > > I found it looking for a comparison of filesystems; that's about page 28. > > > Ideally, you would always want swap as a partition. > > I do not believe that is so on single-drive systems. Consider the > amount of time seeking between data and swap paritions, I can't see > how any optimisations can overcome the laws of physics.
What laws of physics pertain to the issue of swap being a file versus swap being a partition? It really doesn't matter which type of file system you use. One may be faster that the other. One may be better for recovering from a system crash. One may be better for logical volume management. But none are faster than the kernel using a partition for swap in raw mode. That's why AIX, Solaris, HPUX and Linux, by default, use swap partitions, not files.
> > With that said, if you have 2 disks, it's important to have them both > > installed as IDE primaries, never having two disks on the same IDE > > channel as primary and secondary. The idea is that your system can > > read/write to the two primaries at the same time, whereas with a > > primary and secondary setup, the read/write must alternate between > > the primary and secondary. > > > > Now, if you have your two disks installed and IDE primaries, and you > > create a swap partition on both disks, and both disks are set to the > > same priority, say 1, then the net effect is that when swapping > > occurs, data is written to both swap areas interleaved. This is the > > fastest way of handling swap space. > > NO NO NO. > best place for swap, least-used drive. > Best parition - busiest.
Give more of an explanation than this. I suppose that setting a single disk to be used solely for a swap partition would be good although a bit impractical.
> > With two disk set as IDE primaries, further speed gains can be had by > > splitting your busiest partitions on the two different drives. As an > > example, I would say that /usr and /var are probably the system's > > busiest partitions. If the /usr partition is on /dev/hda and /var is > > on /dev/hdc, you would probably see slightly better system performance. > > You'd be surprised. > > _I_'d guess /usr isn't used all that much, and /home gets thrashed.
Well I suppose that depends, now, doesn't it Where are all the system commands a user would use, /usr/bin, /usr/sbin and possibly /usr/local/bin(not used that much in Debian). Where is X, /usr/X11R6. Where are the libraries and header files for compiling, /usr/lib and /usr/include. Where is most of the system documentation, /usr/share. Another location for user commands could be /opt. But then, Debian doesn't really utilize /opt. All logs are in /var. Most all configurations are in /etc. So what's thrashing around in /home?
> I was really amazed on OS/2 some years ago when I put swap on my data > drive. The system just about died.
Well, UNIX and Linux is not OS2. All MS Windows machines put swap in a paging file, and any MS Windows machine is the worst example of a tuned VMM.
Mike
> With that said, if you have 2 disks, it's important to have them both > installed as IDE primaries, never having two disks on the same IDE > channel as primary and secondary. The idea is that your system can > read/write to the two primaries at the same time, whereas with a primary > and secondary setup, the read/write must alternate between the primary > and secondary.
I thought this as well. But I was also told that if two differeing devices share and IDE, the slower one sets the rate. (This may be the cause of all those error-51 messages.) So if I put the two disks on two IDEs as primaries and the CDs as secondaries, the results may not be good.
However, I originally set things up similarly and had no complaints. So … what is the truth here.