LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 04-22-2007, 06:10 AM   #1
BrokeBody
LQ Newbie
 
Registered: Apr 2007
Location: Serbia
Distribution: Kubuntu 7.04 Feisty Fawn
Posts: 6

Rep: Reputation: 0
Swap - Primary or Extended


Is your swap partition primary or extended. How should it be?

I always set up my swap and my root partition as primary, but I was wondering, should I set up swap as extended from my primary root partition, or it doesn't matter whether it's going to be primary or extended?
 
Old 04-22-2007, 06:18 AM   #2
pusrob
Member
 
Registered: Jan 2006
Distribution: Debian
Posts: 463

Rep: Reputation: 35
Hello!
Well, it does not matter if you use a windows, and a linux, and you don't want to use other OS in the future. For storage partitions you use extended parts I suppose. If you plan to use more than 2 OS's in the future, than an extra primary partition can be handy. If you want to live with 2 OS's, than you can keep your current partitioning. That's all.
 
Old 04-22-2007, 06:22 AM   #3
BrokeBody
LQ Newbie
 
Registered: Apr 2007
Location: Serbia
Distribution: Kubuntu 7.04 Feisty Fawn
Posts: 6

Original Poster
Rep: Reputation: 0
So, it doesn't matter if swap partition is primary or extended? That was my question actually.
 
Old 04-22-2007, 03:11 PM   #4
reddazz
Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 73
Moved: This thread is more suitable in Linux Hardware and has been moved accordingly to help your thread/question get the exposure it deserves.
 
Old 04-22-2007, 03:13 PM   #5
reddazz
Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 73
It should not really matter where you put your swap although I have noticed that some people have problems booting if they put swap as the first primary partition.
 
Old 04-22-2007, 04:59 PM   #6
J.W.
LQ Veteran
 
Registered: Mar 2003
Location: Milwaukee, WI
Distribution: Mint
Posts: 6,642

Rep: Reputation: 69
I've had swap in both primary and extended, it makes no difference. FWIW, I usually put swap at the end of the drive (ie, it's the last partition I define, and thus typically is in extended)
 
Old 04-22-2007, 08:13 PM   #7
jay73
Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
Wouldn't swap performance benefit if the partition were at the start of the disk, just like tmp and var?
 
Old 04-23-2007, 08:40 PM   #8
dragonnefyre
LQ Newbie
 
Registered: Aug 2006
Distribution: Slackware 14.0
Posts: 18

Rep: Reputation: 1
I have my swap partition as the 2nd primary partition, /boot being the first. As I have plenty of RAM it is hardly used. Everything else is on a logical partition in the extended partition - /, /usr, /var, /opt, /home, /tmp). As for performance, I would suspect it would be better if the swap partition is at the centre of the disk (less head movement) or on another disk altogether which would mean either a big swap partition or put other partitions on with it. If you really want extra performance then how about SATA disks?
 
Old 04-23-2007, 09:01 PM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,103

Rep: Reputation: 982Reputation: 982Reputation: 982Reputation: 982Reputation: 982Reputation: 982Reputation: 982Reputation: 982
Under Linux there is no requirement for any primary partitions. Full stop.
Nor performance penalty.

As for file (directory) placement - forget it; for almost everybody it's a waste of time. What's the point of worrying about /var when /home is at the other end of the drive for example ???.
And the I/O schedulers aggregate the I/O for you anyway unless you are in the (very) unusual situation of using NOOP. Then there's (O/S and drive) caching, maybe even RAID, or LVM, or ...

Not even worth worrying about.
 
Old 04-23-2007, 09:10 PM   #10
jay73
Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
dragonnefyre:

That was a strictly theoretical question, actually. I have 2 GB DDR2 and Sata 2 disks so I guess I could dispense with swap space altogether.

I 've heard your remark about the center of the disk being the best spot before but I've always wondered whether that's a "universal" truth. It just seems to me that the best option is to place swap on the fastest part(s) of the disk, right next to your system files. Which explains my remark about the start of the disk or (at least the platter). On the other hand, I do agree that it's a good idea to spread swap across multiple disks whenever that's an option, especially with pri=1 option.

syg00:

Those are really interesting remarks but again I wonder whether those are valid at all times. E.g. I use Gentoo so I occasionally do lots of compiling - do you really think that I wouldn't benefit at all from having var on the fastest part of the disk?

Last edited by jay73; 04-23-2007 at 09:19 PM.
 
Old 04-23-2007, 09:14 PM   #11
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Squeeze 2.6.32.9 SMP AMD64
Posts: 3,238

Rep: Reputation: 121Reputation: 121
Quote:
On the other hand, I do agree that it's a good idea to spread swap across multiple disks whenever that's an option, especially with pri=1 option.
Except for that pesky issue of memory just being so cheap. If you never use the swap space, it doesn't matter where it is. Unless you're running an enterprise server, put your swap on the clunkiest slowest drive you have. That way, if you ever actually use it, the slowness will punish you so much you'll go out and buy another stick of RAM.
 
Old 04-23-2007, 09:20 PM   #12
jay73
Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
Now there's a great thinker

Thinking of which: where should a person put that stick of RAM to get the best performance?

Last edited by jay73; 04-23-2007 at 09:24 PM.
 
Old 04-23-2007, 10:21 PM   #13
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,103

Rep: Reputation: 982Reputation: 982Reputation: 982Reputation: 982Reputation: 982Reputation: 982Reputation: 982Reputation: 982
Quote:
Originally Posted by jay73
Those are really interesting remarks but again I wonder whether those are valid at all times. E.g. I use Gentoo so I occasionally do lots of compiling - do you really think that I wouldn't benefit at all from having var on the fastest part of the disk?
There is no (effectively) fastest part of the disk on modern hardware.
There are plenty of ways to speed up compiling - worrying about directory placement ain't one of them IMHO. With the obvious exception of /tmp - make sure it's in memory.
 
Old 04-23-2007, 10:40 PM   #14
J.W.
LQ Veteran
 
Registered: Mar 2003
Location: Milwaukee, WI
Distribution: Mint
Posts: 6,642

Rep: Reputation: 69
In most modern desktop Linux systems, swap seldom actually gets used. Keep in mind that swap will only get used if/when the system demands for memory exceed physical capacity, and thus the system is forced to write memory pages to disk. The more RAM you have, the less likely that becomes, and my guess is that if you've got, say, 256Mg RAM, your swap space might get used lightly, with 512 it might get used once in a while, and with 1G or more it probably almost never gets used.

For high traffic, professional grade servers, having a lot of swap is good insurance, but for the typical desktop user, setting up a swap space or more than say 512Mg is probably not really necessary. Back in the days when having 16Mg of RAM was considered impressive and having 32Mg of RAM was considered bleeding edge, setting up a swap of twice the size of RAM was important, but these days, it's pretty rare that a typical desktop user will actually put such a heavy load on the CPU that all RAM is in use (meaning that the results of running "free" show that the 'total' value in Mem is the same as the 'used' value in "-/+ buffers/cache") and the "twice RAM rule" is a legacy of long-past years

To return to the original question, my personal view would be that swap probably isn't going to get used much, and thus, its location on the disk is not significant in terms of performance
 
  


Reply

Tags
extended, partition, primary, swap


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Swap partition...primary or extended|logical? mr.v. Linux - Newbie 1 07-06-2006 03:30 PM
Primary or Extended Partition ? Christof999 Linux - General 4 07-02-2006 12:05 PM
partitions -- primary vs. extended pH* Linux - General 1 04-06-2004 01:56 PM
Primary and Extended Partitions Flossie Linux - Newbie 2 03-16-2004 12:25 PM
Primary and Extended Partitions batman Linux - Software 1 10-18-2000 01:17 PM


All times are GMT -5. The time now is 03:21 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration