External storage configurationpirated from https://www.raspberrypi.org/documentation/configuration/external-storage.md
You can connect your external hard disk, SSD, or USB stick to any of the USB ports on the Raspberry Pi, and mount the file system to access the data stored on it.
By default, your Raspberry Pi automatically mounts some of the popular file systems such as FAT, NTFS, and HFS+ at the
To set up your storage device so that it always mounts to a specific location of your choice, you must mount it manually.
Mounting a storage device
You can mount your storage device at a specific folder location. It is conventional to do this within the /mnt folder, for example /mnt/mydisk. Note that the folder must be empty.
- Plug the storage device into a USB port on the Raspberry Pi.
List all the disk partitions on the Pi using the following command:
sudo lsblk -o UUID,NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL,MODEL
The Raspberry Pi uses mount points
/boot. Your storage device will show up in this list, along with any other connected storage.
- Use the SIZE, LABEL, and MODEL columns to identify the name of the disk partition that points to your storage device. For example,
The FSTYPE column contains the filesystem type. If your storage device uses an exFAT file system, install the exFAT driver:
sudo apt update sudo apt install exfat-fuse
If your storage device uses an NTFS file system, you will have read-only access to it. If you want to write to the device, you can install the ntfs-3g driver:
sudo apt update sudo apt install ntfs-3g
for FAT32 you might need
sudo apt-get install dosfstools
(I didn't do this for vfat)
Run the following command to get the location of the disk partition:
Create a target folder to be the mount point of the storage device. The mount point name used in this case is
mydisk. You can specify a name of your choice:
sudo mkdir /mnt/mydisk
Mount the storage device at the mount point you created:
sudo mount /dev/sda1 /mnt/mydisk
Verify that the storage device is mounted successfully by listing the contents:
Setting up automatic mounting
You can modify the
fstab file to define the location where the storage device will be automatically mounted when the Raspberry Pi starts up. In the
fstab file, the disk partition is identified by the universally unique identifier (UUID).
Get the UUID of the disk partition:
Find the disk partition from the list and note the UUID. For example,
Open the fstab file using a command line editor such as nano:
sudo nano /etc/fstab
Add the following line in the
UUID=5C24-1453 /mnt/mydisk fstype defaults,auto,users,rw,nofail 0 0
(This looks to put the root folder of the USB stick into the Pi's /var/www/html folder. PHP seemed to get in the way of this, so I reinstalled everything except PHP and it worked.)
UUID=5182-4F89 /var/www/html vfat defaults,auto,users,rw,nofail 0 0
You have to use the specific USB stick associated with the UUID you obtained above.
fstypewith the type of your file system, which you found in step 2 of 'Mounting a storage device' above, for example:
If the filesystem type is FAT or NTFS, add
nofail- this will allow all users full read/write access to every file on the storage device.
Now that you have set an entry in
fstab, you can start up your Raspberry Pi with or without the storage device attached. Before you unplug the device you must either shut down the Pi, or manually unmount it using the steps in 'Unmounting a storage device' below.
Note: if you do not have the storage device attached when the Pi starts, the Pi will take an extra 90 seconds to start up. You can shorten this by adding
,x-systemd.device-timeout=30 immediately after
nofail in step 4. This will change the timeout to 30 seconds, meaning the system will only wait 30 seconds before giving up trying to mount the disk.
For more information on each Linux command, refer to the specific manual page using the
man command. For example,
Unmounting a storage device
When the Raspberry Pi shuts down, the system takes care of unmounting the storage device so that it is safe to unplug it. If you want to manually unmount a device, you can use the following command:
sudo umount /mnt/mydisk
raspi-configtool by typing:
you should see
Navigate to "Interfacing Options" using key up or key down and press
Navigate to "SSH" and press
You will be prompted whether you like to enable the SSH server. Select "Yes" and press
The next window will inform you that the SSH server is enabled. Press
Entertop go back to the main menu and select "Finish" to close the raspi-config dialog.
Alternatively, instead of using
raspi-config tool, you can simply start and enable the ssh service with
sudo systemctl enable ssh
sudo systemctl start ssh
Connecting Raspberry Pi via SSH
- To connect to Pi via SSH you will need to know your Raspberry Pi IP address. If you are running the Pi without a screen, you can find the IP address in your router’s DHCP lease table. Otherwise, if you have a monitor plugged into the Pi's HDMI, use the ip command to determine the board IP address: