swap off on boot

Kevin J. Cummings cummings at kjchome.homeip.net
Wed Jun 27 14:07:55 UTC 2007


Mogens Kjaer wrote:
> ron wrote:
>> Fedora 7 is booting up with it's swap off. I have to '# /sbin/swapon
>> /dev/sdb3' every time I boot in .
>>
>> On boot, I see an error message:
>>
>> Unable to resume swap device sdb3. no resume ...
> 
> This is not an error message.
> 
>> Here is Fedora 7s' fstab:
> ...
>> LABEL=SWAP-sdb3    swap                    swap   
>> defaults                  0 0
> 
> Most likely /dev/sdb3 doesn't have a label.

In order to find that out, use the vol_id command:

/lib/udev/vol_id /dev/sdb3

[Note, this is where this command resides on my FC6 system.  On my FC5
system, its in /sbin/vol_id.  YMMV.   locate is your friend.]

vol_id will print out some information about the partition, including
its label, if it has one.

swapping is turned on in a small section of /etc/rc.sysinit
Look for the section that starts with:

# Start up swapping.

It is (essentially) enabled via a "swapon -a -e" command.
If you read the man page for swapon, you will see that "-a" causes all
swap partitions listed in /etc/fstab that do not contain the "noauto"
option to be started.  Any that are already started will be silently
skipped.  The "-e" causes any that don't exist to be silently skipped.
Therefore, if your /dev/sdb3 partition isn't labeled properly (more
correctly, if your system doesn't have a disk partition with the label
"SWAP-sdb3", no error will be output.  I guess this allows you to have
swap partitions on media which may not always be present when you boot
your system.

> If you can live without swap a few seconds,
> you could try:
> 
> # swapoff /dev/sdb3
> # mkswap -L SWAP-sdb3 /dev/sdb3
> # swapon -a

If your swap partition is not yet labeled correctly, this indeed will
label it for you.  Note, bad things may happen if you cannot write all
of your in-use swap partition back into memory in order to turn it off
(some processes may start failing or disappearing as the system tries to
avoid crashing).  If that is the case, create a swap file (use "dd" and
initialize it with all 0's, run mkswap on it), and turn it on with
swapon *before* you turn off your current swap partition.  In that way,
the swap space has a place to go and your system will continue to run.
You can then turn off the swap file an delete it if you so choose to
after you have finished labeling an re-enabling your swap partition.

> Mogens

-- 
Kevin J. Cummings
kjchome at rcn.com
cummings at kjchome.homeip.net
cummings at kjc386.framingham.ma.us
Registered Linux User #1232 (http://counter.li.org)




More information about the fedora-list mailing list