#!/bin/bash
borg create /media/greg/flash-drive/borg::"$(date +%FT)" /home/greg/borg && umount -l /media/greg/flash-drive
I use the above script to make backups to a thumb-drive (flash drive). As you can see, I use umount
at the end. Doing this however does not result in the "eject button" symbol disappearing in Nautilus, so I don't know with 100% certainty that the drive has been unmounted (based on visual inspection in Nautilus) before pulling the thumb-drive.
Is there a command that will unmount and power-off the drive, removing the "eject button" symbol within Nautilus so I have visual confirmation that the drive is unmounted and that there is no possible way that damage could occur to the data when i pull the thumb-drive?
To have confirmation that de flash drive is unmounted you can use the command lsblk. That wil show you al te mounted drives in your system.
Take the command && umount ... out of the script and try running umount manually on the command line. See if this make a difference.
If positive you need to adjust your script. At first I would delete the && and type umount on a new line.
Please note that all access to the flash drive must be closed before unmount can be performed.