Run dmesg
when you have booted into Linux. In the output you should see
something like this:
Partition check: hda: hda1 hda2 hda3 hda4 < hda5 hda6 hda7 hda8 >
This means that /dev/hda4
is your FreeBSD slice, while
/dev/hda5
, /dev/hda6
, /dev/hda7
and
/dev/hda8
are the FreeBSD partitions. If your swap partition is
the second partition in the slice, it will be /dev/hda6
.
You have to put the following line into your Linux /etc/fstab
file to
enable the swap partition:
/dev/hda6 none swap sw 0 0
While FreeBSD can use any type of partition as swap space, Linux needs a
special signature in the swap partition. This signature is made by mkswap
.
FreeBSD ruins this signature when it uses the shared swap partition, so you
will have to run mkswap
each time you boot into Linux. To do this
automagically you have to find the script that runs swapon
at boot time.
In Red Hat Linux it is /etc/rc.d/rc.sysinit
. Put the following line
into that file just before swapon -a
:
awk -- '/swap/ && ($1 !~ /#/) { system("mkswap "$1"") }' /etc/fstab
This will run mkswap
on any swap partitions in /etc/fstab
every
time you boot except if they are commented out (having ``#'' as the first
character in the line.)
Run free
to check out the size of the swap space when you have rebooted
into Linux. You should also reboot into FreeBSD to make sure everything works
as expected. If it does not, you have probably used the wrong partition
as swap partition. The only solution to that problem is to reinstall FreeBSD
and try again. Experience is a great teacher. :-)