How Do You Get Raspberry Pi to Use a USB Drive?

Problem scenario
You are trying to use a USB stick with your Raspberry Pi.  But you get errors you receive say things like "operation not permitted" and "target is busy."  You want to create new directories and files on this thumb drive.  What do you do?

1. Remove the USB stick.
2.  Insert it.  Do not choose the GUI prompt to use File Manager.  
3.  With a command prompt, find the gid and uid of the user you want to be able to access to the USB drive.  If you know the username, run this command:

id jdoe # where jdoe is the username

4.  Use the following command where "foobar" is the name of the directory you want to refer to when you read/write to the USB drive, "1001" is the gid of the user above and "1000" is the uid of the user above.

sudo mount -o remount,gid=1001,uid=1000 /media/pi/foobar/

# Without modifying the fstab, this mounted directory may be available after a reboot of the Raspberry Pi!

Leave a comment

Your email address will not be published. Required fields are marked *