D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] swap on a separate device.

 

On Tue, 23 Aug 2016, Tom wrote:

I've been playing with the RaspberryPi for a while and its a fun thing. It can now boot from a 'mass storage' device and I've wondered about using the original SD (or replacement) as a swap device.

Lots of noise about not using ssd for swap - anyone know of a reliable way of doing this?

You can put swap anywhere you can put a file these days. (No need for a swap partition anymore - you can swap to a file via NFS) The question really might be: Does it make sense?

The Pi, by todays standards has relatively slow IO for things like "disk" operations, so having any swap anywhere is not going to be a terribly good thing - if you are running something on a Pi that needs swap, then really, the Pi might not be the best thing to run it on. It's going to run really really slowly.

If you want to boot off a USB drive and have swap on the internal SD card, to just do it - mount the SD card somewhere, dd /dev/zero into a file 1 or 2 GB big, mkswap it, then swapon it. When/If your Pi starts swapping, the life of the SD card will be the last thing on your mind.

(If you're going to boot off USB and have swap on SD, then personally, I'd boot off SD and mount root on the USB - as has been done for years now)

Gordon

--
The Mailing List for the Devon & Cornwall LUG
https://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq