Disabling swap at boot.

Tom H tomh0665 at gmail.com
Fri Feb 18 08:22:44 UTC 2011


On Fri, Feb 18, 2011 at 1:34 AM, Goh Lip <g.lip at gmx.com> wrote:
> On Fri, 18 Feb 2011 13:33:24 +0800, Tom H <tomh0665 at gmail.com> wrote:
>> On Thu, Feb 17, 2011 at 11:37 PM, Goh Lip <g.lip at gmx.com> wrote:
>>>
>>> I wanted to disable swap at boot, so I added "noswap" (besides nomce) at
>>> the
>>> linux line of the grub entry. However noted swap is still enabled (at my
>>> desktop)......
>>
>> The noswap kernel option is a Debianism:
>>
>> http://www.mjmwired.net/kernel/Documentation/kernel-parameters.txt
>>
>> On Debian, "/etc/init.d/checkroot.fs" checks for "$NOSWAP" after
>> sourcing "/lib/init/vars.sh", which sets "$NOSWAP".
>>
>> On Ubuntu, "/etc/init/mountall.conf" calls mountall, which "reads
>> fstab(5)  and calls fsck(8), mount(8) and swapon(8) in the correct
>> order to mount filesystems once the underlying devices have been
>> created by udevd(8)" (from man page).
>
> Oh, that explains it. Had been trying hard to figure why this doesn't work.
> As usual, Tom, your answers are spot on. Thanks again.

You're welcome.


>> 2. I'm not sure what you're trying to accomplish. What's the thumb
>> drive's install's swap line in fstab?
>
> Had resumed doing a bit of travelling, and like in the past, just taking the
> thumb instead of the labtop. Computers are everywhere.
> # swap was on /dev/sda6 during installation
> UUID=409eef4d-2da2-4a06-91aa-21f4bd388b8c none            swap    sw
>      0       0

You might want to remove these two swap-related lines from your fstab
and add some lines to "/etc/rc.local" to swapon the above if it
exists.

Something along the lines of testing for the existence of
"409eef4d-2da2-4a06-91aa-21f4bd388b8c" with blkid and then "swapon -U
409eef4d-2da2-4a06-91aa-21f4bd388b8c".

Please check the man page because I may be misremembering the correct
syntax, but "blkid --type=swap -o value | grep 409eef4d..." should be
a good test stanza.




More information about the ubuntu-users mailing list