swap at beginning of slice - danger?
Ruslan Ermilov
ru at FreeBSD.org
Wed Mar 15 14:38:32 UTC 2006
On Wed, Mar 15, 2006 at 02:48:31PM +0100, Oliver Fromme wrote:
> 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.
>
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
: c: 2048 0 unused 0 0 # "raw" part, don't edit
: # dd if=/dev/zero of=/dev/md0a count=1 seek=1
: 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,
--
Ruslan Ermilov
ru at FreeBSD.org
FreeBSD committer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20060315/02bef3ab/attachment.pgp
More information about the freebsd-stable
mailing list