dcantrell / pyparted

Python bindings for GNU parted (libparted)
GNU General Public License v2.0
86 stars 43 forks source link

ZFS file system/ partitions on debian bullseye with zfs-2.0.3-9 #87

Closed kirscheGIT closed 2 years ago

kirscheGIT commented 2 years ago

Hello,

pyparted is not recognizing ZFS file system/ partitions on debian bullseye with zfs-2.0.3-9.

Ways to reproduce (simplest example): zpool create pybenchpoolnvm0n1 /dev/nvme0n1

The zpool is mounted and fully accesible

Using the example dump_partitions.py-> changing line 28 to device="/dev/nvme0n1" gives the following output:

***** sanity check *****
result: True
===== device ====
  model: Micron_9300_MTFDHAL3T8TDP
  path: /dev/nvme0n1
  sectorSize: 4096
  physicalSectorSize: 4096
  length: 937684566
===== disk ====
  type: gpt
  lastPartitionNumber: 9
  primaryPartitionCount: 2
  free space regions:
    0:
      start: 6
      end: 2047
      length: 2042
    1:
      start: 937682944
      end: 937684560
      length: 1617
===== partitions ====
Partition 1:
  length: 937664512
  active: True
  busy: False
  path: /dev/nvme0n1p1
  type: 0
  size(MB): 3662752.0
  name: zfs-9eb193c6297790f1
  filesystem:
    Filesystem info missing! you have an unformatted partition...
  geometry:
    start: 2048
    end: 937666559
    length: 937664512
Partition 9:
  length: 16384
  active: True
  busy: False
  path: /dev/nvme0n1p9
  type: 0
  size(MB): 64.0
  name: 
  filesystem:
    Filesystem info missing! you have an unformatted partition...
  geometry:
    start: 937666560
    end: 937682943
    length: 16384

fdisk gives the following output:

Disk /dev/nvme0n1: 3,49 TiB, 3840755982336 bytes, 937684566 sectors
Disk model: Micron_9300_MTFDHAL3T8TDP               
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 5A8E06AC-D095-6143-9599-BA7DAAC8AC51

Device             Start       End   Sectors  Size Type
/dev/nvme0n1p1      2048 937666559 937664512  3,5T Solaris /usr & Apple ZFS
/dev/nvme0n1p9 937666560 937682943     16384   64M Solaris reserved 1

blkid gives the following output

/dev/nvme0n1p1: LABEL="pybenchpoolnvme0n1" UUID="787063089205607908" UUID_SUB="12848811619258076980" BLOCK_SIZE="4096" TYPE="zfs_member" PARTLABEL="zfs-9eb193c6297790f1" PARTUUID="20e69604-c1d5-9342-9557-e89f0bde6216"
/dev/nvme0n1p9: PARTUUID="d096a433-516d-be47-b2db-114512132925"

As parted gives the same output than dump_partitions.py example, I have the feeling this has something to do with parted/libparted and or zfs on linux. I'm not sure if I'm doing something wrong or impossible here. So any help is highly appreciated!

Thanks! Chris

dcantrell commented 2 years ago

You are right here. pyparted is a layer on top of libparted. If libparted doesn't do it, pyparted can't. So the first step is to work with GNU parted on what is happening here and then if anything can be changed there, I can work on it in pyparted.

I would offer to do this, but it's been a very long time since I was upstream GNU parted. I handed that off to someone a long time ago.