From owner-freebsd-current@FreeBSD.ORG Sat Feb 16 15:44:54 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 572AD3C5 for ; Sat, 16 Feb 2013 15:44:54 +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 1B1B0F7B for ; Sat, 16 Feb 2013 15:44:53 +0000 (UTC) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.14.6/8.14.6) with ESMTP id r1GFioMI087398; Sat, 16 Feb 2013 08:44:50 -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 r1GFio3k087395; Sat, 16 Feb 2013 08:44:50 -0700 (MST) (envelope-from wblock@wonkity.com) Date: Sat, 16 Feb 2013 08:44:50 -0700 (MST) From: Warren Block To: Erich Dollansky Subject: Re: gpart, slice starts at 0 In-Reply-To: <20130216145122.3db70652@X220.ovitrap.com> Message-ID: References: <20130216145122.3db70652@X220.ovitrap.com> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (wonkity.com [127.0.0.1]); Sat, 16 Feb 2013 08:44:50 -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: Sat, 16 Feb 2013 15:44:54 -0000 On Sat, 16 Feb 2013, Erich Dollansky wrote: > I did this to get a disk partitioned: > > #!/bin/tcsh Gah! > 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 > 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. MBR/bsdlabel puts FreeBSD partitions inside MBR slices. So da0 has been erased, but the bsdlabel blocks for da0s1 are still present. If you recreate da0, da0s1 will magically reappear. Destroy the FreeBSD disklabel stuff in the slices first: gpart destroy -F da0s1 Or instead, use GPT partitioning to avoid dealing with the problem of one type of partitions inside a different type of partitions. GPT makes disk partitioning a lot easier. 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*.