To facilitate mounting/unmounting these drives I wrote two BASH functions that take a device letter (it does not matter if you use uppercase or lowercase) as an argument.
- wmount mounts the drive (and generates a mount point if necessary).
- wumount unmounts the drive (and keeps the mount point for later use)
wmount () { if [[ $# -ne 1 || ! ($1 =~ [a-zA-Z]) ]]; then echo Usage $0 [drive_letter] return 1 fi drive_letter=$(echo $1|tr '[:lower:]' '[:upper:]') mount_dir="/mnt/$(echo $1|tr '[:upper:]' '[:lower:]')" if [[ ! -d $mount_dir ]]; then sudo mkdir $mount_dir fi sudo mount -t drvfs $drive_letter: $mount_dir } wumount () { if [[ $# -ne 1 || ! ($1 =~ [a-zA-Z]) ]]; then echo Usage $0 [drive_letter] return 1 fi mount_dir="/mnt/$(echo $1|tr '[:upper:]' '[:lower:]')" if [[ -d $mount_dir ]]; then grep -qs "$mount_dir " /proc/mounts if [[ $? ]]; then sudo umount $mount_dir fi fi }ldsajffd