swap at beginning of slice - danger?

Oliver Fromme olli at lurza.secnetix.de
Wed Mar 15 13:48:39 UTC 2006

Vadim Goncharov <vadim_nuclight at mail.ru> wrote:
 >   I have 5.5-PRERELEASE server in production, booting from ad0s1:
 >  # BLOCKSIZE=512 swapinfo
 >  Device          512-blocks     Used    Avail Capacity
 >  /dev/ad0s1b        2097152    52872  2044280     3%
 >  /dev/ad1s1b        2097152    51952  2045200     2%
 >  Total              4194304   104824  4089480     2%
 >  # bsdlabel ad0s1 | fgrep b:
 >    b:  2097152        0      swap
 > Previously, on a 4.11 system, swapinfo said that swap size was less than
 > size of b: partition on a slice - it was ok, as boot sectors are
 > located at beginning of slice. But now, sizes match exactly. What
 > changed and is it dangerous nowadays to have swap partition at offset 0 ?

The code in sys/swap_pager.c does not touch the first two
blocks, where blocks are measured in PAGE_SIZE units.
The smallest page size supported on FreeBSD architectures
is 4 KB (on i386), so that's at least 2 * 4k, which is 16
sectors on the disk.  That's enough to skip MBR, disklabel
and boot blocks.

In other words:  You're save.  No danger.  No need to worry.

Best regards

Oliver Fromme,  secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing
Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

 > Can the denizens of this group enlighten me about what the
 > advantages of Python are, versus Perl ?
"python" is more likely to pass unharmed through your spelling
checker than "perl".
        -- An unknown poster and Fredrik Lundh

More information about the freebsd-stable mailing list