Swap partition for FreeBSD

Matthew Seaman matthew at FreeBSD.org
Sat May 16 09:14:17 UTC 2015


On 16/05/2015 08:41, Avinash Sonawane wrote:
> I was trying to build www/webkit-gtk3 (a dependency for x11/gnome3)
> then it abruptly exited with "Out of swap space error" so I created a
> separate 8GB partition to be used as freebsd-swap.
> 
> Here is `gpart show`, `gpart show -p`, `swapinfo` and `/etc/fstab`
> http://pastebin.com/KSFM49yP
> 
> Now my problem is that I see a message "May 16 12:31:59 titanic
> kernel: GEOM_PART: Partition 'ada0s6' not suitable for kernel dumps
> (wrong type?)" during bootup.
> 
> And I think that's because though the system is using ada0s6 as swap
> partition (evident from the above pastebin) the partition has a wrong
> type. More specifically it is linux-data instead of freebsd-swap (See
> `gpart show` in above paste)
> 
> So how do I change the type of ada0s6 to freebsd-swap?
> 
> I tried `bsdlabel -e ada0s6` but then it said "bsdlabel: /dev/ada0s6:
> no valid label found"
> 
> Then I tried `gpart modify -i 2878773 -t freebsd-swap ada0s4` then it
> said "gpart: pre-check failed: Operation canceled" (Here 2878773 is
> the index number of ada0s6. See `gpart show` in above pastebin)
> 
> I tried these 2 approaches after `swapoff /dev/ada0s6` too but they
> throw same error messages as above.
> 
> So how do I get rid of the above mentioned error message appearing
> during boot or how do I format ada0s6 to freebsd-swap from linux-data?

You're correct to use gpart(8) to create your new swap partition.  Don't
use bsdlabel(8) -- that is for dealing with the really old style of disk
partitioning and is incompatible with the gpt disk labels you have.

Now, in order to fix your problem: you can't change the type of a
partition.  Instead, you need to delete the partition and then create a
new 'freebsd-swap' partition using the same chunk of disk space.  Try
and quiesce the system as much as possible before you do this -- it
might be worth booting from a LiveCD.  Also the index numbers look
pretty strange to me.  Possibly the OS that created those partitions has
different ideas on the layout of a gpt partition table, and it might be
necessary to boot back into that OS in order to remove the partition
cleanly.

There's no formatting required for a swap area: the system just uses it
as a blob of available space and writes what it needs to.

	Cheers,

	Matthew

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 971 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20150516/75dec1fb/attachment.sig>


More information about the freebsd-questions mailing list