1

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?

3
  • Why is it important for you to set the FSTYPE ? ZFS will manage the partitions or disks you add to the pool.
    – Soren A
    Jan 11, 2021 at 12:58
  • SUN ZFS was originally designed for handling very large disk-setups (Z stands for Zeta-byte) in Sokaris servers. So for performance, reliability, performance, and more it was recommended to only using full disks. Having raidgroups or mirrirs spread out on various partitions makes it difficult to that disk-redundancy always will be guarantied.
    – Soren A
    Jan 11, 2021 at 13:07
  • @SorenA So that other tools (lsblk, gparted, whatever) can show me the FS type. Or maybe when I later put this disk into a new PC, and maybe I forgot what FS I had put there. Such information would be useful, I guess.
    – Albert
    Jan 11, 2021 at 16:37

1 Answer 1

1

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]

$ lsblk -f
NAME   FSTYPE     FSVER LABEL  UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
sda
|-sda1 zfs_member 5000  zp0    17149246668572983114
`-sda9
sdb
|-sdb1 zfs_member 5000  zp0    17149246668572983114
`-sdb9

Using your lsblk args :

$ lsblk --output NAME,FSTYPE,MODEL,LABEL,PTTYPE,SIZE -e 7
NAME   FSTYPE     MODEL                     LABEL  PTTYPE   SIZE
sda               ST4000DM000-1F2168               gpt      3.6T
|-sda1 zfs_member                           zp0    gpt      3.6T
`-sda9                                             gpt        8M
sdb               ST4000DM000-1F2168               gpt      3.6T
|-sdb1 zfs_member                           zp0    gpt      3.6T
`-sdb9                                             gpt        8M

EDIT:

In answer to your "actual questions":

  1. I don't know. ZFS created those entries for me.
  2. Don't bother, it's not worth the effort/risk.
  3. If you try it, be careful (as described above).

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

2
  • Thanks for the post. You did not directly answer my questions in the end. Maybe you can add that? So the answer is basically "yes, it should be safe"? Is there a reason it did not already do that? Also another follow-up question, what is this sda9 for?
    – Albert
    Feb 23, 2022 at 10:24
  • @Albert: I've edited my answer.
    – j77h
    Feb 23, 2022 at 12:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.