That Raspberry Pi Server

Linux and Servers

Mount A Drive

A step by step guide into how to mount a drive

This Guide will show you how to configure your raspbery pi

You Will Need

  • Configured Raspberry Pi
  • A USB Drive (with a file on it)
  • SSH Software Like Putty
  • HDMI Cable
  • A computer concreted to the same network as the Pi
  • Internet connection (optinal)

Getting Started

Connect your USB drive to one of the USB ports on the raspberry pi. make sure that it powers on by checking that the drive LED lights up.

If you are using a Hard Disk Drive (HDD) or a Solid State Drive (SSD) , your drive will not start. This is because it needs more power. Simply power the drive with an external power supply. This means that both your Raspberry Pi and HDD/SSD are plugged into the mains power supply.

Download putty and run putty. When it is running put in your raspberry Pi Internet Protocol (IP) in the “Host Name (or IP address)” box. Also make sure that the port is “22”

When you are done press "Open"

Log onto your pi

Getting Ready to Mounting the Drive

First we need to see if the pi has detected the USB stick.

To do this remove the USB drive if its connected to the pi and type the command shown below

tail -f /var/log/messages

You should seem some text with dates art the start

If you plug in your USB drive some new text should appear

In the new text you sould see something like this;

raspberrypi kernel: [9410.357896] sd 4:0:0:0: [sda] Write Protect is off
raspberrypi kernel: [9410.357896] sd 4:0:0:0: [sda] Write cache: disabled
raspberrypi kernel: [9410.357896] sda: sda1
raspberrypi kernel: [9410.357896] sd 4:0:0:0: [sda] Attached SCSI removable disk

This may look a bit different to yours

As you can see the USB drive has been assigned to sda1 make note of this since you need to use this to mount the disk

Mounting the Drive

Now you need to tell the pi where to mount the drive to. If you want to mount it to the Apache web server change your directory to the web server with the command below

cd /var/www

You use the cd command to change the directory

Now we need to make a directory for the drive. to do this we need to give it a name. for this tutorial we are going to name it "storage".

to make the drive type in this command;

sudo mkdir storage

✎ NOTE - You can put what ever you want where it says "storage". make sure it has no spaces in the name

Now lets mount the drive by using this command;

sudo mount -t vfat -o uid=pi,gid=pi /dev/sda1 /var/www/storage

✎ NOTE - The end part "/var/www/storage" is where the drive is going to be mounted to. you can change this to another directory. Also the "/dev/sda1" part is what the USB drive is allocated to.

now go onto your new directory as seen below

cd storage

if you have files on your USB drive type the command below;


if you see the files you have mounted the USB drive

Mount with Fstab