Solved Why can't I get flash drive to work?

Solved issue

sofasurfer

Active Member
Joined
May 24, 2022
Messages
207
Reaction score
69
Credits
1,787
My flash drive is recognized.
Code:
$ df -h
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           1.6G  5.1M  1.6G   1% /run
/dev/sda6        53G   30G   24G  56% /
tmpfs           7.8G     0  7.8G   0% /dev/shm
tmpfs           5.0M  8.0K  5.0M   1% /run/lock
/dev/sda5       834G  232G  560G  30% /home
tmpfs           1.6G  228K  1.6G   1% /run/user/1000
/dev/sdb1        58G   24K   55G   1% /media/daryl/2615fa0f-e5b9-4b84-90b1-f78279a3e51f

I tried to give myself permission with
Code:
$ sudo mount /dev/sdb1
[sudo] password for daryl: 
mount: /dev/sdb1: can't find in /etc/fstab.

Am I required to enter a removable drive into fstab to get it to mount on insertion?
 


My flash drive is recognized.
Code:
$ df -h
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           1.6G  5.1M  1.6G   1% /run
/dev/sda6        53G   30G   24G  56% /
tmpfs           7.8G     0  7.8G   0% /dev/shm
tmpfs           5.0M  8.0K  5.0M   1% /run/lock
/dev/sda5       834G  232G  560G  30% /home
tmpfs           1.6G  228K  1.6G   1% /run/user/1000
/dev/sdb1        58G   24K   55G   1% /media/daryl/2615fa0f-e5b9-4b84-90b1-f78279a3e51f

I tried to give myself permission with
Code:
$ sudo mount /dev/sdb1
[sudo] password for daryl:
mount: /dev/sdb1: can't find in /etc/fstab.

Am I required to enter a removable drive into fstab to get it to mount on insertion?
If you just want to mount the usb to read it, you need to add a mount point to the command, e.g.:
Code:
sudo mount /dev/sdb1 /mnt
Then navigate to /mnt and run ls to see the files.

If you want to write to the usb, then the following command will enable that:
Code:
sudo mount /dev/sdb1 /mnt -o umask=0

If you want to have the usb mounted automatically on insertion, then desktop environments like gnome and kde have settings where you can select automounting to occur on insertion of the usb. The configs will be under Settings somewhere.

One is not required to have an entry in /etc/fstab to have the usb mounted on insertion.

Having an entry in /etc/fstab to mount a usb can be limiting because the device name in the fstab file may not correspond with the device name the kernel allocates to the device, in which case it won't get mounted.

If on the other hand, you only ever plug in a single usb at a time, which the kernel always allocates the same device name, then an entry in /etc/fstab with that device name or the associated UUID usually works reliably with the following sort of entry:
Code:
/dev/sdb1  /media/usb  vfat  defaults,noauto,user  0  0
The mount point in this example is /media/usb, and it has to exist on the filesystem.
The "noauto" means that the usb won't be mounted automatically on boot. The following command should then mount the usb whenever it's inserted:
Code:
mount /dev/sdb1
There would be no need for the sudo privilege shown in post #1. To unmount, either of the following should work:
Code:
umount /dev/sdb1
umount /media/usb

An alternative means of mounting is to use the udisks2 facilities which enable reading and writing to the usb. For example, in the following, the user checks the device name, then uses the commands shown to mount and unmount the usb:

Code:
$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda           8:0    1  14.6G  0 disk
└─sda1        8:1    1  14.6G  0 part <-----------DEVICE NAME is /dev/sda1
sr0          11:0    1  1024M  0 rom
<snip>
Mount the usb:
Code:
$ udisksctl mount -b /dev/sda1
Mounted /dev/sda1 at /media/ben/STORE N GO
List the files at the mount point:
Code:
$ cd /media/ben/STORE N GO
$ ls
file1 file2 file3
<snip>
To unmount the usb:
Code:
udisksctl unmount -b /dev/sda1
To unmount successfully, the user has to leave the directory where the usb is mounted.

The packages installed on a machine here related to this are:
udisks2
fuse3
gvfs-fuse
libfuse2t64
libfuse3-3

The user is a member of the disk and plugdev groups in /etc/group. Haven't checked without those configs.
 
Last edited:
My flash drive is recognized.
Code:
$ df -h
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           1.6G  5.1M  1.6G   1% /run
/dev/sda6        53G   30G   24G  56% /
tmpfs           7.8G     0  7.8G   0% /dev/shm
tmpfs           5.0M  8.0K  5.0M   1% /run/lock
/dev/sda5       834G  232G  560G  30% /home
tmpfs           1.6G  228K  1.6G   1% /run/user/1000
/dev/sdb1        58G   24K   55G   1% /media/daryl/2615fa0f-e5b9-4b84-90b1-f78279a3e51f

I tried to give myself permission with
Code:
$ sudo mount /dev/sdb1
[sudo] password for daryl:
mount: /dev/sdb1: can't find in /etc/fstab.

Am I required to enter a removable drive into fstab to get it to mount on insertion?
what distro are you using. Ubuntu, Fedora, Mint, Debian all you have to do is plug it in and it works. It mounts and you have access to the drive like any other.
 
if you type ... disks ..into the menu on 24.04....do you get any result ?
 
I'm using ubuntu 24.04.
Where in preferences is the setting to automount usb as stated in post #2?
For gnome on ubuntu perhaps either of the following could help.
This one covers usb sticks:


This one covers usb external disks:

This one covers disabling automount which could be reversed by careful attention to the configuration variables:
 



Top