Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Mar 2006 16:38:09 +0200
From:      Ruslan Ermilov <ru@FreeBSD.org>
To:        freebsd-stable@FreeBSD.org, Vadim Goncharov <vadim_nuclight@mail.ru>
Subject:   Re: swap at beginning of slice - danger?
Message-ID:  <20060315143809.GF10897@ip.net.ua>
In-Reply-To: <200603151348.k2FDmVht027797@lurza.secnetix.de>
References:  <1591151085.20060315181926@mail.ru> <200603151348.k2FDmVht027797@lurza.secnetix.de>

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

--E7i4zwmWs5DOuDSH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Mar 15, 2006 at 02:48:31PM +0100, Oliver Fromme wrote:
> Vadim Goncharov <vadim_nuclight@mail.ru> wrote:
>  >   I have 5.5-PRERELEASE server in production, booting from ad0s1:
>  >=20
>  >  # BLOCKSIZE=3D512 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
>  >=20
>  > Previously, on a 4.11 system, swapinfo said that swap size was less th=
an
>  > 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 ?
>=20
> 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.
>=20
> In other words:  You're save.  No danger.  No need to worry.
>=20
Also, geom_bsd.c doesn't allow writing to the "label" sector:

: # bsdlabel md0
: # /dev/md0:
: 8 partitions:
: #        size   offset    fstype   [fsize bsize bps/cpg]
:   a:     2048        0    unused        0     0      =20
:   c:     2048        0    unused        0     0         # "raw" part, don=
't edit
: # dd if=3D/dev/zero of=3D/dev/md0a count=3D1 seek=3D1
: dd: /dev/md0a: Operation not permitted
: 1+0 records in
: 0+0 records out
: 0 bytes transferred in 0.000153 secs (0 bytes/sec)


Cheers,
--=20
Ruslan Ermilov
ru@FreeBSD.org
FreeBSD committer

--E7i4zwmWs5DOuDSH
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (FreeBSD)

iD8DBQFEGCbRqRfpzJluFF4RAtOsAJ9xCwA6DAfzf01yjQ3Sqj7972LY7ACeJiiV
7iwfXfauCPmv4XsdZMfMKog=
=9/KT
-----END PGP SIGNATURE-----

--E7i4zwmWs5DOuDSH--



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