Discussion:
ZFS, GPTIDs, and using the whole disk
Chris Stankevitz
2014-03-03 23:47:50 UTC
Permalink
Please identify any false statements:

1. ZFS prefers to use the entire disk.

2. The only way to refer to an entire disk is by the device name e.g. /dev/da4

3. Device names like /dev/da4 are not persistently connected to actual
SATA ports on your motherboard/expander. For example, if you start
hot swapping disks, even if you put them back in the same slot, their
device names might change. Even if you don't hot swap, the device
name for a particular disk might change for other reasons (e.g. if you
have a USB drive plugged in during boot).

4. Because of (3) it is dangerous to use device names when building a zpool

5. GPTIDs are persistently attached to physical drives.

5a. This is because the GPTID is written on the disk when you create the GPTID.

6. A GPTID does not refer to an entire disk.

6a. A GPTID refers to a partition

7. You can create a zpool of GPTIDs

8. A zpool created from GPTIDs will not be using the entire disk.

9. You cannot simultaneously allow ZFS access to the entire disk while
keeping persistent names/labels.

Thank you,

Chris
Daniel O'Callaghan
2014-03-04 00:52:38 UTC
Permalink
Post by Chris Stankevitz
1. ZFS prefers to use the entire disk.
Garrett Wollman(I think...) says this is false. FreeBSD's disk
subsystem does not change the way it behaves wrt to disks versus
partitions. Solaris and OpenIndiana only guarantee barrier-writes while
still using write-cache if using the whole disk.

This is also mentioned in https://wiki.freebsd.org/ZFSTuningGuide

"The caveat about only giving ZFS full devices is a solarism that
doesn't apply to FreeBSD. On Solaris write caches are disabled on
drives if partitions are handed to ZFS. On FreeBSD this isn't the case."


With this in mind, my personal preference is to use GPT partitions.

Cheers,

Danny
Andrew Berg
2014-03-04 04:20:22 UTC
Permalink
Post by Chris Stankevitz
1. ZFS prefers to use the entire disk.
Prefers, maybe, but it is not a big deal on FreeBSD as has already been explained.
Post by Chris Stankevitz
4. Because of (3) it is dangerous to use device names when building a zpool
You would just need to be careful *at pool creation time* that you are using the correct block devices. You can swap them around all you
like afterward since ZFS doesn't use device names to find block devices belonging to a pool.
Post by Chris Stankevitz
7. You can create a zpool of GPTIDs
You can refer to block devices by GPT labels when creating a pool. I'm not sure if that's what you meant.

I personally use GPT labels with each disk in my main pool having one partition for its entire space. Without GPT labels, the only reliable
to distinguish between each disk is its serial number (they are all 3TB WD Reds), which would not be fun to use if one of them suddenly dies.
Trond Endrestøl
2014-03-04 10:29:04 UTC
Permalink
Post by Andrew Berg
Post by Chris Stankevitz
1. ZFS prefers to use the entire disk.
Prefers, maybe, but it is not a big deal on FreeBSD as has already been explained.
Post by Chris Stankevitz
4. Because of (3) it is dangerous to use device names when building a zpool
You would just need to be careful *at pool creation time* that you are using the correct block devices. You can swap them around all you
like afterward since ZFS doesn't use device names to find block devices belonging to a pool.
Post by Chris Stankevitz
7. You can create a zpool of GPTIDs
You can refer to block devices by GPT labels when creating a pool. I'm not sure if that's what you meant.
I personally use GPT labels with each disk in my main pool having one partition for its entire space. Without GPT labels, the only reliable
to distinguish between each disk is its serial number (they are all 3TB WD Reds), which would not be fun to use if one of them suddenly dies.
+1

If you want zpool status to show your carefully crafted GPT labels,
export the pool and import the pool specifying -d /dev/gpt before
putting the pool into production.
--
+-------------------------------+------------------------------------+
| Vennlig hilsen, | Best regards, |
| Trond Endrestøl, | Trond Endrestøl, |
| IT-ansvarlig, | System administrator, |
| Fagskolen Innlandet, | Gjøvik Technical College, Norway, |
| tlf. mob. 952 62 567, | Cellular...: +47 952 62 567, |
| sentralbord 61 14 54 00. | Switchboard: +47 61 14 54 00. |
+-------------------------------+------------------------------------+
Arthur Chance
2014-03-04 08:58:22 UTC
Permalink
Post by Chris Stankevitz
1. ZFS prefers to use the entire disk.
2. The only way to refer to an entire disk is by the device name e.g. /dev/da4
3. Device names like /dev/da4 are not persistently connected to actual
SATA ports on your motherboard/expander. For example, if you start
hot swapping disks, even if you put them back in the same slot, their
device names might change. Even if you don't hot swap, the device
name for a particular disk might change for other reasons (e.g. if you
have a USB drive plugged in during boot).
It's possible to permanently fix drive number assignments to particular
physical interfaces via /boot/device.hints - see the man page for
details. For instance, because of the motherboard I use the default
naming of my disks would have the system disk on ada3 and my not usually
occupied eSATA devices would be ada[01], and I prefer my system disk to
be disk 0 so my device.hints contains

# bring sense to the disks now we're on ahci.
# We also renumber the SCSI buses so the ICH9 controller
# handles scbus0-5 and the JMicron controller handles
# scbus[67].
#
hint.scbus.0.at="ahcich2"
hint.scbus.1.at="ahcich3"
hint.scbus.2.at="ahcich4"
hint.scbus.3.at="ahcich5"
hint.scbus.4.at="ahcich6"
hint.scbus.5.at="ahcich7"
hint.scbus.6.at="ahcich0"
hint.scbus.7.at="ahcich1"
#
# This makes the system disk ada0, the ZFS raidz
# ada[123], the 2 eSATA ports ada[56]
#
hint.ada.0.at="scbus0"
hint.ada.1.at="scbus1"
hint.ada.2.at="scbus2"
hint.ada.3.at="scbus3"
hint.ada.4.at="scbus4"
# The cd is on the last ICH9 port
hint.cd.0.at="scbus5"
# eSata devices
hint.ada.5.at="scbus6"
hint.ada.6.at="scbus7"
Post by Chris Stankevitz
4. Because of (3) it is dangerous to use device names when building a zpool
5. GPTIDs are persistently attached to physical drives.
5a. This is because the GPTID is written on the disk when you create the GPTID.
6. A GPTID does not refer to an entire disk.
6a. A GPTID refers to a partition
7. You can create a zpool of GPTIDs
8. A zpool created from GPTIDs will not be using the entire disk.
9. You cannot simultaneously allow ZFS access to the entire disk while
keeping persistent names/labels.
Thank you,
Loading...