Changes

Jump to navigation Jump to search

How to Format and Mount the HDD/SSD on Raspberry Pi

2,923 bytes added, 01:27, 8 December 2023
no edit summary
{{GD Template Impl}}
==Overview==
You can get more knowledge about hard disk partitioning, formatting, and mounting on the Raspberry Pi from the '''Internet'''.
'''==Using Gparted tools to partition, format and mount SSDs =====1. Install Gparted tool on Raspberry Pi'''===
You can either use a terminal, and simply use the following commands:
[[File:Menu-gparted.jpg]]
'''=== 2. Use Gparted on Raspberry Pi'''===
When you start Gparted, you need to type your password (administrator privileges are required). Then, you’ll get an interface looking like:
[[File:New-partition-ok.jpg]]
 
 
If you want to access the new partition within the file explorer, the easiest way is to unplug the USB jumper and plug it in again. Raspberry Pi OS will automatically mount the new partition:
 
[[File:Data-auto-mount.jpg]]
 
That’s it, you can now use it and create files in this folder
 
==Mount a HDD/SSD with a command on a Lite version==
=== Find the virtual drive name ===
 
Before doing anything else, you need to find the current name of the drive. Once you plug it in, Raspbian will detect the drive and partitions, and assign a name to it. Follow this procedure to find it:
 
- We’ll use “fdisk” to list the current devices on the Raspberry Pi.
 
- Use the command below:
pi@raspberrypi ~ $ sudo fdisk -l
- A list will appear, and most of the time your HDD/SSD drive is the last item, so it’s easy to read.
 
In my case, I have this:
 
[[File:Fdisk-list-devices.jpg]]
 
- You have two things to note (squared in red):
#The partition name, assigned by Raspberry Pi OS: /dev/sda1 here.
#The file system type: FAT32 here.
- Once you know this, you have everything you need to move forward.
 
If you are not sure which one is your drive, the disk size may help you select the correct one (7.5G in above case). My SD card is 32G and is always identified as /dev/mmcblk0
 
=== Mount the drive ===
Now that you know the device and partition name, use the following procedure to mount it:
 
- Create a new folder in /media.
 
We’ll mount the USB drive in this folder, but you need to create it before:
pi@raspberrypi ~ $ sudo mkdir /media/usb
 
- Mount the drive to this place with this simple command:
pi@raspberrypi ~ $ sudo mount /dev/sda1 /media/usb -o umask=000
Don’t forget to replace parameters if needed. The syntax is “mount [PARTITION] [FOLDER]”. The -o allows you to add extra options.
 
PS: You can get more information about the use of the mount command from the Internet
 
=== Automatic mount on boot ===
As you’ll quickly see, you need to use the mount command each time you reboot your Raspberry Pi.
 
But there is something you can do to mount it automatically on boot:
 
- Get the partition id of your device:
pi@raspberrypi ~ $ sudo blkid
- You’ll get something like this:
 
[[File:Blkid.jpg]]
 
The PARTUUID is the value square in red, on the /dev/sdb1 line.
 
- Open the /etc/fstab file:
pi@raspberrypi ~ $ sudo nano /etc/fstab
 
- Paste this line, or something similar depending on your values:
PARTUUID=b951dfde-01 /media/usb ntfs defaults,umask=000 0 0
 
- Fstab is a file to store drives and options related to it.
 
And if the drive is plugged in on boot, it will mount it directly.
 
- Save and exit (CTRL+O, CTRL+X).
 
Now you can reboot your system and check that everything works fine.

Navigation menu