I sometimes run into issues with unmounting usb sticks and there was this command that is suggested but doesn’t work anymore, what would be the updated version or command to use to reach same effect of unmounting the usb sticks when they do not show the unmount triangular button in caja?
Suggested command but not working anymore: udisks --unmount /dev/sdb1 && udisks --detach /dev/sdb
If the eject icon isn’t displayed in Caja’s panel, it usually means that the drive is plugged but not mounted. So, are you sure it is?
You can also try to use the umount command:
umount /media/yourname/drivename
where yourname is your username and drivename the mount point name. When you mount a drive through Caja (or other file managers), it’s done as user level in a directory named after you in /media.
However if you unmount it that way, even if data is still being written from cache to the usb stick it will then interrupt it without waiting until it’s done? Or is there another way to formulate the unmount command as such that it waits until data written from cache is complete and then unmounts?
You have to use the sync command before unmounting to be sure that the data is finished being written (wait for the shell to bring you back to the prompt, it can take several minutes, don’t assume that it’s stuck).
Doing a quick search, I found a blog post about a bash script to properly eject an USB device; it uses the udiskctl command. Maybe that’s the proper command for the one you had?
You don’t need to use sudo (unless maybe if you mounted the USB key as root for some reason but even then I’m not sure).
When you push enter to run the command, the cursor will just go to the next line and nothing will seem to happen. When it’s finished, you’ll get the prompt back and it means that cache writing is done.
OK. I do not need to specify what it has to sync right? Just sync on its own will be enough or do I have to specify the device name to which it is currently writing to?
No need to specify anything, just run the sync command. Not sure how it handles several devices if you happen to copy files to multiple USB devices at once, though, I’ve never tried that kind of case.