Re: gpart, slice starts at 0

From: Erich Dollansky <erichsfreebsdlist_at_alogt.com>
Date: Sun, 17 Feb 2013 08:04:12 +0700
Hi,

On Sat, 16 Feb 2013 08:44:50 -0700 (MST)
Warren Block <wblock_at_wonkity.com> wrote:

> On Sat, 16 Feb 2013, Erich Dollansky wrote:
> 
> > I did this to get a disk partitioned:
> >
> > #!/bin/tcsh
> 
> Gah!
> 
it is a generated script.

> > 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.

> > 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.

> 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.
> 
This is what I struggeled with all the time.

> Destroy the FreeBSD disklabel stuff in the slices first:
>    gpart destroy -F da0s1

And this was the solution. Thanks!
> 
> 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.

I am bit tired of having to read handbooks/manuals whenever I get a new
device. Out of this, I am currently writing a small program which
allows me easy 'formatting' of the device. MBR is just one option the
program has. I will publish it when it is really working as I want it
to. It will take some time as I do this on the side only.
> 
> 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.

Erich
> _______________________________________________
> freebsd-current_at_freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to
> "freebsd-current-unsubscribe_at_freebsd.org"
Received on Sun Feb 17 2013 - 00:04:24 UTC

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