Help - Search - Members - Calendar
Full Version: Swap Partition Vs. Swap File
OESF Forums > Distros, Development, and Model Specific Forums > Distro Support and Discussion > pdaXrom
ShiroiKuma
Hi all:

I'm thinking of creating a swap partition on an SD. Is there a benefit to having a swap partition as opposed to a swap file? In terms of speed or whatever?
Chero
QUOTE(ShiroiKuma @ Dec 20 2005, 11:49 AM)
Hi all:

I'm thinking of creating a swap partition on an SD. Is there a benefit to having a swap partition as opposed to a swap file? In terms of speed or whatever?
*


Searching on swap would give you a lot of answers (and doubts)

What I've learned from reading the forums :
- some say swap on SD is a bad idea (intensive read and write operations on a medium with limited read and write operations before it breaks). I've been running a swapfile on SD for a year, without troubles. Second reason : SD is supposed to be slow.
- if you create the swapfile right after partitionning (formatting), it will act the same as a swap partition (there will be no defragmentation).
- will swap speed up the Z : according to the faq on the pdaX site : no. I don't totally agree with this, I'm running a 64Mb swapfile and apps launch smoother with swap on. I can imagine why.
- There is a lot of info about swap when you "search".

Chero
ShiroiKuma
I did search the forum for swap partition articles, but really haven't seen anything that would shed clear light on it. I've read one post which simply says that swap partition is faster than a swap file but nothing more.

Is this really so?

How do you set up a swap partition then? I can create a partition with fdisk, but which format do you set it to then? How do you swap on it? Does it need to be specified in fstab? Is it really faster than just swapping on a file?
karlto
QUOTE(ShiroiKuma @ Dec 21 2005, 10:11 AM)
I did search the forum for swap partition articles, but really haven't seen anything that would shed clear light on it. I've read one post which simply says that swap partition is faster than a swap file but nothing more.

Is this really so?

How do you set up a swap partition then? I can create a partition with fdisk, but which format do you set it to then? How do you swap on it? Does it need to be specified in fstab? Is it really faster than just swapping on a file?
*


I have a swap partition on CF microdrive which seems to work OK, but as mentioned the performance increase is probably marginal. I would agree that a partition is probably better than a file, but I doubt you'd see much speed difference on the Z.

After you create the partition in fdisk, change type to 82 (Linux swap) and save changes. Use 'mkswap' to format, then 'swapon' to turn it on. You can add it to fstab, but I'm not sure that pdaXrom actually uses this, and you won't normally reboot often anyway...
Da_Blitz
Swap partions are faster than file when the partion is placed on the outside of the hard drive plates (as the velocity is greater but angular velocity is still the same)

the reason some people say that a partion is faster is becuase of what is stated above, normally a swap file is the first file created and is placed toward the center, basically a file gives you less control of the physical placment where as a partion gives youmore control of where it lies on the hard drive

on an SD card this is a moot point as anywhere on a sd card gives you the same amount of speed

another reason partions are prefered is that they avoid fragmentation (not normally an issue for any filesystem but FAT) however resizing them is next to imposible unlike a file, with a file thogh you do have the slight overhead of filesystem calls however these are neglibgible.

so basically flexiability = file, speed ~= partion (i say aprox. equal because in terms of actual speed it is probally farily close)
Zumi
I don't think that it matters whether you use a swap partition or file if you use it on a flash card (not microdrive), because fragmentation has no meaning on memory cards, so the only drawback, as Da_Blitz said, is the small overhead of the filesystem.
I think that is a good price for sizing your swapfile as you want.

A little more info about swap usage on Z here: http://www.pdaxrom.org/index.php?showid=43&menuid=8

Zumi smile.gif
jcabrer
I've used both swap files and swap partitions. Here is what I found:

Speed is more dependent on the Flash Speed. I used both 4x and 40x cards, and there was a very noticible difference.

As for Files vs. Partitions, there are pros and cons, especially if you are using a microdrive. Using a file leaves the option of adding and removing additional swap files as your needs change. Using a swap partition, you can create it at the outer boundries of the drive to get the extra speed offered by that area of the disk. Files are also a bit slower to access than partitions on the same media. Not really niticable though...
scoutme
I can tell you that a swap is the only solution for memory lack we suffer on our laptop-wonnabe

I use swapd, that creates swap files when needed; in this way you don't stress everytime the same memory region, and you have no risk of underestimating needed swap capacity.

So: swap files are good, especially if dinamically created, by a daemon you install and forget there working for you wink.gif
chal
I'm using a 512mb sandisk sd card. Anyway, I had used it when it was new for a home on sd Cacko rom, which worked fine, but was a little slow (before the newer kernel) so I tried tKc home on sd, and had problems. Then it kinda fizzled out on me and wouldn't work right for anything. I tried formatting it as fat to see if it would be usable for something, but it only compounded the problem. Then I bought a Kingston 256 that would never format as ext 2 correctly and kept trying to fix it, but eventually it was almost unusable.

What has all this got to do with swap? Well, I decided to try and see if I could at least get some swap out of these white elephants. I had qswap, qtopia memory applet and swapd and decided to try them all and see which one worked the best and if i could get one to run on my corrupted sd card.

I put swapd on both of them and put one on my z and one on my wife's and they are at least usable for something. Some progs that were loading slow are now snapping open in about 1 second. This is an awesome program. I was using qswap to set up 32 mb on my cf card, but that's where most of my progs are installed to and I wanted to keep the swap in a different location. This is much better and they were cards that I couldn't use for data.

You guys talking about swap gave me a prod to start trying something with it, so thanks.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.