Swap partition for FreeBSD
Polytropon
freebsd at edvax.de
Sat May 16 11:10:26 UTC 2015
On Sat, 16 May 2015 16:16:13 +0530, Avinash Sonawane wrote:
> I have 4 Primary partitions. Out of which one ada0s1 has FreeBSD,
> ada0s2 has Debian, ada0s3 is one extra Primary partition (which
> currently holds data) and ada0s4 is an extended partition (to create
> further logical partitions like linux-swap, data partitions etc.)
Okay, so you should be able to put the swap into ada0s1.
> >> 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.
>
> I have Freebsd installed in ada0s1a so can I create ada0s1b inside
> ada0s1 to have freebsd-swap? How do I do that?
Using bsdlabel, for example. As shown in the manpage as well
as in the "legacy parts" of the FreeBSD handbook, you'd have
to modify the partition table entry to include a swap space.
This typically involves either re-installing, or the more
common dump + restore process (for ada0s1a, /, holding your
installation).
This is a comparable process:
https://www.freebsd.org/doc/en/books/handbook/install-steps.html
See 3.6.5.
Also read "man bsdlabel". You will use a command like
# bsdlabel -e ada0s1
to make the changes to how the slice will be used.
You have to come from something like this:
# size offset fstype [fsize bsize bps/cpg]
a: 1000000 16 4.2BSD 2048 16384 5128
c: 1000016 0 unused 0 0
to something like this:
# size offset fstype [fsize bsize bps/cpg]
a: 900000 16 4.2BSD 2048 16384 5128
b: 100000 900000 swap
c: 1000016 0 unused 0 0
Numbers are nonsense here. :-)
You need to create a type "swap" partition, and / will be
resized in that process of course. Space will be consumed
from ada0s1, not ada0s6.
I surely don't have to mention that it's considered mandatory
to have a good backup before making changes with such impact.
> Or should I create ada0s6b as swap partition inside ada0s6 slice?
That is probably also possible, but I've never actually used
"extended DOS partitions" in production, so I can't tell you
if FreeBSD will deal with them in the same way as Linux. But
it should be possible.
I don't know if it's possible to "dynamically resize" the /
partition without data loss, that's why I mentioned backups.
--
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
More information about the freebsd-questions
mailing list