LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   what is best location of swap (https://www.linuxquestions.org/questions/linux-general-1/what-is-best-location-of-swap-496065/)

Kristian2 10-27-2006 08:52 AM

what is best location of swap
 
The first part of my HD is occupied by XP, the rest I plan to fill with Linux. I was wondering what is performance wise the best physical location of swap, if it matters all that much in the first place.
My Linux partitions will be something like:
/root
/tmp
/var
/swap
/home
/usr/local/games
/boot (primary partition, all the rest logical)

where root and home being the largest. I thought between the two largest partitions would be the best choice, or otherwise at the beginning.
I have 1G of RAM and twice this amount of swap seems a bit waste of space, I thought around 500MB.
What can you suggest?

linmix 10-27-2006 09:13 AM

The physical of swap isn't very important, as long as you set the right config options for your HDD (like DMA etc - If your distro doesn't do so out of the box, use hdparm). Is is true that the nearer to the beginning of the HDD the faster the access times, but the differences are very small, and then there's the matter of the distribution of the cylinders... don't worry. Just keep in mind that it's easier to change the size of a partition at the end of it than at the beginning, and that if you want to tweak the other partition sizes (change them in any way after your initial install or add new partitions later) it's probably a good idea to have swap before anything else so you won't have to remember its location and modify fstab accordingly.

As for swap=2xRAM, that's true for older machines with little RAM. In your case it will depend on what you are going to use your box for. A server may need more RAM/SWAP, a typical desktop will be fine with 500MB RAM

Kristian2 10-27-2006 09:17 AM

Appreciated/fixed

linmix 10-27-2006 09:38 AM

Graag gedaan!

Kristian2 10-27-2006 10:07 AM

I thought you were Spanish.

linmix 10-28-2006 11:47 AM

Think again! ;)

I just live there (/here)

Kristian2 10-28-2006 12:29 PM

I'm afraid the subject gets a little off topic, pensionado.

reddazz 10-28-2006 01:01 PM

If you are creating a system for desktop use, there is little advantage in making so many partitions. Most people just need / and a seperate /home. As for swap, try to avoid making it the first partition on any hard drive. I've seen a few people who had problems booting their systems due to having swap on the first primary partition.

Kristian2 10-28-2006 01:20 PM

The first part of my hd consists of XP, of which the first partition is primary and the other partitions are logical. As you can have one extended partition, this means that my other (linux) partitions are logical, except for the last /boot partition.
The partitions /tmp and /var (trash directories) are subject to frequent change and in order to avoid defragmentation it is not unwise to have separate partitions of them. To have a separate partition of /usr (or better /opt) as well, is perhaps for a desktop pc not necessary, but programs that are regularly updated or modified I prefer to have on a separate partition as well, perhaps a little overly diligent. It may waste some harddisk space in exchange for less fragmentation. However fragmentation seems to be hardly an issue on Unixes. No one bothers, does one?

sundialsvcs 10-28-2006 01:26 PM

Buy as much RAM as your machine can hold.

I set up my systems with three partitions: /boot, swap space, and everything else. For ordinary purposes this gives the most flexibility. (I set up big servers differently.)

I allocate swap-space that's 2.5 times the size of physical RAM.

If there is more than one fast disk-volume available, and the I/O infrastructure is such that multiple disk I/Os can be performed simultaneously (usually not the case on a garden-variety PC), then I'll divide the swap space across all of the spindles that are available.

But RAM is king. The best swap is the one you never have to do. "Chips are cheap."

Kristian2 10-28-2006 02:39 PM

What about that fragmentation issue (from swap to fragmentation), to what extend does fragmentation play a role?

linmix 10-28-2006 03:13 PM

Is fragmentation an issue at all? THere are no defrag aps AKAIK so I thought it wasn't.

(P.S. pensionado? I wish - Not sure if that still exists by the time I'm eligeable)

reddazz 10-28-2006 05:43 PM

Linux filesystems don't fragment very much. Search for "linux+disk+defragmentation" and "linux+fragmentation" on google and you will find lots of articles that explain the issue in detail.


All times are GMT -5. The time now is 01:50 AM.