Swap partition for FreeBSD

Polytropon freebsd at edvax.de
Sat May 16 10:33:14 UTC 2015


On Sat, 16 May 2015 15:16:56 +0530, Avinash Sonawane wrote:
> On Sat, May 16, 2015 at 2:43 PM, Matthew Seaman <matthew at freebsd.org> wrote:
> 
> > partitioning and is incompatible with the gpt disk labels you have.
> 
> No. I don't have GPT disk labels. I have MBR partitioning scheme.

In that case, your partitioning scheme looks a little bit
strange in retrospect. You said that you're using ada0s6
for swap. In MBR terminology, s6 is a "logical drive inside
a DOS extended partition". Why do you construct something
that complicated?

Typically, you use _one_ "DOS primary partition" - in BSD
called a slice - to carry the FreeBSD filesystems _and_ the
swap partition, for example:

	ada0s1a = /
	ada0s1b = swap	<- not a separate slice!
	ada0s1d = /tmp
	ada0s1e = /var
	ada0s1f = /usr
	ada0s1g = /home

With gpart or (the old-fashioned) fdisk, you would create
the slice, then use bsdlabel to create the partitions inside
that slice. Those that are _not_ swap partitions would then
be formatted with a UFS file system; swap doesn't need to be
formatted.

Now, when you're using MBR, and ada0s6 should be your swap
device, where's the rest of your system?

You could probably use fdisk to access ada0s6 and create the
swap partition ada0s6b. See "man fdisk" for examples. But
keep mind that using fdisk and bsdlabel, as well as using MBR
instead of GPT, is nowadays considered "not good anymore",
even though it should still work, even when "extended partitions"
(see above) are involved...



> After searching a bit on the web I came to know that default kernel
> build options specify "options GEOM_PART_EBR_COMPAT" which prevents
> GEOM from editing EBR partition schemes. So to create a partition of
> type freebsd-swap in extended partition it looks like I need to
> recompile the kernel without the GEOM_PART_EBR_COMPAT kernel option.

It seems to be that way. Using "extended DOS partitions" has never
been a good idea. :-)

However, as I initially wrote, this isn't _needed_ when you put
the swap partition into the slice where the rest of your FreeBSD
installation resides. You can have up to 4 "DOS primary partitions"
(slices), and each one could carry an independent OS install.



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list