Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8093

Raspberry Pi OS • Re: Trixie fails at mounting and safely removing NVMe and USB3+ drives

$
0
0
I think I found the reason why RPiOS fails at removing safely NVMe devices in a USB enclosure.

While I'm working at creating my own script to replace the system feature, thus exploring the available options for "lsblk" command, I discovered the options "TRAN" and "RM".

For example :

Code:

lsblk -nd -o NAME,TRAN,RM,MODEL,SIZE
will return

Code:

sda   usb    0 KINGSTON SV300S37A120G 111.8Gsdb   usb    1 Flash Disk               1.9Gsdc   usb    0 ORICO                  119.2G
Here we can see that
- sda is my system disk (Sata SSD) in an USB enclosure. Transport is USB, RM for Removable Media is set to 0 meaning not ejectable
- sdb is a basic USB flash drive. Transport is USB, RM for Removable Media is set to 1 meaning yes it is ejectable
- sdc is a NVMe SSD in an USB enclosure. Transport is USB, RM for Removable Media is set to 0 meaning not ejectable

And here is the problem ! Because "transport" value for sdc is NOT "nvme" (the "normal" value when a NVMe drive is used with PCIexpress port), the system should realize that it is de facto removable (despite the RM = 0). An NVMe drive seen as USB is obviously used in a USB enclosure. Thus the decision to make it RM or not is about checking whether it is a system drive or not. And not relying on what the drive says...

Consequently I believe the solution is
- exclude system drive from the list of drives to eject safely (it's already the case)
- if NVMe drive uses USB transport and is not system drive : it is potentially removable even if RM is set to 0
- if NVMe drive uses nvme transport, it is by definition NOT removable so it's not in the list either.

I hope this makes sense...

PS : same applies to Sata SSD in USB enclosures...

Statistics: Posted by dwam — Thu Oct 30, 2025 1:57 pm



Viewing all articles
Browse latest Browse all 8093

Trending Articles