Raspberry Pi : Mounting a USB Thumb Drive

1

With the Raspberry Pi, Mounting a USB Thumb Drive

1

The below lesson is another fundamental lesson on Raspberry Pi.

The below lesson will help you in setting up the Raspberry Pi to identify and automatically support USB thumb drive. Several uses of this functionality are that it is helpful while transferring files or taking back up of data or else you can use Raspberry Pi as Media storage device as well.

However, to implement you need to have a running Raspberry Pi at your disposal. To configure it, you can check lesson on Ultimate Raspberry Pi Configuration guide which can be found on internet.

For the below lesson, Mac OS is used, however, the operations can be carried out on other OS as well.

Step 1:

Raspberry Pi – How to format USB drive

2

Show All Items

Format you USB thumb drive with MS-DOS (FAT) as format type. The format can be carried out using disk utility. FAT format type helps create a format which is recognized by Raspberry Pi.

Step 2:

Raspberry Pi – Running updates

It’s better to connect Raspberry Pi and access it using SSH. The mentioned IP address is mine and you have to provide your own IP address here.

To access the Raspberry Pi run the below command in the terminal window:

Sshpi@10.0.1.62

However, if you are directly connected into the monitor, the above step can be ignored.

In order to run the latest package updates, wifi connectivity is required. To run the updates, kindly run the below line of code:

Firstly,

Sudo apt-get update

Secondly,

Sudo apt-get upgrade

The package update will take some time to get updated which you can see running on your screen.

Step 3:

Raspberry Pi – Configuring mounting point of thumb drive.

3

F88P9BNHU1RQCW8.MEDIUM

Show All Items

Connect the formatted USB drive with Raspberry Pi after unplugging the power cable. Switch on the Pi.

I generally like to connect wifi dongle to lower port and keep the upper port free for other things like keyboard, USB, etc. to connect.

After sometime, run the above ssh command again

sshpi@10.0.1.62

Making sure you give your IP address. Run the below code:

mkdirusbdrv

This will map the directory to USB drive. It is essential to set up mount point.

Then type below line of code:

sudoblkid

The USB drive information now can be seen on the screen, hence check the output.

/dev/sda1: LABEL=”GITPI” UUID=”6D34-1514″ TYPE=”vfat”

Your output should be similar to the above mentioned.

Next step is to make File drive system editable so as to map the USB drive map to usbdrv directory.

Type the below line of code:

sudonano /etc/fstab

In order to map the drive to the directory, run the below line of code directly:

/dev/sda1/home/pi/usbdrv vfat uid=pi,gid=pi,umask=0022,sync,auto,nosuid,rw,nouser 0   0

Please note that the above line is a single line.

The above code will convert the USB drive viz. /dev/sda1 map to usbdrv directory. The flag values were copied from Thomas Loughlin guide and they make the drive read-write and is accessible to all users.

To save it:

Cntl-X, Y, Return

To restart it:

sudo reboot

 Step 4:

Raspberry Pi – How to test it

5

Show Al

Once, the pi is restarted using the reboot command and the ssh connection is established, one can traverse the usbdrv directory using:

cdusbdrv

to test, try creating a text file, by:

sudonano test.txt

Type any message in the editor you want to have and save again using:

Cntl-X,Y

Switch off the power of Pi and take out the USB drive.

Check the data in the USB drive after connecting to computer and one can see the text entered into the text file.

Step 5:

Raspberry Pi – Mounting and Unmounting using commands

Many people just pull the USB out of the Pi and restart the Pi, however, many people would like to have an eject option similar to the Mac system. This can be done using below line of code to unmount the USB:

sudoumountusbdrv

In order to mount a different USB, the line of code is:

Sudo mount /dev/sda1

Step 6:

Raspberry Pi – Finished

 I hope this easy lesson was of help. It was quite short. Thanks

Share.

About Author

1 Comment

  1. Hi Paul,Thanks for useful post.But, I couldn’t find &#lle6;SignalR.C2i1nt.Si8verlight5′in client using manage NuGet packages. but I found and download ‘SignalR.Hosting.AspNet’for server.

Leave A Reply