Using GTP and glabel for ZFS arrays
Daniel O'Connor
doconnor at gsoft.com.au
Thu Jul 22 10:20:29 UTC 2010
On 22/07/2010, at 12:35, Dan Langille wrote:
> Why use glabel?
>
> * So ZFS can find and use the correct HDD should the HDD device ever
> get renumbered for whatever reason. e.g. /dev/da0 becomes /dev/da6
> when you move it to another controller.
>
> Why use partitions?
>
> * Primarily: two HDD of a given size, say 2TB, do not always provide
> the same amount of available space. If you use a slightly smaller
> partition instead of the entire physical HDD, you're much more
> likely to have a happier experience when it comes time to replace an
> HDD.
>
> * There seems to be a consensus amongst some that leaving the start and
> and of your HDD empty. Give the rest to ZFS.
I would combine both!
GPT generates a UUID for each partition and glabel presents this so ZFS can use it, eg I have..
[cain 19:45] ~ >sudo zpool status
pool: tank
state: ONLINE
scrub: none requested
config:
NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
raidz2 ONLINE 0 0 0
gptid/d7467802-418f-11df-bcfc-001517e077fb ONLINE 0 0 0
gptid/d7eeeced-418f-11df-bcfc-001517e077fb ONLINE 0 0 0
gptid/d8761aa0-418f-11df-bcfc-001517e077fb ONLINE 0 0 0
gptid/d9083d18-418f-11df-bcfc-001517e077fb ONLINE 0 0 0
gptid/d97203ec-418f-11df-bcfc-001517e077fb ONLINE 0 0 0
and on each disk..
[cain 19:46] ~ >gpart list ada0
Geom name: ada0
fwheads: 16
fwsectors: 63
last: 1953525134
first: 34
entries: 128
scheme: GPT
Providers:
1. Name: ada0p1
Mediasize: 8589934592 (8.0G)
Sectorsize: 512
Mode: r0w0e0
rawtype: 516e7cb5-6ecf-11d6-8ff8-00022d09712b
label: (null)
length: 8589934592
offset: 17408
type: freebsd-swap
index: 1
end: 16777249
start: 34
2. Name: ada0p2
Mediasize: 991614917120 (924G)
Sectorsize: 512
Mode: r1w1e2
rawtype: 516e7cba-6ecf-11d6-8ff8-00022d09712b
label: (null)
length: 991614917120
offset: 8589952000
type: freebsd-zfs
index: 2
end: 1953525134
start: 16777250
Consumers:
1. Name: ada0
Mediasize: 1000204886016 (932G)
Sectorsize: 512
Mode: r1w1e3
The only tedious part is working out which drive has what UUIDs on it because gpart doesn't list them.
The advantage of using the UUIDs is that if you setup another machine the same way you don't have to worry about things when you plug in the disks from it to recover something. Or perhaps you are upgrading at the same time as replacing hardware so you have all the disks in at once.
> Create a new partition within that scheme:
>
> gpart add -b 34 -s SOMEVALUE -t freebsd-zfs ad0
>
> Why '-b 34'? Randi pointed me to http://en.wikipedia.org/wiki/GUID_Partition_Table where it explains what the first 33 LBA are used for. It's not for us to use here.
If you don't specify -b it will DTRT - that's how I did it.
You can also specify the size (and start) in human units (Gb etc).
--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
-- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C
More information about the freebsd-stable
mailing list