You are not logged in.

#1 2025-06-29 05:59:48

Beemo
Member
Registered: 2024-12-20
Posts: 84

[SOLVED] Nautilus: Unmount is not "safely remove"?

I've made sure to press the triangle button next to the device and check the notification is not saying "should not be removed", every time I eject a USB drive. However, I had 2 times where pulling the drive right after that led to corruption anyway. One time a multi-GB file I just copied simply disappeared, another the entire partition was no longer recognized as BTRFS. Even though people say this is sufficient.
I noticed I have 2 types of USB drives, one is the regular kind where Nautilus says the triangle icon is "Eject", the other is high speed drives that the system thinks is non-removable and the triangle icon says "Unmount" (e.g. Framework expansion card drive, Samsung portable SSD).
Some time later, I read in udisksctl that there are differences in "unmount" and "power-off" (udisks2 is what Nautilus uses as back-end). I also read somewhere that unmount just means no processes can reference the device anymore, which seems about right, but I can't find where it is now. So, I've been superstitiously powering off my drives in gnome-disks every time I eject USB drives.

unmount     Unmounts a device.
power-off    Arranges for the drive to be safely removed and powered off. ...then requesting that in-flight buffers and caches are committed to stable storage.

Today I just found that you can right click on the drives in Nautilus, and in the menu there is "Safely Remove Drive", which seems to do the same as "power-off" in udisksctl. It's not mentioned in the GNOME Help.

So... just to confirm, the right click option is what we should have used to eject "non-removable" drives? "Unmount" is not "safely remove"?

Last edited by Beemo (2025-06-30 04:40:09)

Offline

#2 2025-06-29 06:59:49

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,720

Re: [SOLVED] Nautilus: Unmount is not "safely remove"?

Unmounting implies syncing the FS wich is the crucial bit when it comes to data integrity.
Powering off is mainly¹ relevant for spinning drives because it allows the head to be withdrawn under control (instead of forcing an emergency retract when you cut power cold by pulling the plug)

Syncing the filesystem can take a moment (or two) since data is written asynchronously for performance and drive health benefits. It is paramount to wait for some confirmation that the drive has been unmounted and can now be removed - just pushing the button and immediately yanking the drive as some sort of religious liturgy is pointless - and will lead to data corruption.

¹ Some drives might come w/ an internal volatile cache (RAM), the data is written there first and the drive internally handles the actual writing to non-volatile memory (effectively doing what the kernel does anyway but in hardware)
In that case cutting the power from the drive can corrupt the data (because the internal cache gets lost and cannot flush) and you'll have to somehow™ make sure the drive is done with its business before you physically cut it from power - the power-off command achieves this.

Rule of thumb: if you're going to detach a drive, power-off it. It will help spinners and drives w/ internal caches and cause no harm to eg. usb keys (ok, maybe some cheapo usb key w/ a bogus firmware will die on that… I'm not giving you a 100% guarantee)
Unmounting is relevant for internal drives or maybe remote filesystems (since as you figured: powering those off will have the undesirable consequence of completely losing access so you cannot easily re-mount them afterwards)

That all being said: I've unfortunately no idea which feature is hidden behind what button in nautilus sad

Offline

#3 2025-06-29 12:48:15

tekstryder
Member
Registered: 2013-02-14
Posts: 504

Re: [SOLVED] Nautilus: Unmount is not "safely remove"?

OP: You could post this non-Arch-specific inquiry on Gnome Discourse: https://discourse.gnome.org where you'll likely get a response from a nautilus dev with specifics.

Seth addressed the differentiation of unmount vs power-off. In most cases, the device type detection by nautilus is smart and does the right thing.

I have an external USB3 dock that only allows for "Unmount" via Nautilus. Not superstitious, but I take no chances at corruption with the spinning disks it holds:

sudo udisksctl power-off -b /dev/sdX

...prior to physical power-off and device removal.

Offline

Board footer

Powered by FluxBB