User avatar
Jongoleur
Posts: 1179
Joined: Thu Aug 11, 2011 12:47 pm
Location: O'erlooking the sea, and all those effin windfarms...

Re: Linux swap partition

Thu Mar 22, 2012 9:21 pm

Well, just check which species of microdrive you're buying.....

The ZX Microdrive

The CF Microdrive

or even the

Mechanical Microdrive

I'm just a bouncer, splatterers do it with more force.....

User avatar
Jongoleur
Posts: 1179
Joined: Thu Aug 11, 2011 12:47 pm
Location: O'erlooking the sea, and all those effin windfarms...

Re: Linux swap partition

Thu Mar 22, 2012 9:22 pm

@SN:

Oi!

I'm just a bouncer, splatterers do it with more force.....

jackland
Posts: 1
Joined: Fri Apr 20, 2012 8:18 am

Re: Linux swap partition

Fri Apr 20, 2012 9:46 am

Linux pre-allocates memory when a process starts. In most cases this allocation is larger than the amount of memory the process will need (resident memory).

If the memory allocation exceeds the available memory then something called the out of memory killer is invoked which starts to terminate processes (or new processes may not start). Having a swap area means that Linux thinks it's got more free memory even if it doesn't actually use the swap space.

The likelihood of the swap being used is controlled by a kernel setting called "vm.swappiness". A larger number makes swapping more likely. For a system with a hard-disk vm.swappiness will usually be something like 40 to 60. The Debian squeeze image for pi seems to have vm.swappiness set to a default value of 1 so it's very unlikely to use the swap. However, enabling it means you are less likely to hit out-of-memory problems.

I haven't got a pi yet so I've only gleaned the above by running the image under QEMU.

Bob

yell
Posts: 19
Joined: Sat Mar 10, 2012 10:56 pm

Re: Linux swap partition

Fri Apr 20, 2012 7:38 pm

Btw ppl dont forget the other usage for swap!

Be sure to get something like RAM * 1.2 for awaysome Suspend-to-Disk.

lesliew
Posts: 29
Joined: Sun Jan 22, 2012 5:14 pm
Location: Melbourne, Florida

Re: Linux swap partition

Fri Apr 20, 2012 10:16 pm

Guys

What are your partitioning recommendations for an SSD. Assuming a 60G SSD. I'm currently thinking along the lines of.

sda1: 4GB - FAT32

sda2: 20GB - /home

sda3: 30GB - /data

sda4: 4GB - Linux Swap

Maybe overkill but only paid $48 for a 60GB SATA III drive after rebates.

Is the Pi going to benefit from that much swap space

rmm200
Posts: 259
Joined: Sat Mar 03, 2012 10:25 pm

Re: Linux swap partition

Fri Apr 20, 2012 10:26 pm

I think for most of the target users, swap will never be used. Certainly not more than 256 meg. Will be interesting to see some real numbers.

User avatar
[email protected]
Posts: 2020
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
Contact: Website

Re: Linux swap partition

Sat Apr 21, 2012 7:11 am

lesliew said:


Guys

What are your partitioning recommendations for an SSD. Assuming a 60G SSD. I'm currently thinking along the lines of.

sda1: 4GB - FAT32

sda2: 20GB - /home

sda3: 30GB - /data

sda4: 4GB - Linux Swap

Maybe overkill but only paid $48 for a 60GB SATA III drive after rebates.

Is the Pi going to benefit from that much swap space



Yes... And No.

If you are running so much on the Pi that it needs to swap and you give it swap, then it will swap. And become frustratingly slow in the process.

Really, if you're running such big applications that you need swap, then the Pi is not the right device.

A little bit of swap can make some difference though as Linux will (eventually) swap out programs that are not in-use, freeing up memory for disk/file buffers and so on.

As for the partitioning - You're wasting 4GB on the FAT32 partition, and although it pains me to say this (because I've been a firm believer in using partitions on hard drives for the past 30 years), your probably better off with less partitions for this sort of application - even to the extent of just having 2 - one for the FAT23 boot partition and one for everything else - then you can make swap a file rather than a partition which is slightly more flexible.

If experimenting with distros then possibly multiple partitions, one for /home and one for each distro, so the /home is shared with all your own data.

Gordon
--
Gordons projects: https://projects.drogon.net/

Return to “General discussion”