From owner-freebsd-stable@FreeBSD.ORG Wed Mar 15 14:22:48 2006 Return-Path: X-Original-To: freebsd-stable@freebsd.org Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 85F3916A446 for ; Wed, 15 Mar 2006 14:22:42 +0000 (UTC) (envelope-from dmitry@atlantis.dp.ua) Received: from postman.atlantis.dp.ua (postman.atlantis.dp.ua [193.108.47.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id DBC0D43D45 for ; Wed, 15 Mar 2006 14:22:27 +0000 (GMT) (envelope-from dmitry@atlantis.dp.ua) Received: from smtp.atlantis.dp.ua (smtp.atlantis.dp.ua [193.108.46.231]) by postman.atlantis.dp.ua (8.13.1/8.13.1) with ESMTP id k2FEM7td063462; Wed, 15 Mar 2006 16:22:07 +0200 (EET) (envelope-from dmitry@atlantis.dp.ua) Date: Wed, 15 Mar 2006 16:22:07 +0200 (EET) From: Dmitry Pryanishnikov To: freebsd-stable@freebsd.org, Vadim Goncharov In-Reply-To: <200603151348.k2FDmVht027797@lurza.secnetix.de> Message-ID: <20060315161248.L47405@atlantis.atlantis.dp.ua> References: <200603151348.k2FDmVht027797@lurza.secnetix.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Subject: Re: swap at beginning of slice - danger? X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Mar 2006 14:22:48 -0000 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