Earlier I created a new partition with FSTYPE zfs_member
, and (I think) I set the GPT partition label to the new name of the ZFS pool, and then created the ZFS pool in this partition (zpool create ... /dev/disk/by-partuuid/...
). That looks like:
$ lsblk --output NAME,FSTYPE,MODEL,LABEL,PTTYPE,SIZE -e 7
NAME FSTYPE MODEL LABEL PTTYPE SIZE
sda Samsung_SSD_860_QVO_1TB gpt 931,5G
└─sda1 zfs_member my-zfs-pool gpt 931,5G
I read in a couple of places that using a GPT partition for ZFS should be fine. In the old Sun ZFS documentation, there was a recommendation at some point to use the whole disk, but this seems to be long outdated, and esp not relevant for ZFS-on-Linux. (Some discussion about this topic: e.g. here)
Now I read that ZFS-on-Linux anyway would automatically partition the disk with GPT, if you pass a whole disk to zpool create
. (Here is an issue for an option to actually disable that auto-partition behavior.)
Note that in any case, I want to have some GPT partitioning. Because e.g. maybe I want to shrink the partition later and put other partitions on it. Or whatever. I don't think there is any good reason not to have a GPT partition table on the disk.
So I thought that the auto partitioning might be better. Maybe ZFS partitions it slightly different, for whatever clever reason, and that is maybe better. So I did that on another new disk (zpool create ... /dev/disk/by-id/...(whole-disk)
).
However, that looks like this now:
$ lsblk --output NAME,FSTYPE,MODEL,LABEL,PTTYPE,SIZE -e 7
NAME FSTYPE MODEL LABEL PTTYPE SIZE
sdb WDC_WD60EZAZ-00ZGHB0 gpt 5,5T
├─sdb1 gpt 5,5T
└─sdb9 gpt 8M
So, ZFS indeed created a GPT partition table as I wanted. However, it did not set the FSTYPE
on the partitions, nor did it set a GPT partition label.
So, now to my actual questions:
Why did it not set the FSTYPE, nor the GPT partition label?
Is it safe to set the FSTYPE afterwards? E.g. to zfs_member
?
Is it safe to set the GPT partition label afterwards? E.g. to the name of the zpool?
Warning: make sure you have a backup, as you could lose all your data if you accidentally do "the wrong thing".
It's probably not worth the risk of doing it at all, as you could keep track of this partition's type in other ways (e.g. write on the physical drive).
Normally we do this before writing data to a new partition, then there's no risk.
I haven't acually done this with a disk that's already in use, but I'm fairly sure it can be done.
You can use gdisk (https://www.rodsbooks.com/gdisk/gdisk.html) to set the GPT partition name (a.k.a. 'label'). Gdisk is quite careful to help you avoid destructive accidents, but to be sure of avoiding them, you'll still need to understand how it works.
Most likely, other partitioning tools can do this too, but with GPT I have used only gdisk and sgdisk.
Don't bother with the partition type, as Linux does not need it. You can include 'ZFS' in the name/label.
Btw,
lsblk
(on Manjaro) shows my zfs mirror as below.Partitioning was done by giving the whole disk to ZFS (in 2015, on Ubuntu).
I may have changed the name to "zp0" later, but via zpool, not via other tools, with:
zpool export [poolname]
zpool import [poolname] [newpoolname]
Using your lsblk args :
EDIT:
In answer to your "actual questions":
As a safer alternative to changing the label in GPT:
Try changing the pool name in ZFS, and see if it changes what lsblk shows:
zpool export [poolname]
then
zpool import [poolname] [newpoolname]
This is the normal way to rename a pool, and is quite safe.
(The square brackets only indicate text to be replaced; don't include them.)
About the sdx9 partitions, again I don't know, and don't care enough to find out, sorry. It happens only when you give ZFS a whole raw disk. Try the OpenZFS documentation.
I'm preparing to create another ZFS mirror, and saw this thread while researching how best to do it. This time I'll make GPT with sgdisk, then create the zpool mirror on matching GPT partitions (one on each drive). I'm looking ahead to the possibility of making an EFI boot drive with a ZFS data partition on it, and this 2-step method will be required for that situation. (Unless the OS is FreeBSD, in which case I'll let the OS installer create a ZFS boot drive.)