0

I have custom LFS installer which contains sfdisk, I am trying to add support for NVME disks on it. When I make partitions with sfdisk on a normal SATA disk, things go as expected but when I do the exact same on a NVME disk, it creates the partitions, but when I am trying to get the size of a partition (with the sfdisk -s /dev/nvme0n1p1 command), it outputs No such device or address while trying to determine filesystem size.

lsblk output:

NAME        MAJ:MIN SIZE TYPE
nvme0n1     259:0   1.8T disk
|nvme0n1p1  259:1   200G part
`nvme0n1p2  259:10  1.6T part

sfdisk usage:

,200G,L
,,L

/proc/partitions

major minor #blocks    name
259     0   1953514584 nvme0n1
259     2    209715200 nvme0n1p1
259     3   1743798343 nvme0n1p2

They are also listed under /dev as nvme0n1, nvme0n1p1 and nvme0n1p2.

Now if I use sfdisk -s /dev/nvme0n1p1 I get the output: 209715200 and sfdisk -s /dev/nvme0n1p2 gives: No such device or address while trying to determine filesystem size.

Now the strange thing is, if I create the partitions again, and I do sfdisk -s /dev/nvme0n1p1 this now gives: No such device or address while trying to determine filesystem size and sfdisk -s /dev/nvme0n1p2 gives 209715200.

And if I it again over and over, it keeps changing, one partition is usable, other not, it swaps constantly.

Things I tried:

  • Other SSD (same type), same result;
  • I am using a pcie adapter for the NVME disk, tried other adapter, same result;
  • Using the adapter in a running open suze installation, I can execute these comands with no issues;
  • Normal sata drive, no issues.

[edit] I figured out after a reboot without the partitioning the drive again, it is possible to execute these commands, is this important to a NVME disk, but seems not to normal sata?

I am quite out of ideas now what to try or what the couse of this could be, any help would be appreciated.

1 Answer 1

0

I managed to find a sollution so I am adding the answer here so it might help others in case they encountered a similar problem.

I used the blockdev --rereadpt /dev/nvme0n1 command. This rereads the partition table, and now I can execute the sfdisk -s /dev/nvme0n1p2 command with no issues without the need of a reboot.

I am still not sure why this is not needed with normal sata drives, so if someone knows why this is not the case, feel free to leave a comment.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .