How to set up your XO to swap to an SD card

Andres Cabrera mantaraya36 at gmail.com
Mon Aug 11 08:49:50 EDT 2008


Hi John,

Thanks for the info. Are there noticeable performance gains/losses when
using an external SD swap partition?
Won't adding a line to /etc/fstab make the swap partition be used on startup
automatically?

Cheers,
Andrés

On Sun, Aug 10, 2008 at 4:21 AM, John Gilmore <gnu at toad.com> wrote:

> > > Have you tried with a swap partition? Swap is robust now on a
> > > SD card, immune to suspend/resume and power cycle.
> >
> > External swap area sounds cool.  How does one set it up?  I'll give it a
> > whirl.
>
> Use a recent joyride.  Get a throwaway 1GB SD card.  Available for
> $3-$20 depending where you go.  I say throwaway because swapping to it
> will tend to burn it up faster than its "usual" lifetime for photos
> and such.  You will still be able to use half a gig on the card for
> file storage; the other half will be for swap space.  Plug it into the
> SD card slot on the XO.  You'll have to keep it plugged in the whole
> time while you're swapping to it; you can't remove it the way you
> remove a USB stick or a non-swap SD card.  If/when it starts to fail
> after a few years, you can copy any still-interesting user files off
> it, throw it away, and put in a new $1 1GB SD card (or something
> larger).
>
> Go to a terminal (either the activity, or Ctrl-Alt-F1).  Become root.
> Type "mount", make sure the SD card is mounted at /dev/mmcblk0p1,
> in a "vfat" filesystem.
>
> Go into the Journal, find the SD card hiding behind the Frame at the
> bottom, hover over it, pick Unmount.  Go back to the terminal.
>
> Type "mount", make sure /dev/mmcblk0p1 is not mounted any more.  Type
> "yum install parted" since the partition editor is not in the distro
> any more.  Run "/sbin/parted /dev/mmcblk0".  Type "print" to see the
> current configuration.  On mine it looked like this:
>
> Number  Start  End    Size    Type     File system  Flags
>  1      127kB  1018MB 1018MB  primary  fat16
>
> Type "resize 1 0 512" to shrink this filesystem down to 512MB.  If it
> asks you whether to use FAT32, just say no.  Then type "mkpartfs
> primary linux-swap 512 1018".  That'll make a second partition for
> swapping to, and format it as a Linux swap partition.  Type "print"
> and it should look roughly like this:
>
> Number  Start  End     Size   Type     File system  Flags
>  1      32.3kB 512MB   512MB  primary  fat16
>  2      512MB  1018MB  506MB  primary  linux-swap
>
> Type "quit".  Now you're back to the shell.  Type "/sbin/swapon
> /dev/mmcblk0p2".  You're done.
>
> The Hal daemon is smart enough to mount filesystems when it sees an SD
> card appear, but it's not smart enough to start using freshly
> available swap space.  For the moment, you'll have to do "/sbin/swapon
> /dev/mmcblk0p2" each time after you reboot the XO.  Similarly, it
> won't do the "/sbin/swapoff" if you want to eject it.  I'm sure
> somebody will eventually come up with a Hal script or something to
> automate that part.
>
> You can see how much swap space you have / are using by running "top"
> in a terminal window; it's about the fourth line down.
>
>        John
> _______________________________________________
> Devel mailing list
> Devel at lists.laptop.org
> http://lists.laptop.org/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.laptop.org/pipermail/devel/attachments/20080811/99b5df78/attachment.html>


More information about the Devel mailing list