In article <1992Aug31.024052.12351@cc.umontreal.ca> duperval@ERE.UMontreal.CA (Duperval Laurent) writes:
The "bad swapfile" problem is most usually due to (wait for it) a bad
swapfile. Hmm. Maybe I should use cryptic numbers and give something
like "ERR192SWP" instead - but that would also mean I'd have to write
some documentation on the thing. Not good.
Anyway, to make a swapfile, it's not enough to just run "mkswap" -
mkswap just writes the swap signature and some bad-page info. You
actually have to create the swapfile with the correct size and without
holes first. How you create the swapfile is totally up to you, but the
normal thing to do is:
# dd if=/dev/zero of=swapfile bs=1024 count=XXXX
where XXXX is the size of the file in kilobytes. You now have an empty
file which is exactly XXXX blocks long. To mark it swappable, you then
run mkswap on it and sync:
# mkswap swapfile XXXX
# sync
You now have a swapfile that is ready to be used: swapping is then
enabled with
# swapon swapfile
It's normal to put the 'swapon' command in your /etc/rc.local or
whatever - but you can do it by hand at each reboot if you want to.
Note that if you use a swap-paritition, you obviosuly don't have to
create it first with "dd" or whetever: just make sure you have a good
partition free, and run "mkswap" on it. With swap partitions, it's
generally a good idea to map out bad spots (or you'll get all sorts of
nasty errors), so use the "-c" switch for this:
# mkswap -c /dev/hdXX XXXX
# sync
and
# swapon /dev/hdXX
Swapping from a partition is a lot faster than swapping from a file, but
creating a file is easier, and it's easier to remove or resize.
the "disagree about inline" message is arguably a gcc bug: it's an
uncommonly stupid warning, and I don't know why gcc prints it. It's
probably easy to get rid of by just putting a "inline" before the
prototype in include/linux/tty.h, but I'm too lazy to even test it out.
The way gcc inline (nonstatic, nonexternal) functions work, it's totally
illogical to ask it to be prototyped that way. I don't mind too much:
as long as my only gripes with gcc are of this type, I'm happy.
Linus
Previous message: [thread] [date] [author] Next message: [thread] [date] [author]
Messages in current thread:
Re: .97 kernel and root disk/probs with swapping, Linus Benedict Torvalds, (Mon Aug 31, 3:47 pm)