Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant detect disk size #1194

Open
cyberphantom52 opened this issue Sep 23, 2023 · 16 comments · May be fixed by #1230
Open

Cant detect disk size #1194

cyberphantom52 opened this issue Sep 23, 2023 · 16 comments · May be fixed by #1230
Assignees
Labels
Milestone

Comments

@cyberphantom52
Copy link

cyberphantom52 commented Sep 23, 2023

I recently upgraded to Fedora 39 and udisks is no longer able to detect my drive size.
The version is udisks2-2.10.1-1.fc39.x86_64

Relevant terminal output:

phantom@rog:~$ udisksctl info --drive INTEL_SSDPEKNU010TZ_BTKA134213YD1P0B 
/org/freedesktop/UDisks2/drives/INTEL_SSDPEKNU010TZ_BTKA134213YD1P0B:
  org.freedesktop.UDisks2.Drive:
    CanPowerOff:                false
    Configuration:              {}
    ConnectionBus:              
    Ejectable:                  false
    Id:                         INTEL-SSDPEKNU010TZ-BTKA134213YD1P0B
    Media:                      
    MediaAvailable:             true
    MediaChangeDetected:        true
    MediaCompatibility:         
    MediaRemovable:             false
    Model:                      INTEL SSDPEKNU010TZ
    Optical:                    false
    OpticalBlank:               false
    OpticalNumAudioTracks:      0
    OpticalNumDataTracks:       0
    OpticalNumSessions:         0
    OpticalNumTracks:           0
    Removable:                  false
    Revision:                   002C
    RotationRate:               0
    Seat:                       seat0
    Serial:                     BTKA134213YD1P0B
    SiblingId:                  
    Size:                       0
    SortKey:                    00coldplug/00fixed/nvme0
    TimeDetected:               1695502956420019
    TimeMediaDetected:          1695502956420019
    Vendor:                     
    WWN:                        
  org.freedesktop.UDisks2.NVMe.Controller:
    ControllerID:                       1
    FGUID:                              
    NVMeRevision:                       1.4
    SanitizePercentRemaining:           -1
    SanitizeStatus:                     never_sanitized
    SmartCriticalWarning:               
    SmartPowerOnHours:                  5960
    SmartSelftestPercentRemaining:      -1
    SmartSelftestStatus:                success
    SmartTemperature:                   307
    SmartUpdated:                       1695507958
    State:                              live
    SubsystemNQN:                       nqn.2021-08.com.intel:nvm-subsystem-sn-btka134213yd1p0b
    UnallocatedCapacity:                0
@tbzatek
Copy link
Member

tbzatek commented Sep 25, 2023

Could you please attach a full udisksctl dump output?

@cyberphantom52
Copy link
Author

cyberphantom52 commented Sep 25, 2023

Could you please attach a full udisksctl dump output?

udiskctl-dump.zip

I have attached dump from two different machines, both the machines have the same issue.

@tbzatek
Copy link
Member

tbzatek commented Sep 29, 2023

Thanks for the dumps. I bet the tnvmcap field in the nvme id-ctrl -H /dev/nvme0 output would give you zeroes on both drives - could you please confirm that?

@cyberphantom52
Copy link
Author

Thanks for the dumps. I bet the tnvmcap field in the nvme id-ctrl -H /dev/nvme0 output would give you zeroes on both drives - could you please confirm that?

Yes, i ran sudo nvme id-ctrl -H /dev/nvme0 | grep tnvmcap and both devices have the value as 0.

@tbzatek
Copy link
Member

tbzatek commented Oct 2, 2023

Thanks for confirming. We'll need to find some other way then, to indicate real size of the device, including unallocated space (not attached to any namespace).

@tbzatek tbzatek added the bug label Oct 2, 2023
@tbzatek tbzatek added this to the udisks-2.11.0 milestone Oct 2, 2023
@tbzatek tbzatek self-assigned this Oct 2, 2023
@seb128
Copy link
Contributor

seb128 commented Oct 9, 2023

We started receiving Ubuntu reports about the issue, e.g https://bugs.launchpad.net/udisks/+bug/2038761

@isgospodinov
Copy link

If I hadn't read this,I probably wouldn't have even checked and noticed.
Silicon Power P34A80 aka (lspci) Silicon Motion, Inc. SM2262/SM2262EN SSD Controller (rev 03)

udisksctl info --drive SPCC_M_2e2_PCIe_SSD_30011881318 | grep Size:
Size: 0

and

sudo nvme id-ctrl /dev/nvme1n1 -H
NVME Identify Controller:
vid : 0x126f
ssvid : 0x126f
sn : 30011881318
mn : SPCC M.2 PCIe SSD
fr : HBAF28FT

tnvmcap : 0
[127:0] : 0
Total NVM Capacity (TNVMCAP)

Practically, gnome-disks,fdisk and gparted work perfectly with the device.

udisksctl info --block-device /dev/nvme1n1 | grep Size:
Size: 1024209543168

F39 kernel 6.5.7
cat /sys/block/nvme1n1/size -> 2000409264 sectors
cat /sys/block/nvme1n1/queue/hw_sector_size -> 512 bytes
2000409264 * 512 = 1024209543168

It seems like some kind of minor omission.
In my case especially the only thing that happens is that in the gnome disk utility the size doesn't show up.

@Iam-Leaning0
Copy link

Is this issue ever going to be solved? Facing the same on GNOME 45 ... not matter the Distro. Disk Capacity always showing unknown in system info

@tbzatek
Copy link
Member

tbzatek commented Nov 10, 2023

It seems like some kind of minor omission.

Unfortunately not. Controller capacity reporting is different from namespace capacity reporting. A workaround would need to look for all attached namespaces and react to attach/detach events to calculate the resulting size.

Could you also post the first four lines of nvme id-ns /dev/nvme1n1 please? Specifically the nsze, ncap and nuse fields.

@isgospodinov
Copy link

isgospodinov commented Nov 11, 2023

I haven't checked the NVMe specification in details.
I think most NVME drives have only one namespace,
but really in enterprise class hardware,
a single character device can support several namespaces.
Аnyway, in this case :
sudo nvme id-ns /dev/nvme1 -n 1 -H
NVME Identify Namespace 1:
nsze : 0x773bd2b0(2000409264₁₀)
ncap : 0x773bd2b0
nuse : 0x6b6b9548
nsfeat : 0
[4:4] : 0 NPWG, NPWA, NPDG, NPDA, and NOWS are Not Supported
[3:3] : 0 NGUID and EUI64 fields if non-zero, Reused
[2:2] : 0 Deallocated or Unwritten Logical Block error Not Supported
[1:1] : 0 Namespace uses AWUN, AWUPF, and ACWU
[0:0] : 0 Thin Provisioning Not Supported

nlbaf : 0
flbas : 0
[6:5] : 0 Most significant 2 bits of Current LBA Format Selected
[4:4] : 0 Metadata Transferred in Separate Contiguous Buffer
[3:0] : 0 Least significant 4 bits of Current LBA Format Selected

mc : 0
[1:1] : 0 Metadata Pointer Not Supported
[0:0] : 0 Metadata as Part of Extended Data LBA Not Supported

dpc : 0
[4:4] : 0 Protection Information Transferred as Last Bytes of Metadata Not Supported
[3:3] : 0 Protection Information Transferred as First Bytes of Metadata Not Supported
[2:2] : 0 Protection Information Type 3 Not Supported
[1:1] : 0 Protection Information Type 2 Not Supported
[0:0] : 0 Protection Information Type 1 Not Supported

dps : 0
[3:3] : 0 Protection Information is Transferred as Last Bytes of Metadata
[2:0] : 0 Protection Information Disabled

nmic : 0
[0:0] : 0 Namespace Multipath Not Capable

rescap : 0
[7:7] : 0 Ignore Existing Key - Used as defined in revision 1.2.1 or earlier
[6:6] : 0 Exclusive Access - All Registrants Not Supported
[5:5] : 0 Write Exclusive - All Registrants Not Supported
[4:4] : 0 Exclusive Access - Registrants Only Not Supported
[3:3] : 0 Write Exclusive - Registrants Only Not Supported
[2:2] : 0 Exclusive Access Not Supported
[1:1] : 0 Write Exclusive Not Supported
[0:0] : 0 Persist Through Power Loss Not Supported

fpi : 0x80
[7:7] : 0x1 Format Progress Indicator Supported
[6:0] : 0 Format Progress Indicator (Remaining 0%)

dlfeat : 1
[4:4] : 0 Guard Field of Deallocated Logical Blocks is set to 0xFFFF
[3:3] : 0 Deallocate Bit in the Write Zeroes Command is Not Supported
[2:0] : 0x1 Bytes Read From a Deallocated Logical Block and its Metadata are 0x00

nawun : 0
nawupf : 0
nacwu : 0
nabsn : 0
nabo : 0
nabspf : 0
noiob : 0
nvmcap : 0
mssrl : 0
mcl : 0
msrc : 0
nulbaf : 0
anagrpid: 0
nsattr : 0
nvmsetid: 0
endgid : 0
nguid : 00000000000000000000000000000000
eui64 : 0000000000000000
LBA Format 0 : Metadata Size: 0 bytes - Data Size: 512 bytes - Relative Performance: 0 Best (in use)

So how about a partial solution applicable in 90% end more of the cases
if(The nvme controller has only one namespace) {
Controller capacity = namespace capacity;
}
else { // rare cases
Look for all attached namespaces and react to attach/detach events to calculate the resulting size
}

@tbzatek
Copy link
Member

tbzatek commented Nov 30, 2023

The #1230 pull request should handle the simple cases. Any chance to test it? It's a bit of a hack.

@stuarthayhurst
Copy link

The #1230 pull request should handle the simple cases. Any chance to test it? It's a bit of a hack.

Sure, seems to be working for me

Before:

/org/freedesktop/UDisks2/drives/SAMSUNG_MZAL4512HBLU_00BL2_S67MNE2T452755:
  org.freedesktop.UDisks2.Drive:
    CanPowerOff:                false
    Configuration:              {}
    ConnectionBus:              
    Ejectable:                  false
    Id:                         SAMSUNG-MZAL4512HBLU-00BL2-S67MNE2T452755
    Media:                      
    MediaAvailable:             true
    MediaChangeDetected:        true
    MediaCompatibility:         
    MediaRemovable:             false
    Model:                      SAMSUNG MZAL4512HBLU-00BL2
    Optical:                    false
    OpticalBlank:               false
    OpticalNumAudioTracks:      0
    OpticalNumDataTracks:       0
    OpticalNumSessions:         0
    OpticalNumTracks:           0
    Removable:                  false
    Revision:                   7L1QHXC7
    RotationRate:               0
    Seat:                       seat0
    Serial:                     S67MNE2T452755
    SiblingId:                  
    Size:                       0
    SortKey:                    00coldplug/00fixed/nvme0
    TimeDetected:               1701443566674977
    TimeMediaDetected:          1701443566674977
    Vendor:                     
    WWN:                        
  org.freedesktop.UDisks2.NVMe.Controller:
    ControllerID:                       7
    FGUID:                              
    NVMeRevision:                       1.4
    SanitizePercentRemaining:           -1
    SanitizeStatus:                     never_sanitized
    SmartCriticalWarning:               
    SmartPowerOnHours:                  512
    SmartSelftestPercentRemaining:      -1
    SmartSelftestStatus:                success
    SmartTemperature:                   291
    SmartUpdated:                       1701443567
    State:                              live
    SubsystemNQN:                       nqn.1994-11.com.samsung:nvme:PM9B1:M.2:S67MNE2T452755
    UnallocatedCapacity:                0

After:

/org/freedesktop/UDisks2/drives/SAMSUNG_MZAL4512HBLU_00BL2_S67MNE2T452755:
  org.freedesktop.UDisks2.Drive:
    CanPowerOff:                false
    Configuration:              {}
    ConnectionBus:              
    Ejectable:                  false
    Id:                         SAMSUNG-MZAL4512HBLU-00BL2-S67MNE2T452755
    Media:                      
    MediaAvailable:             true
    MediaChangeDetected:        true
    MediaCompatibility:         
    MediaRemovable:             false
    Model:                      SAMSUNG MZAL4512HBLU-00BL2
    Optical:                    false
    OpticalBlank:               false
    OpticalNumAudioTracks:      0
    OpticalNumDataTracks:       0
    OpticalNumSessions:         0
    OpticalNumTracks:           0
    Removable:                  false
    Revision:                   7L1QHXC7
    RotationRate:               0
    Seat:                       seat0
    Serial:                     S67MNE2T452755
    SiblingId:                  
    Size:                       512110190592
    SortKey:                    00coldplug/00fixed/nvme0
    TimeDetected:               1701443567547533
    TimeMediaDetected:          1701443567547533
    Vendor:                     
    WWN:                        
  org.freedesktop.UDisks2.NVMe.Controller:
    ControllerID:                       7
    FGUID:                              
    NVMeRevision:                       1.4
    SanitizePercentRemaining:           -1
    SanitizeStatus:                     never_sanitized
    SmartCriticalWarning:               
    SmartPowerOnHours:                  512
    SmartSelftestPercentRemaining:      -1
    SmartSelftestStatus:                success
    SmartTemperature:                   299
    SmartUpdated:                       1701444068
    State:                              live
    SubsystemNQN:                       nqn.1994-11.com.samsung:nvme:PM9B1:M.2:S67MNE2T452755
    UnallocatedCapacity:                0

@yozachar
Copy link

yozachar commented Dec 2, 2023

Consequence: [bug] Disk capacity or size is null

@isgospodinov
Copy link

Great,works for me too.
I hope I'm not annoying too much.

  1. React to attach/detach events(is just one possible approach,maybe the best).
  2. The opposite of this approach is every calling functions or every usage of data structures
    associated with a tnvmcap size,to trigger a size recalculation,but only if
    2.1) No nvme device size reported (tnvmcap not supported)
    2.2) Number of supported namespaces is more than one (generally speaking)

if 1) & 2) are too laborious,then

  1. Recalculating size periodically(blindly) in a timer.
    I've seen a similar approach implemented in udisks2 before,when updating a S.M.A.R.T. with a hard coded 10 minute interval.
  2. Everything remains the same,only a new API is created similar to udisks_drive_ata_call_smart_update() & udisks_drive_ata_call_smart_update_sync()
    for external choice when how,where and in what way if necessary to force recalculation of the drive size.

@corradoventu
Copy link

On my PC
Mobo: ASUSTeK model: PRIME H610M-E D4
I have 2 nvme disks:
ID-1: /dev/nvme0n1 vendor: Toshiba model: KBG40ZNV256G KIOXIA size: 238.47 GiB
ID-2: /dev/nvme1n1 vendor: Kingston model: SKC2000M8250G size: 232.89 GiB

for the 1st one gnome.disk-utility gives the correct size of 256GB but for the 2nd the size is null
gnome-disk-utility: Installed: 46.0-1ubuntu3
Note: on the same PC Ubuntu Jammy with gnome-disk-utility: Installed: 42.0-1ubuntu1 gives the correct size for both.

corrado@corrado-n14-noble:~$ inxi -Fxc 
System:
  Host: corrado-n14-noble Kernel: 6.8.0-31-generic arch: x86_64 bits: 64
    compiler: gcc v: 13.2.0
  Desktop: GNOME v: 46.0 Distro: Ubuntu 24.04 LTS (Noble Numbat)
Machine:
  Type: Desktop System: ASUS product: N/A v: N/A serial: <superuser required>
  Mobo: ASUSTeK model: PRIME H610M-E D4 v: Rev 1.xx
    serial: <superuser required> UEFI: American Megatrends v: 1402
    date: 04/01/2022
CPU:
  Info: quad core model: 12th Gen Intel Core i3-12100 bits: 64 type: MT MCP
    arch: Alder Lake rev: 5 cache: L1: 320 KiB L2: 5 MiB L3: 12 MiB
  Speed (MHz): avg: 800 min/max: 800/4300 cores: 1: 800 2: 800 3: 800 4: 800
    5: 800 6: 800 7: 800 8: 800 bogomips: 52838
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
Graphics:
  Device-1: Intel Alder Lake-S GT1 [UHD Graphics 730] vendor: ASUSTeK
    driver: i915 v: kernel arch: Gen-12.2 bus-ID: 00:02.0
  Device-2: Logitech QuickCam Pro 9000 driver: snd-usb-audio,uvcvideo
    type: USB bus-ID: 1-1:2
  Display: wayland server: X.Org v: 23.2.6 with: Xwayland v: 23.2.6
    compositor: gnome-shell driver: X: loaded: modesetting unloaded: fbdev,vesa
    dri: iris gpu: i915 resolution: 1920x1080~60Hz
  API: EGL v: 1.5 drivers: iris,swrast platforms:
    active: wayland,x11,surfaceless,device inactive: gbm
  API: OpenGL v: 4.6 compat-v: 4.5 vendor: intel mesa v: 24.0.5-1ubuntu1
    glx-v: 1.4 direct-render: yes renderer: Mesa Intel UHD Graphics 730 (ADL-S
    GT1)
Audio:
  Device-1: Intel Alder Lake-S HD Audio vendor: ASUSTeK driver: snd_hda_intel
    v: kernel bus-ID: 00:1f.3
  Device-2: Logitech QuickCam Pro 9000 driver: snd-usb-audio,uvcvideo
    type: USB bus-ID: 1-1:2
  API: ALSA v: k6.8.0-31-generic status: kernel-api
  Server-1: PipeWire v: 1.0.5 status: active
Network:
  Device-1: Realtek RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet
    vendor: ASUSTeK RTL8111H driver: r8169 v: kernel port: 3000 bus-ID: 02:00.0
  IF: enp2s0 state: down mac: 58:11:22:90:10:e2
  Device-2: Ralink RT2501/RT2573 Wireless Adapter driver: rt73usb type: USB
    bus-ID: 3-2:3
  IF: wlx000ee8f7f7e6 state: up mac: 00:0e:e8:f7:f7:e6
RAID:
  Hardware-1: Intel Volume Management Device NVMe RAID Controller driver: vmd
    v: 0.6 bus-ID: 00:0e.0
Drives:
  Local Storage: total: 2.28 TiB used: 11.9 GiB (0.5%)
  ID-1: /dev/nvme0n1 vendor: Toshiba model: KBG40ZNV256G KIOXIA
    size: 238.47 GiB temp: 43.9 C
  ID-2: /dev/nvme1n1 vendor: Kingston model: SKC2000M8250G size: 232.89 GiB
    temp: 33.9 C
  ID-3: /dev/sda vendor: Crucial model: CT500MX500SSD1 size: 465.76 GiB
  ID-4: /dev/sdb vendor: Crucial model: CT500MX500SSD1 size: 465.76 GiB
  ID-5: /dev/sdc vendor: Toshiba model: DT01ACA100 size: 931.51 GiB
Partition:
  ID-1: / size: 39.08 GiB used: 7.99 GiB (20.4%) fs: ext4 dev: /dev/nvme1n1p4
  ID-2: /boot/efi size: 252 MiB used: 6.1 MiB (2.4%) fs: vfat
    dev: /dev/nvme1n1p1
Swap:
  ID-1: swap-1 type: partition size: 8 GiB used: 0 KiB (0.0%) dev: /dev/sdb2
Sensors:
  System Temperatures: cpu: 30.0 C mobo: N/A
  Fan Speeds (rpm): N/A
Info:
  Memory: total: 16 GiB note: est. available: 15.37 GiB used: 1.92 GiB (12.5%)
  Processes: 275 Uptime: 22m Init: systemd target: graphical (5)
  Packages: 1930 Compilers: N/A Shell: Bash v: 5.2.21 inxi: 3.3.34
corrado@corrado-n14-noble:~$ 



@corradoventu
Copy link

Output from udisksctl for my 2 nvme disks.
udisksctl info --block-device gives the correct size for both
udisksctl info --drive gives the correct size for the 1st but ZERO for the 2nd

corrado@corrado-n14-noble:~$ udisksctl info --block-device /dev/nvme0n1 | grep Drive:
    Drive:                      '/org/freedesktop/UDisks2/drives/KBG40ZNV256G_KIOXIA_Y1TPE3RGQW82'
corrado@corrado-n14-noble:~$ udisksctl info --block-device /dev/nvme1n1 | grep Drive:
    Drive:                      '/org/freedesktop/UDisks2/drives/KINGSTON_SKC2000M8250G_50026B72823D1475'

corrado@corrado-n14-noble:~$ udisksctl info --drive KBG40ZNV256G_KIOXIA_Y1TPE3RGQW82 | grep Size
    Size:                       256060514304
corrado@corrado-n14-noble:~$ udisksctl info --drive KINGSTON_SKC2000M8250G_50026B72823D1475 | grep Size
    Size:                       0
corrado@corrado-n14-noble:~$ 

corrado@corrado-n14-noble:~$ udisksctl info --block-device /dev/nvme0n1 | grep Size:
    Size:                       256060514304
    FormattedLBASize:           (512, 0, 0x04)
    NamespaceSize:              500118192
corrado@corrado-n14-noble:~$ udisksctl info --block-device /dev/nvme1n1 | grep Size:
    Size:                       250059350016
    FormattedLBASize:           (512, 0, 0x01)
    NamespaceSize:              488397168

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants