LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Where to put swap (https://www.linuxquestions.org/questions/linux-newbie-8/where-to-put-swap-138401/)

SBarretDolph 01-25-2004 07:56 AM

Where to put swap
 
I will have the following scheme

/ 1g
/swap 1024
/var 5g
/usr 7g
/home 4g

Where should I put swap?

I would tend to do this

sda1 /
sda5 /swap
sda6 /var
sda7 /usr
sda8 /home

Will that give me problems? I have read, or remember, or don't know..that older hard drives like swap in the middle but newer and faster ones like it on the outsid. But is sda8 (on my setup) on the outside? I have a SCSI drive.

Cordially,
S. Barret Dolph

UltimaGuy 01-25-2004 08:20 AM

Your current setup is quite fine. The swap is in a good place. And, swap must be towards the middle, and never towards the outer end!

SBarretDolph 01-25-2004 09:16 AM

Should I then put swap more in the middle like after /var?

UltimaGuy 01-25-2004 09:21 AM

Middle does not mean the middle literally. It means the centre if the hdd, the inner end ,i.e., the opposite of outer end. So your current setup is ok, but it will be better if you interchange the / and swap partitions.

SBarretDolph 01-25-2004 09:25 AM

As a primary partition?

bigjohn 01-25-2004 09:40 AM

Just for info, I recently played with installing gentoo. I had originally had XP, mandrake and debian. All on single partitions - with no problems - i.e. no swap either.

But installing gentoo was a little like "pulling teeth", and as much as I tried, I couldn't get it to install on a single partition (the gentoo default is boot, swap and root).

So I totally re-installed/partitioned as follows:-

hda1 = windows XP (primary partition)
hda2 = boot (primary partition)
hda3 = swap (primary partition)
hda4 = extended to be hda5 with gentoo and hda6 with mandrake

When I was looking into this, I was also told about possible performance gains by placing the swap in the middle of the hard disc, but now understand that this was mainly from when hard discs weren't as fast as they are now.

I am presuming that there may still be some benefit's if your hard discs are massive and you are doing shitloads of server type stuff, then you may end up needing to centralise the swap to reduce the hard disc search times etc.

Strictly speaking, you don't really need swap, given that these days, system's tend to have enough ram to handle most app's. But as with my case, having a swap partition has made my system take the gentoo install OK, I don't know/can't tell or see if it's had any beneficial effect on my mandrake install.

Oh and I made the swap about 1.5 gig's, because I have 768 megs of physical ram installed and just followed the wisdom of having a swap of double what ram you have installed - this hasn't caused me any problems.

good luck

regards

John

UltimaGuy 01-26-2004 01:59 AM

No, not as a primary partition. You can always make / as primary partition. I asked you to just put swap in the beginning of the drive. Unlike in Windows, you can make up to four primary partitions in linux, and the first partition need not be a primary partition(No problem even if it is a primary partition or not!)

SciYro 01-26-2004 03:43 AM

the swap should be placed were its most acessable from wereeever it is on teh disk, (i put mine in teh front, after reading this im like well taht could be a problem (althio it usualy only needs swap when i do stuff like compile large programs (glibc is teh only program that messed up cuse i needed to turn on swap file (i thought i 4got somthing :) ))

stickman 01-26-2004 12:38 PM

The location of swap space really depends on how critical it's use is. Keep in mind that swap is used as additional memory when needed. Unfortunately, using swap is not as fast a real memory. If swap speed is critical, it needs to be placed on the begining of the drive where access times are fastest. If swap is being used just prevent things from locking up or crashing, then any location will do.

Khabi 01-26-2004 02:28 PM

Quote:

Originally posted by UltimaGuy
Your current setup is quite fine. The swap is in a good place. And, swap must be towards the middle, and never towards the outer end!
Really? I always heard it should be on the outer end because it spins faster there and will be read quicker resulting in better swap performance. I'm not doubting you, but could you explain why it would be better in the middle over the outside?

UltimaGuy 01-26-2004 10:44 PM

Khabi, if you think about it, you'll recognize that the beginning or the center of the drive is more easily accessible than the outer end, as it has a smaller cylinder area to rotate and is more easily accessible to the R/W head. So, since swap does have a lot of R/W hits, it is better to be in the beginning.

Or, that is what I've thought. But when I googled, I did find that it is recommended to place swap partitions at the end of newer drives to improve performance. I am stumped by this, but I'll learn more when I have spare time and post it here...

dalek 01-27-2004 12:07 AM

The only thing I have ran into when putting swap first and then, absentmindedly of course, pointing grub to it for the conf file. Needless to say, it didn't find it.

I put mine like this for Gentoo:

/boot
swap
/
/usr
/home

No problems. Grub is happy and it is fast. I need to get another stick of 512 for mine too. Mozilla was using 320MBs earlier. I closed it, still holding onto it. Then I did killall. That worked. :tisk: Teach Mozilla to mess with me. :p

Your way should work just fine. Go for it.

Going to newegg for memory.

Later

:D :D :D :D


All times are GMT -5. The time now is 06:48 PM.