dmac257
Posts: 3
Joined: Mon Jan 13, 2014 4:09 pm

location of swap file

Mon Jan 13, 2014 4:39 pm

I am very new to Linux and have ordered but not received my Pi. I have been doing a lot of reading and one of the things that I am foggy about is this swap file and where it should be. On one hand it would seem that having a 1gig swap file on the SD card would be handy, however one admittedly much more savvy hardware hacker stated:

"If I simply just installed a larger SD card and added a large swap file, or swap partition, I would eventually burn out the SD card. SD cards have a very limited number of read/writes and SD cards are slow."

While I will initially keep the swap file on the SD card, what I want to know is HOW LIKELY is the SD card going to fail due to excessive read/writes? Eventually I will add a powered hub and re-purpose a 125gig HD for my Pi and would it be better to move the swap file to the HD or keep it on the SD card??

dmac257

User avatar
RaTTuS
Posts: 10406
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: location of swap file

Mon Jan 13, 2014 5:05 pm

swappiness is set very low on the RPI [so it will only swap if it needs to]
so having a bigger swap file / partition will nothelp
if you do get into a swap situation [which is possible] then having the swap on a hard disk [and the root fs] is much better
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

Nr90
Posts: 216
Joined: Sat Nov 26, 2011 12:39 pm

Re: location of swap file

Mon Jan 13, 2014 5:20 pm

To add to what RaTTuS, the low swappiness reduces wear on the SD card greatly.
You could move the swap file to a HDD, however swap is so much slower then regular RAM that you'll probably still want to avoid it.
Unless you're compiling, I don't think swap is very useful. The performance in the GUI will degrade too much.

Return to “Beginners”