swap at beginning of slice - danger?

Dmitry Pryanishnikov dmitry at atlantis.dp.ua
Wed Mar 15 12:53:20 UTC 2006


Hello!

On Wed, 15 Mar 2006, Vadim Goncharov 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 ?

   It seems to me as a dangerous setup indeed - swap could easily overwrite
disklabel (which is in sector 1 of the slice for every arch except Alpha). FFS
doesn't touch first several sectors, so it would be safe to start FFS 
partition from the offset 0, but AFAIK swap engine makes no such guaranties. I 
don't know about current situation in RELENG_5, but in CURRENT bsdlabel by 
default reserves first 16 sectors for the disklabel, so offset of the first
partition will be 16 regardless of the partition type. But stupid sysinstall 
still insists on putting first partition at offset 0, and it's a shame. For
production server I would deactivate swap on this disk and recreate 
b-partition in order to start at offset 16, not 0.

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


More information about the freebsd-stable mailing list