You are not logged in.

#1 2007-03-20 19:21:03

fk
Member
From: Germany
Registered: 2006-04-29
Posts: 524

swapfile vs. swappartition? [solved]

I thinking about to use a swapfile instead of a swap partition.

Now I want to know , if i have some disadvantages with a swapfile?

What is about suspend to disk, can it handle this?

Last edited by fk (2007-03-27 13:26:38)


Have you tried to turn it off and on again?

Offline

#2 2007-03-20 20:49:38

Mr Green
Forum Fellow
From: U.K.
Registered: 2003-12-21
Posts: 5,920
Website

Re: swapfile vs. swappartition? [solved]

Its interesting this topic comes up I was thinking about losing my swap partition today

/tmp space seems to take up half my ram ??? is that good or bad

Assumed swap space was for lower end systems with low ram

/me watches thread


Mr Green I like Landuke!

Offline

#3 2007-03-20 21:20:30

fk
Member
From: Germany
Registered: 2006-04-29
Posts: 524

Re: swapfile vs. swappartition? [solved]

Mr Green wrote:

Its interesting this topic comes up I was thinking about losing my swap partition today

/tmp space seems to take up half my ram ??? is that good or bad

Assumed swap space was for lower end systems with low ram

/me watches thread

If you use tmpfs , the default size is half of RAM, but only what is need are in use

swap only for old systems?


Have you tried to turn it off and on again?

Offline

#4 2007-03-20 23:47:34

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: swapfile vs. swappartition? [solved]

swap isnt essential on many modern systems *depending on the workload and ram*

So yeah, if you're doing anything remotely ram intensive, such as graphics work, or video, or audio work (not just playing), then swap is good and useful.

If you use a lot of ram, or tend to use lot's of programs, then swap is also useful, as applications can be swapped out, and ram used for caches.

So it's fine to have swap. There's no disadvantage to having it. And 512mb/1gb on a hard drive nowadays is generally cheap and sparable.


James

Offline

#5 2007-03-21 00:28:14

lilsirecho
Veteran
Registered: 2003-10-24
Posts: 5,000

Re: swapfile vs. swappartition? [solved]

Swapfile is limited to file size limits.

Swap partition is usually much greater than file-limited swapfile, set by the user.

Answered your query...


Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit!     X-ray confirms Iam spineless!

Offline

#6 2007-03-21 03:58:14

Aziere
Member
Registered: 2007-03-16
Posts: 23

Re: swapfile vs. swappartition? [solved]

If you can't fill your RAM, then you have no need for swap.

Offline

#7 2007-03-21 06:14:15

Dusty
Schwag Merchant
From: Medicine Hat, Alberta, Canada
Registered: 2004-01-18
Posts: 5,986
Website

Re: swapfile vs. swappartition? [solved]

Sorry guys, the question isn't whether swap is useful, its whether a swap file is better than a swap partition.

I don't recall directly, but I believe its possible for swap files to become noncontiguous, which doesn't happen with a swap partition. This can cause access time to be reduced for a partition.

On the other hand, its easier to resize a swap file if you find you're running out of room.

Dusty

Offline

#8 2007-03-21 11:05:27

Mr Green
Forum Fellow
From: U.K.
Registered: 2003-12-21
Posts: 5,920
Website

Re: swapfile vs. swappartition? [solved]

http://enterprise.linux.com/article.pl? … 129&tid=42

Dusty is right ... resizing a swap-file is easier

how can you tell if swap is being used ??? [realtime] conky I guess


Mr Green I like Landuke!

Offline

#9 2007-03-21 11:53:50

fk
Member
From: Germany
Registered: 2006-04-29
Posts: 524

Re: swapfile vs. swappartition? [solved]

The swap size is not the problem, I haven't seen that my swap are in use, evrytime 100% free.. I have 2GB RAM, but I have read that swap is fundamental for kernel performache, so I would make a 512MB swapfile instead of a swappartition.

Last edited by fk (2007-03-21 13:34:11)


Have you tried to turn it off and on again?

Offline

#10 2007-03-21 12:12:35

Mr Green
Forum Fellow
From: U.K.
Registered: 2003-12-21
Posts: 5,920
Website

Re: swapfile vs. swappartition? [solved]

 free
             total       used       free     shared    buffers     cached
Mem:       2075680    2003488      72192          0      46248    1579344
-/+ buffers/cache:     377896    1697784
Swap:      4996204          0    4996204

something ate my ram lol ... ignore swap size I just had a spare partition which I used, would be handy for something else though


Mr Green I like Landuke!

Offline

#11 2007-03-22 12:46:30

fk
Member
From: Germany
Registered: 2006-04-29
Posts: 524

Re: swapfile vs. swappartition? [solved]

any other opinions here?


Have you tried to turn it off and on again?

Offline

#12 2007-03-22 16:16:19

noriko
Member
From: In My Mind
Registered: 2006-06-09
Posts: 535
Website

Re: swapfile vs. swappartition? [solved]

i ould go for a swap partition on it's own ..
reason being that if the host partition becomes fragmented, and yes it will not much but it will ..
i'd rather not be able to resize it ... [debated below] than have it become slower...

the question on whether you are able to resize it can in soem cases become, well in soem cases it does not apply..

i currently have a 2gb swap partition ... i hardly ever use it, but when i do it becomes very necessary to have it large (i often wanna play games and encode videos at the same time) .. but the point i'm trying to make is that if you leave it at hte end of the drive .. then you can resize it into free space whenever you like.


The.Revolution.Is.Coming - - To fight, To hunger, To Resist!

Offline

#13 2007-03-23 06:49:07

dr_te_z
Member
From: Zoetermeer, the Netherlands
Registered: 2006-12-06
Posts: 154

Re: swapfile vs. swappartition? [solved]

A swap partition is always better than a swap-file. No overhead/buffering from file system. I think you can compare a swap partition with a dedicated raw-device which performes better than the file-system.

Placing the swap partition at the end of the disk, like noriko suggests, is not the best place I'm afraid. In the middle would be best to minimize the movement of the read/write heads.


Somewhere between "too small" and "too large" lies the size that is just right.
- Scott Hayes

Offline

#14 2007-03-23 08:24:56

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: swapfile vs. swappartition? [solved]

i might add, that suspend2 supports suspend/resume from a file. Take a look at the details on their site.

James

Offline

#15 2007-03-23 17:58:28

fk
Member
From: Germany
Registered: 2006-04-29
Posts: 524

Re: swapfile vs. swappartition? [solved]

dr_te_z wrote:

A swap partition is always better than a swap-file. No overhead/buffering from file system. I think you can compare a swap partition with a dedicated raw-device which performes better than the file-system.

Placing the swap partition at the end of the disk, like noriko suggests, is not the best place I'm afraid. In the middle would be best to minimize the movement of the read/write heads.

Really? I found this

http://lkml.org/lkml/2005/7/7/326

and it says that the filesystem isn't a problem..

Last edited by fk (2007-03-23 18:13:45)


Have you tried to turn it off and on again?

Offline

#16 2007-03-26 05:52:45

dr_te_z
Member
From: Zoetermeer, the Netherlands
Registered: 2006-12-06
Posts: 154

Re: swapfile vs. swappartition? [solved]

It seems that my computer is running 2.6, but my brain is still polluted with 2.4 knowledge. Sorry about that.


Somewhere between "too small" and "too large" lies the size that is just right.
- Scott Hayes

Offline

#17 2007-03-26 15:21:57

lilsirecho
Veteran
Registered: 2003-10-24
Posts: 5,000

Re: swapfile vs. swappartition? [solved]

I might suggest that both types of swap could be provided...a swapfile and a partition.  As noriko suggests it may be advantageous when multitasking.

I would also suggest that a dual swap partition is possible, one in the middle of the partition scheme and a second at the end in free space area.  These could also be appended by a swapfile.

If such an arrangement is performed the priority can be assigned such that the swaps act as a "raid" system.

The usefulness of swap is user dependent on what the user desires to use it for......

Swapon and swapoff can be implemented to modify the setup's response at the user's discretion.

Should the flash drives be improved(perhaps with hafnium chips) external swap drives will be viable.

Just some thoughts on the subject.....


Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit!     X-ray confirms Iam spineless!

Offline

#18 2007-03-26 15:50:10

Mr Green
Forum Fellow
From: U.K.
Registered: 2003-12-21
Posts: 5,920
Website

Re: swapfile vs. swappartition? [solved]

I set up swap for my system from the old days when you ran a swap partition twice the size of ram

Now that said I ended up with a huge swap partition simply because I stopped having /var on it

To me swap space was used for older older systems with low ram, is there any need to have swap space at all?

Its a tough call it should be left down to the user to suit there needs


Mr Green I like Landuke!

Offline

#19 2007-03-27 13:24:19

stb
Member
Registered: 2007-03-13
Posts: 40

Re: swapfile vs. swappartition? [solved]

fk wrote:
dr_te_z wrote:

A swap partition is always better than a swap-file. No overhead/buffering from file system. I think you can compare a swap partition with a dedicated raw-device which performes better than the file-system.

Placing the swap partition at the end of the disk, like noriko suggests, is not the best place I'm afraid. In the middle would be best to minimize the movement of the read/write heads.

Really? I found this

http://lkml.org/lkml/2005/7/7/326

and it says that the filesystem isn't a problem..

Thanks for that link. But it should answer your question, shouldn't it?

Offline

#20 2007-03-27 13:26:19

fk
Member
From: Germany
Registered: 2006-04-29
Posts: 524

Re: swapfile vs. swappartition? [solved]

stb wrote:
fk wrote:
dr_te_z wrote:

A swap partition is always better than a swap-file. No overhead/buffering from file system. I think you can compare a swap partition with a dedicated raw-device which performes better than the file-system.

Placing the swap partition at the end of the disk, like noriko suggests, is not the best place I'm afraid. In the middle would be best to minimize the movement of the read/write heads.

Really? I found this

http://lkml.org/lkml/2005/7/7/326

and it says that the filesystem isn't a problem..

Thanks for that link. But it should answer your question, shouldn't it?

Yes, it does.


Have you tried to turn it off and on again?

Offline

#21 2007-04-01 19:52:31

fk
Member
From: Germany
Registered: 2006-04-29
Posts: 524

Re: swapfile vs. swappartition? [solved]

One more question:


Where is the best place for a swapfile

in /var?


Have you tried to turn it off and on again?

Offline

#22 2007-04-01 21:26:07

patroclo7
Member
From: Bassano del Grappa, ITALY
Registered: 2006-01-11
Posts: 915

Re: swapfile vs. swappartition? [solved]

I do not know if there is a "best" place (the place is just unrelevant for performance). Since it is a file created by hand and not seen by the package manager, I like to put it where the package manager does not operate, i.e. in /usr/local.


Mortuus in anima, curam gero cutis

Offline

#23 2007-04-02 11:18:53

dr_te_z
Member
From: Zoetermeer, the Netherlands
Registered: 2006-12-06
Posts: 154

Re: swapfile vs. swappartition? [solved]

patroclo7 wrote:

i.e. in /usr/local.

When you take these (http://tldp.org/LDP/sag/html/fs-background.html) serious  I'd say somewhere in /tmp. When you've got /tmp assigned to tmpfs then use /var.


Somewhere between "too small" and "too large" lies the size that is just right.
- Scott Hayes

Offline

Board footer

Powered by FluxBB