From owner-freebsd-current@FreeBSD.ORG Sun Feb 17 16:11:57 2013 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D0D5F492 for ; Sun, 17 Feb 2013 16:11:57 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (wonkity.com [67.158.26.137]) by mx1.freebsd.org (Postfix) with ESMTP id 6D488DA8 for ; Sun, 17 Feb 2013 16:11:57 +0000 (UTC) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.14.6/8.14.6) with ESMTP id r1HGBmQT095086; Sun, 17 Feb 2013 09:11:48 -0700 (MST) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.14.6/8.14.6/Submit) with ESMTP id r1HGBmmU095083; Sun, 17 Feb 2013 09:11:48 -0700 (MST) (envelope-from wblock@wonkity.com) Date: Sun, 17 Feb 2013 09:11:48 -0700 (MST) From: Warren Block To: Erich Dollansky Subject: Re: gpart, slice starts at 0 In-Reply-To: <20130217080412.205899fd@X220.ovitrap.com> Message-ID: References: <20130216145122.3db70652@X220.ovitrap.com> <20130217080412.205899fd@X220.ovitrap.com> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (wonkity.com [127.0.0.1]); Sun, 17 Feb 2013 09:11:49 -0700 (MST) Cc: current@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Feb 2013 16:11:57 -0000 On Sun, 17 Feb 2013, Erich Dollansky wrote: >>> gpart destroy -F da0 >>> diskinfo da0 >>> dd if=/dev/zero of=/dev/da0 bs=512 count=34 >>> dd if=/dev/zero of=/dev/da0 bs=512 count=34 seek=312581774 >> >> Someone here on the lists (I unfortunately forget who) showed a >> sneaky easier way to do this: >> >> gpart destroy -F da0 >> gpart create -s gpt da0 >> gpart destroy -F da0 >> > This did not make a difference. It's an easier way to destroy the backup table at the end of the disk, whether one was there before or not, without having to calculate the location. >>> gpart show -p da0 >>> gpart create -s MBR da0 >>> gpart add -t freebsd da0 >>> gpart show -p da0 >>> gpart show -p da0s1 >>> gpart set -a active -i 1 da0 >>> # >>> # The following line always gives an error: >>> # >>> # gpart create -s BSD da0s1 >> >> 'destroy' is not recursive. It destroys the geom found on the device >> given, but does not write to any geoms inside those geoms. >> > This is obvious. What surprises me is that create does not write a new > and empty description to the disk. It does, but not being recursive, it does not destroy the geoms inside the one given to the command (da0). You had: da0 (MBR) da0s1 (bsdlabel) After the destroy, it became da0 (null) da0s1 (bsdlabel) This can happen with any of the setups where there are geoms inside other geoms. >> The second part of your question, about da0 starting a block zero: >> >>> [X220]...Appl/Some Tools (root) > gpart show da0 >>> => 63 312581745 da0 MBR (149G) >>> 63 312581745 1 freebsd [active] (149G) >>> >>> [X220]...Appl/Some Tools (root) > gpart show da0s1 >>> => 0 312581745 da0s1 BSD (149G) >>> 0 312581745 - free - (149G) >> >> That shows slice one starts at block 63, standard for MBR. The space >> inside the slice (da0s1) starts at block 0 *of the slice*. > > This is a bit confusing for me but it does not really matter as long as > the programs get it straight. This is again because of the geom inside a geom setup. The actual start block is the start of the slice (block 63) plus the start of the FreeBSD partition inside the slice (currently 0). When you create FreeBSD partitions inside da0s1, they will have nonzero offsets from the start of the slice. There are examples shown here: http://forums.freebsd.org/showpost.php?p=206204&postcount=11