Re: gpart, slice starts at 0

From: Warren Block <wblock_at_wonkity.com>
Date: Sat, 16 Feb 2013 08:44:50 -0700 (MST)
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*.
Received on Sat Feb 16 2013 - 14:44:54 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:34 UTC