Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Mar 2006 16:22:07 +0200 (EET)
From:      Dmitry Pryanishnikov <dmitry@atlantis.dp.ua>
To:        freebsd-stable@freebsd.org, Vadim Goncharov <vadim_nuclight@mail.ru>
Subject:   Re: swap at beginning of slice - danger?
Message-ID:  <20060315161248.L47405@atlantis.atlantis.dp.ua>
In-Reply-To: <200603151348.k2FDmVht027797@lurza.secnetix.de>
References:  <200603151348.k2FDmVht027797@lurza.secnetix.de>

next in thread | previous in thread | raw e-mail | index | archive | help

Hello!

On Wed, 15 Mar 2006, Oliver Fromme wrote:
> >  # 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.

  You're right about RELENG_5 (and CURRENT). I've found this code (though not 
from the first attempt ;) in /sys/vm/swap_pager.c, at start of 
swaponsomething():

         /*
          * Do not free the first two block in order to avoid overwriting
          * any bsd label at the front of the partition
          */
         blist_free(sp->sw_blist, 2, nblks - 2);

However I don't see any equivalent code in RELENG_4. Neither can I find where 
it's documented, and thus any guarantees that it won't disappear tomorrow ;(

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

  In this particular case - yes.


Sincerely, Dmitry
-- 
Atlantis ISP, System Administrator
e-mail:  dmitry@atlantis.dp.ua
nic-hdl: LYNX-RIPE



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060315161248.L47405>