Cannot safely eject drive after large directory transfer

I have just transferred many files onto a drive via dolphin. The transfer took over 3 hours, but all fits on the drive with plenty of storage to spare. When dolphin notified it as done, I tried ejecting the drive via the devices tray menu, where it says Could not remove this device.. I also tried ejecting via dolphin, where it says The requested operation has failed: Error unmounting /dev/sdd1: not mounted. Checking lsblk shows the drive as follows:

NAME       MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sdd          8:48   0 931.5G  0 disk 
└─sdd1       8:49   0 931.5G  0 part /mnt/run/media/liveuser/05f3e123-90b8-4e6e-87a7-65af683fc4de

I can still access the drive and any of its contents I check, including via /mnt/run/media/liveuser/etc.
Here’s what top has to say, though it fluctuates:

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                      
  13729 liveuser  20   0   11.6g 489864 233184 S  10.0   3.0   0:57.48 firefox                                      
  14840 liveuser  20   0 2747292 243256 102432 S   4.7   1.5   0:28.52 Isolated Web Co                              
   1138 liveuser  20   0 1093844 133252  78404 S   3.3   0.8   6:18.69 Xorg                                         
   1203 liveuser  20   0 2327820 202600 126256 S   3.0   1.2   7:34.46 kwin_x11                                     
   1247 liveuser  20   0 4220092 475444 181608 S   1.0   2.9  17:19.52 plasmashell                                  
  12550 liveuser  20   0 1274676 128412 106100 S   1.0   0.8   0:09.98 konsole                                      
  13828 liveuser  20   0 2552740 146948  96576 S   0.7   0.9   0:02.50 Privileged Cont                              
    877 root       0 -20       0      0      0 I   0.3   0.0   0:20.69 kworker/u33:1-i915_flip                      
   8405 root      20   0       0      0      0 I   0.3   0.0   0:04.51 kworker/u32:4-events_unbound                 
   8957 root      20   0       0      0      0 I   0.3   0.0   0:00.70 kworker/2:0-mm_percpu_wq                     
   9688 root       0 -20       0      0      0 I   0.3   0.0   0:02.26 kworker/u33:3-i915_flip                      
  12632 liveuser  20   0   11072   6112   3808 R   0.3   0.0   0:06.89 top                                          
      1 root      20   0   21996  14092  10428 S   0.0   0.1   0:06.13 systemd   

So- How can I check whether the transfer is somehow still in process, or where there are connections still being made, or if the drive is safe to unmount via commandline, or unplug, without corrupting the data?

I use the sync command in a terminal whenever I move large amount of data to an storage medium using a file manager and after it has apparently finished its job.

This will ensure that any data held in memory caches is safely written to the storage, protecting against data loss.

2 Likes
  1. Is the USB light still steady?
  2. Issue the sync command, it should not return till all data is written ouit.

The light is off, and the sync command immediately returns with no output.
Edit: The light is now on hahaha
Edit 2: Every behaviour I mentioned is the same as before checking sync.

Well something is wrong, possibly the drive ran out of space. I’d venture to say your copy failed, though I don’t know that.

You could try one or more of the following (fuser is often preinstalled, might need pacman -S lsof to install lsof):

  • fuser -mv /dev/sdd1
  • lsof +f -- /dev/sdd1

The are (few) conditions lsof won’t catch, though, like mount on mount, loop mounts, or NFS exports.

You can also specify a mount point instead of a device, like /run/media/matthias/Ventoy.

Example output:

[matthias@toshi-mch ~]$ fuser -mv /dev/sdb1
                     BEN.        PID ZUGR.  BEFEHL
/dev/sdb1:           root     kernel mount /run/media/matthias/Ventoy
                     matthias  16361 f.... less
[matthias@toshi-mch ~]$ 
[matthias@toshi-mch ~]$ lsof +f -- /dev/sdb1
COMMAND   PID     USER FD   TYPE DEVICE SIZE/OFF NODE NAME
less    16361 matthias 4r   REG   8,17     1699  443 /run/media/matthias/Ventoy/ventoy/ventoy.json

Thus, you can diagnose why the system refuses to unmount. I had a file open using less for this example.

1 Like

Did you stop Dolphin? Otherwise, the drive is still in use by Dolphin. Or change directory in Dolphin.

Next time use rsync for copying… :wink:

2 Likes

Thats what happens in nemo. If i try to eject drive while nemo is still open i get message saying drive is busy.

Well it all appears to have worked (I just sudo umounted in the end). I did close and re-open dolphin a few times and couldn’t see any process for it in top but I’m not that used to top. I’ll look into rsync for the future, and fuser and lsof look good.

Thanks everyone ^^