Mounting SSD permanently using fstab

Posted under » Ubuntu » Linux » Raspberry Pi on 05 April 2022

You can make your SSD or HDD mount automatically when you power it up. The drawback is that it will always be /media/pi/ssdname or /mnt/kjk/ssdname. What if you want to have that SSD permanently attached to the linux box as a specific folder, eg. /kioxia and not the usual given names?

Before we continue, I would like to caution that most of the time, this is not how you fix your lack of hardisk space for your system file. Does not matter if it is windows or linux. It is always better to start with ample space for your boot system.

In linux, these folders normally take up the most space.

/usr
/home/ubuntu
/var

First lets us look at /etc/fstab for ubuntu 22.04 on raspberry pi running on an SD card.

LABEL=writable  /        ext4   defaults        0 0
LABEL=system-boot       /boot/firmware  vfat    defaults        0       1

We already know how to mount a disk. To load the sda into the /etc/fstab, read the first part Raspberry pi 4 boot from USB.

The final 'lsblk -f' will look like this.

NAME        FSTYPE   FSVER LABEL       UUID       FSAVAIL FSUSE% MOUNTPOINTS
sda         ext4     1.0   satu        a9462bc5-11ac-45ca  199.7G     4% /kioxia
mmcblk0                                                                                    
├─mmcblk0p1 vfat     FAT32 system-boot D7A9-3EE6              110.4M    56% /boot/firmware
└─mmcblk0p2 ext4     1.0   writable    09799e9f-8009-4b0c    5.2G    59% /

web security linux ubuntu python django git Raspberry apache mysql php drupal cake javascript css AWS data