In this segment, we are going to show you “How to Mount External Storage Drives on Raspberry Pi all Models.”
What is Mount External Storage {Mounting & UnMounting} ?
Mounting is a process by which the operating system makes files and directories on a storage device (such as hard drive, CD-ROM, or network share) available for users to access via the computer’s file system.
In general, the process of mounting comprises an operating system acquiring access to the storage medium; recognizing, reading, processing file system structure, and metadata on it; before registering them to the virtual file system (VFS) component.
The location in VFS that the newly-mounted medium was registered is called mount point; when the mounting process is completed, the user can access files and directories on the medium from there.
An opposite process of mounting is called unmounting, in which the operating system cuts off all user access to files and directories on the mount point, writes the remaining queue of user data to the storage device, refreshes file system metadata, then relinquishes access to the device; making the storage device safe for removal.
Normally, when the computer is shutting down, every mounted-storage will undergo an unmounting process to ensure that all queued data got written, and to preserve the integrity of the file system structure on the media.
Source /> Wikipedia
Software Required :
Equipment Required | Optional | ||
Raspberry Pi 4 | Case | ||
SD Card | Raspberry Pi Keyboard | ||
Ethernet Cable | Mouse | ||
Power Adapter | |||
External HDD | |||
Shop now |
Raspbian OS Installation :
- Download Raspbian OS from Official Website: raspberrypi.org
- Then write the image to the SD Card using: Etcher
- Now, Boot the Raspberry Pi with this SD Card, Follow the On-Screen Instructions and then open Terminal.
STEP- 1: Mount External Storage
List the Drive
- First of all, we need to list all the attached drives on our Raspberry Pi.
sudo blkid
Create a Mount Folder
- Secondly, we need to create a mount folder to mount our External Drive.
sudo mkdir /mnt/Drive_Name
Mount the drive to Folder
- After that, use the below-given command to mount the drive to the created folder.
sudo mount /dev/sda1 /mnt/Drive_Name
Give proper permission
- Finally, provide the read and write permission to drive.
sudo chmod 775 /mnt/Drive_Name
STEP- 2: Auto Mount Drive on Startup
- Similarly to automount the drive on startup we need to follow the below-given steps.
List the Drive & note UUID
- Firstly, list all the drives using the below-given commands.
sudo blkid
Edit fstab
- After that, we need to edit fstab to add our drive to startup.
sudo nano /etc/fstab
Adding lines to fstab
- Followed by adding the below-given line to fstab.
UUID=enter_uuid_here /mnt/Drive_Name auto nofail,uid=enter_uid_here,gid=enter_gid_here,noatime 0 0
Reboot Raspberry Pi
- Finally, reboot the Raspberry Pi.
sudo reboot
STEP- 3: UnMount Drive
sudo umount /mnt/Drive_Name
STEP- 4: Remove Mount Folder
sudo rmdir /mnt/Drive_Name
In conclusion
- Now you know the basics of Mounting External Drive on Raspberry Pi.
- If you have any suggestions regarding this article please mention in the comment section down below.
- Enjoy using Raspberry Pi.
Please check out my other articles:
Did you find us helpful?
Subscribe our YouTube Channel | |
Support us on Patreon | |
Like us on Facebook | |
Share This Article with others |
When I try to mount, I get:
mount: /mnt/MediaCenter: /media/pi/MediaCenter is not a block device.
My hard drive is automatically mounting in media and is not in any dev folder. Can you help? Thanks!