From owner-freebsd-geom@FreeBSD.ORG Sun Oct 23 17:42:23 2005 Return-Path: X-Original-To: geom@freebsd.org Delivered-To: freebsd-geom@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 94FD916A41F for ; Sun, 23 Oct 2005 17:42:23 +0000 (GMT) (envelope-from cpressey@catseye.mine.nu) Received: from priv-edmwes25.telusplanet.net (defout.telus.net [204.209.205.55]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2896643D49 for ; Sun, 23 Oct 2005 17:42:22 +0000 (GMT) (envelope-from cpressey@catseye.mine.nu) Received: from catseye.biscuit.boo ([154.20.76.195]) by priv-edmwes25.telusplanet.net (InterMail vM.6.01.04.04 201-2131-118-104-20050224) with SMTP id <20051023174222.BWDW28339.priv-edmwes25.telusplanet.net@catseye.biscuit.boo> for ; Sun, 23 Oct 2005 11:42:22 -0600 Date: Sun, 23 Oct 2005 10:49:00 -0700 From: Chris Pressey To: geom@freebsd.org Message-Id: <20051023104900.46836c55.cpressey@catseye.mine.nu> Organization: Cat's Eye Technologies X-Mailer: Sylpheed version 1.0.5 (GTK+ 1.2.10; i386-portbld-freebsd4.11) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Subject: fdisk(8) can't alter in-core geometry on unintialized disk anymore? X-BeenThere: freebsd-geom@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: GEOM-specific discussions and implementations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Oct 2005 17:42:23 -0000 Hello, Unless I'm mistaken, it's no longer possible for fdisk(8) to change "our idea of what the BIOS thinks" for an uninitialized disk, under recent FreeBSD-CURRENT (as of 7 days ago - and probably for the last few months, by the look of the CVS logs.) The reasons for this seem to be twofold, and they seem to both be related to GEOM. On the "get the current geometry" side: - fdisk now asks GEOM when it wants to find out the geometry of a disk. - An uninitialized disk has no MBR, so no geom_mbr is created for it. - GEOM reports the geometry of a disk without a geom_mbr provider by passing the request through to the ATA layer(?) - The ATA layer reports only the geometry detected at boot(?) And on the "set a new geometry" side: - fdisk now asks GEOM when it wants to change the MBR and the geometry of a disk. - Because the uninitialized disk has no geom_mbr, this fails. - fdisk falls back to writing an updated MBR to the right place on the raw disk device, with a call to pwrite(2). - This, however, does not affect the in-core geometry. This can be evidenced by: - running fdisk -u adX - changing the geometry - telling fdisk to write out changes - running fdisk adX and observing that the geometry did not change. As for a possible solution: this is largely a shot in the dark since I don't know anything about GEOM, but it seems to me that it would be most appropriate for fdisk to trigger the creation of a geom_mbr provider on the disk when it doesn't have one yet. Since the geom_mbr presumably requires a valid MBR, this would have to happen after the raw pwrite() of the MBR to the disk. And after that, the GEOM verb to alter the MBR would have to be repeated, so that the in-core geometry gets updated. Does this analysis seem reasonable? At any rate, if someone could confirm that this really is a regression, and not just something that is happening on my system and/or some intentional new behaviour(?), that would be great. Thanks in advance, -Chris