Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 07 Jul 2009 19:49:49 -0500
From:      Barry Pederson <bp@barryp.org>
To:        Dan Naumov <dan.naumov@gmail.com>
Cc:        freebsd-stable@freebsd.org, freebsd-geom@freebsd.org
Subject:   Re: glabel metadata protection (WAS: ZFS: drive replacement performance)
Message-ID:  <4A53ED2D.4070309@barryp.org>
In-Reply-To: <cf9b1ee00907071620i7a571be4w73aec90e97b3712a@mail.gmail.com>
References:  <cf9b1ee00907071620i7a571be4w73aec90e97b3712a@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Dan Naumov wrote:
>>> If I use glabel to label a
>>> disk and then create a pool using /dev/label/disklabel, won't ZFS
>>> eventually overwrite the glabel metadata in the last sector since the
>>> disk in it's entirety is given to the pool? 

I would say in this case you're *not* giving the entire disk to the 
pool, you're giving ZFS a geom that's one sector smaller than the disk. 
  ZFS never sees or can touch the glabel metadata.


> So what happens if I was to do the following (for the same of example):
> 
> gpart create -s GPT /dev/ad1
> glabel label -v disk01 /dev/ad1
> gpart add -b 1 -s <ENTIREDISK> -t freebsd-zfs /dev/ad1
> 
> Does "gpart add" automatically somehow recognize that the last sector
> of <ENTIREDISK> contains the glabel and automatically re-adjusts this
> command to make the freebsd-zfs partition take "entiredisk minus last
> sector" ? I can understand the logic of metadata being protected if I
> do a: "gpart add -b 1 -s <ENTIREDISK> -t freebsd-zfs
> /dev/label/disk01" since gpart will have to go through the actual
> label first, but what actually happens if I issue a gpart directly to
> the /dev/device?

I'd guess bad stuff would happen here, with a conflict between what gpt 
and glabel would want to do with the end of the disk.

If you wanted to use glabel with a GPT partition, I'd think you'd want to

   gpart create -s GPT /dev/ad1
   (use "gpart show" to see what space is now available for GPT
    partitions, it won't start at 1 and won't go to the very end of the
    disk)
   gpart add -b 34 -s <REMAININGDISK> -t freebsd-zfs /dev/ad1
   glabel label -v disk01 /dev/ad1p1

   (and then use label/disk01 in a zpool)

	Barry



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4A53ED2D.4070309>