[SOLVED] Automatically Assign Swap File At Startup


Zero3K

Active Member
Joined
Sep 27, 2003
Messages
828
Age
39
Location
USA
Website
Visit site
How do I do it? (I already made one with the filename of swap.img that's on my SD card named PANDORA-SD2)
 
Nevermind. I fixed the problem by using a swap partition instead of a swapfile and adding the proper line to /etc/fstab.
 
If there isn't already, could you add a step-by-step either here or, preferably, on the wiki? There's sure to be other people wanting to setup swap, I know I've got a 16BG class 10 SD card aching to be used for primary storage and swap as soon as my Pandora arrives.
 
Here's how to do it:

1. Get GParted from the Pandora File Archive.
2. Run it.
3. Either resize the partition of the SD card that you want to use as swap space or format it as linux-swap.
4. If you resized the partition, then make a new partition that's formatted as linux-swap.
5. Edit /etc/fstab to include this line of text:
SWAP_LOCATION none swap sw 0 0
(SWAP_LOCATION is the path to the swap partition)
6. Restart the Pandora.
7. Open a terminal and run swapon -s to see if its working properly.
 
Zero3K said:
Here's how to do it:

1. Get GParted from the Pandora File Archive.
2. Run it.
3. Either resize the partition of the SD card that you want to use as swap space or format it as linux-swap.
4. If you resized the partition, then make a new partition that's formatted as linux-swap.
5. Edit /etc/fstab to include this line of text:
SWAP_LOCATION none swap sw 0 0
(SWAP_LOCATION is the path to the swap partition)
6. Restart the Pandora.
7. Open a terminal and run swapon -s to see if its working properly.


any recommendations for size of swap partition?
 
Last edited by a moderator:
2x RAM is the usually recommended amount. So yeah, 512MB is good.
Incidentally, you didn't need to create a swap partition. You can mount files in exactly the same way, adding it to your fstab. The catch is that you have to ensure the SD card is mounted before the swap partition, so probably have to add the SD card to your fstab as well anyway.
 
Have you noticed any benefit in this? For instance, Chromium and Firefox eat up my RAM, making the rest of the system almost unresponsive. Does this help with that? I know it's swap and I understand what that does, but since it's swap on an SD card, is there really any increased performance? All of my experience with swap partitions have been with hard drives.
 
Excellent. I will implement this on my own system. I have a 1gig card that would work well with this then. Thanks!
 
SWAP_LOCATION none swap sw 0 0

(SWAP_LOCATION is the path to the swap partition)

I m not quite sure what path I must write, can you put an example please ?



7. Open a terminal and run swapon -s to see if its working properly.

If it works, how can I see it ?


Thanks.
 
No. This is what my line in the fstab is:

/media/PANDORA-SD2/pandora.swap none swap sw 0 0

(Replace /media/PANDORA-SD2/pandora.swap with the location to YOUR swap file/partition).
 
Ok ! Thanks !
Now my fstab doesn't want to save : "can't open file to write".

It's a problem of permission ? but don't know how to access.

I'm new to linux, so i tried :

chmod g+w fstab

but it gives : operation not permitted.
 
It works now ! Thanks a lot, i've got to get used to all these commands.

I noticed an improvement on Picodrive 32X games. On Virtua Racing, I had lags, now it runs fine.
 
Ok, now I'd like to make a swapfile instead of a partition.


1) I read on the net I need to type this to make one:

dd if=/dev/zero of=/extraswap bs=1M count=512

but for an SD card, it must be different I think ?


2 ) Also, I need to run a terminal as a root, but it asks me a password. I enter the only password I have, but it fails.

What did I do wrong ?
 
1) Nope, that'll work. Just replace /extraswap with /media/SDCARDNAME/pandora.swap.
2). To run the Terminal, just click the "Start" button and click Terminal. There's no need to run it as root.
 
Back
Top