After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 755022 - gparted doesn't recognize nvme devices
gparted doesn't recognize nvme devices
Status: RESOLVED FIXED
Product: gparted
Classification: Other
Component: application
0.22.0
Other Linux
: Normal major
: ---
Assigned To: gparted maintainers alias
gparted maintainers alias
Depends on:
Blocks:
 
 
Reported: 2015-09-15 05:52 UTC by Joshua Rosen
Modified: 2015-10-27 17:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Recognise NVME devices (v1) (2.00 KB, patch)
2015-09-16 20:14 UTC, Mike Fleetwood
none Details | Review
Recognise NVME devices (v2) (1.98 KB, patch)
2015-09-17 06:56 UTC, Mike Fleetwood
none Details | Review

Description Joshua Rosen 2015-09-15 05:52:14 UTC
Running gparted 22 on Fedora 22. It doesn't see nvme devices. I have an Intel 750 SSD, gparted doesn't see it, gnome-disks and parted do. The device name is /dev/nvme0, parted shows it as follows,

Model: Unknown (unknown)
Disk /dev/nvme0n1: 400GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  2049kB  1000kB  primary  ext2         boot
 4      2097kB  32.0GB  32.0GB  primary  ext4
 2      32.0GB  64.0GB  32.0GB  primary  ext4
 3      64.0GB  400GB   336GB   primary  ext4
Comment 1 Mike Fleetwood 2015-09-16 07:36:12 UTC
Hi Joshua,

Can you run a couple of experiments for me please, because I don't have
an NVMe device.

1) Get parted to find the first disk device and print it's contents:
   (Please detach all other drives apart from the NVMe one)

      parted
         print
         quit

2) Run GParted specifying the name of the NVMe device on the command
   line:

      gparted /dev/nvme0

Thanks,
Mike


Analysis:
You information showed that parted, and therefore libparted, can query
the device, I assume when parted is told the device name
"parted /dev/nvme0 print".  GParted can also work with specified device
names so it should be able to display and manage the NVMe device given
it's name.  This suggests that it is listing available devices that is
not finding the NVMe device.  GParted also uses libparted for this too,
but the bug could be either in libparted or GParted.  Hopefully the
result from test (1) above will narrow down which.
Comment 2 Joshua Rosen 2015-09-16 12:28:29 UTC
print all
Model: ATA Samsung SSD 840 (scsi)
Disk /dev/sda: 250GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  34.4GB  34.4GB  primary  ext4         boot
 2      34.4GB  250GB   216GB   primary  ext4


Model: ATA Hitachi HDS72302 (scsi)
Disk /dev/sdb: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system     Flags
 1      1049kB  25.8GB  25.8GB  primary  ext4            boot
 2      25.8GB  51.5GB  25.8GB  primary  linux-swap(v1)
 3      51.5GB  2000GB  1949GB  primary  ext4            raid


Model: ATA Hitachi HDS72302 (scsi)
Disk /dev/sdc: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  25.8GB  25.8GB  primary  ext4         boot
 2      25.8GB  51.5GB  25.8GB  primary  ext4
 3      51.5GB  2000GB  1949GB  primary  ext4         raid


Model: Linux Software RAID Array (md)
Disk /dev/md127: 3898GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags: 

Number  Start  End     Size    File system  Flags
 1      0.00B  3898GB  3898GB  ext4


Model: Unknown (unknown)
Disk /dev/nvme0n1: 400GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  2049kB  1000kB  primary  ext2         boot
 4      2097kB  32.0GB  32.0GB  primary  ext4
 2      32.0GB  64.0GB  32.0GB  primary  ext4
 3      64.0GB  400GB   336GB   primary  ext4

--------------------------------------------------------------------------

gparted /dev/nvme0

Error fsyncing/closing /dev/nvme0: Invalid argument
Comment 3 Mike Fleetwood 2015-09-16 16:48:40 UTC
The message "Error fsyncing/closing /dev/nvme0: Invalid argument" is
coming from libparted.  Can occur when opening, closing or syncing a
device.  GParted needs this to work as it ensures Linux kernel cache
coherency between the cached data from the device and the partitions it
contains.

The GParted and libparted code is complicated enough that I need to
debug this to work out what is exactly happening and how it might be
fixed.  Unfortunately I don't have a NVMe device or access to one.  At
the moment I'm not sure how to solve this bug.
Comment 4 Joshua Rosen 2015-09-16 17:13:33 UTC
Where's the source code. If you like I could step through the code in GDB. 

You might want to contact Intel and tell them who you are, they might be willing to send you a 750 so that you can get gparted working with it. Intel has been really good about supporting Linux and given that NVME devices are primarily for enterprise and HPC use where Linux dominates they have an incentive to give you one.
Comment 5 Curtis Gedak 2015-09-16 17:27:44 UTC
Hi Mike and Joshua,

From a quick Internet search, it appears that Intel has an new optimized PCI Express SSD Interface for their Solid State Drives.

http://www.nvmexpress.org/

On the code side of things, GParted uses it's own device parsing from the /proc/partitions file.  This was due to historical problems with excessive time delays when libparted probed floppy devices.  Currently there is no pattern match for "nvme..." in the /proc/partitions file so that would explain why GParted does not automatically detect the device.

The relevant code section is Proc_Partitions_Info::load_proc_partitions_info_cache()

https://git.gnome.org/browse/gparted/tree/src/Proc_Partitions_Info.cc?id=GPARTED_0_23_0#n90

If Intel uses standard Linux conventions for this new NVME driver, then it might be a simple case of adding a regular expression to match with the way NVME devices are named.


@Joshua, to test if GParted already works with NVME devices would you be able to try passing the NVME device path to gparted on the command line (as root)?

For example:

   gparted /dev/nvme0n1

NOTE:  From the first post it appears that the device path name is "/dev/nvme0n1" <-- note the "n1" on the end.


Thanks,
Curtis
Comment 6 Joshua Rosen 2015-09-16 17:41:30 UTC
It works when I do,

gparted /dev/nvme0n1

So it looks like adding the regular expression search should work. Make the change and point me to the source code or a binary built for F22 and I'll try it out for you.
Comment 7 Mike Fleetwood 2015-09-16 19:04:39 UTC
Sorry for my misinterpretation of the data earlier.  For some reason I
looked at:
  Model: Unknown (unknown)
  Disk /dev/nvme0n1: 400GB
and though that was a partition name and that the disk name was
/dev/nvme0 and went down a blind ally.

Joshua,

Can you show me the output of:
    grep nvme /proc/partitions
So that I can make sure I get the regular expression correct to match
disks and not partitions.

Thanks,
Mike
Comment 8 Joshua Rosen 2015-09-16 19:10:39 UTC
 grep nvme /proc/partitions
 259        0  390711384 nvme0n1
 259        1        977 nvme0n1p1
 259        2   31250000 nvme0n1p2
 259        3  328209496 nvme0n1p3
 259        4   31249408 nvme0n1p4
Comment 9 Curtis Gedak 2015-09-16 19:13:54 UTC
Thanks Joshua for testing and confirming that the work-around of passing the NVME device name works for you.

Did you name the device "nvme0n1" or some portion of that name?


@Mike, I made the same mistake when I first looked at the device path.  ;-)

We should try to determine how the naming conventions work for the NVME driver in order to add the correct regular expression.  If you have a chance to look into this enhancement then please feel free to create the patch.

After that Joshua's offer to test will be greatly appreciated.

Curtis
Comment 10 Mike Fleetwood 2015-09-16 20:14:17 UTC
Created attachment 311505 [details] [review]
Recognise NVME devices (v1)

Attached is the patch for this.

Joshua,

You can either build GParted from the last release or use current head
from Git.

From source release
-------------------

Get GParted application 0.23.0 source from the download page:
http://gparted.org/download.php

Apply attached code using patch.

Build following the instructions on the development page, section
"Building GParted":
http://gparted.org/development.php

From Git
--------

Clone GIT repo, use "git am ..." to apply the patch and then build.
Find all the details in the Developing GParted using Git page:
http://gparted.org/git.php

Thanks,
Mike
Comment 11 Joshua Rosen 2015-09-16 21:08:42 UTC
There is a problem with configure,

configure: error: *** libuuid not found.

The library is present,

/usr/lib/libuuid.so.1
/usr/lib/libuuid.so.1.3.0
/usr/lib64/libuuid.so.1
/usr/lib64/libuuid.so.1.3.0
Comment 12 Mike Fleetwood 2015-09-17 06:32:02 UTC
Hi Joshua,

You need the libuuid development package too, to compile the code.  On
Fedora it's called: libuuid-devel.

N.B.  The README file lists the needed packages, including this one.

Thanks,
Mike
Comment 13 Mike Fleetwood 2015-09-17 06:56:41 UTC
Created attachment 311522 [details] [review]
Recognise NVME devices (v2)

Hi Curtis,

Here's patch v2.  The only difference are minor changes to the commit
message.

Thanks,
Mike
Comment 14 Joshua Rosen 2015-09-17 11:27:11 UTC
Good news, the patch works.
Comment 15 Joshua Rosen 2015-09-17 16:20:08 UTC
Let me know when the RPM is in the Fedora testing repo.

On an unrelated note, I have a feature request. It would be nice if Gparted could edit /etc/fstab and add the mount point for the partition that you just created. Currently I either use Webmin or just do it in Xemacs, but it would be better if Gparted could handle the whole job.
Comment 16 Mike Fleetwood 2015-09-18 09:11:56 UTC
Letting you know when down stream distros updates their gparted package
with the latest release is outside our power.  However we won't close
this bug report until we make the next release including this code, so
at least GNOME Bugzilla will send you an email when that happens.
Comment 17 Curtis Gedak 2015-09-21 15:53:25 UTC
Thank you Joshua and Mike for your work to add support for NVME devices.

I have committed patch set v2 from comment #13 for inclusion in the next release of GParted.

The relevant git commit can be viewed at the following link:

Recognise NVME devices (#755022)
https://git.gnome.org/browse/gparted/commit/?id=66bb88abf7c3ef33445f8eaa1d3fa6f00950bde3
Comment 18 Curtis Gedak 2015-10-27 17:02:22 UTC
This enhancement was included in the GParted 0.24.0 release on October 27, 2015.