Art Alexion on 24 Aug 2009 11:07:02 -0700

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Swap on SD

On Sunday 16 August 2009 15:03:25 wrote:
> In the message dated: Sun, 16 Aug 2009 14:42:58 EDT,
> The pithy ruminations from Casey Bralla on
> <Re: [PLUG] Swap on SD> were:
> => To create a swap:

> => 4. Edit /etc/fstab to point to /dev/SDHC1

This seems to be working quite well on my personal netbook, so I decided to do 
it with those I have setup at work.  For some reason, the first one I tried at 
work won't activate swap on boot using fstab (swapon -a works fine).  I have 
checked and rechecked the syntax in fstab for swap, and it seems identical to 
the the syntax that is working on mine (except for a different UUID, of 

The other reason I am thinking Mark's approach, below, would be more prudent 
is that the work units are loaners, and therefore, removal of the SD card is 
more likely than on my personal unit. (I have take the extra technological 
security measure of covering the slot with black duct tape.)

But I have questions on the script syntax suggested below.

> Given that you're talking about swapping onto a removable device, I'd
> suggest not mounting swap via /etc/fstab. In case the SD card is removed
> before boottime, the machine may be unbootable. However, if you do
> something like this in /etc/rc.local (or the moral equivalent for whatever
> distro you're using), it's a bit more resiliant:
>         check if the /dev/SDHC1 card is available (ie. check files in
> /proc, use lspci, use dmidecode, etc.)
>         if [ /dev/SDHC1 ] ; then
>                 swapon /dev/SDHC1
>         fi

OK, my /etc/rc.local now only contains comments and the line

	exit 0

The card/partition is /dev/sdc1

Do I just add the lines (literal)

	if [ /dev/sdc1 ] ; then
		swapon /dev/sdc1

and leave "exit 0" at the end?

Can I use UUID syntax, something like

	if [ UUID=aeiou334455 ] ; then
		swapon -a

in case a different removable drive grabs sdc1?


Attachment: signature.asc
Description: This is a digitally signed message part.

Philadelphia Linux Users Group         --
Announcements -
General Discussion  --