Boot from microSD instead of external drive
If the Raspberry Pi is not able to boot from your external drive, you can boot from a microSD card and use the external drive to store all the application data.
Difficulty: Easy
Steps required
To boot from a microSD card and store the data on an external drive, there are a few additional steps compared to the default RaMiX guide. Below is a summary of the main differences, with detailed guidance in the following sections.
write the operating system to the microSD card instead of the external drive
attach the external drive
test the USB3 performance
format the drive
mount the drive to
/data
Operating system
When writing Raspberry Pi OS to the boot medium, use a high-quality microSD card of 8+ GB instead of the external drive.
System configuration
Connect your external drive to the Raspberry Pi using one of the blue USB3 ports.
Follow the Configuration section until you reach the Data directory section, continuing with the instructions below.
In case your external drive shows poor performance, follow the Fix bad USB3 performance instructions, as mentioned in the guide.
Format external drive
We will now format the external drive. As a server installation, the Linux native file system Ext4 is the best choice for the external hard disk.
List all block devices with additional information. The list shows the devices (e.g.
sda
) and the partitions they contain (e.g.sda1
)
Example of expected output:
If your drive does not contain any partitions, follow this How to Create a Disk Partitions in Linux guide first.
Make a note of the partition name of your external drive (in this case “sda1”).
Format the partition on the external drive with Ext4 (use
[NAME]
from above, e.g.sda1
)
Attention: this will delete all existing data on the external drive!
Mount external drive
The external drive is then attached to the file system and becomes available as a regular folder (this is called “mounting”).
List the block devices once more and copy the new partition’s
UUID
into a text editor on your main machine
Example of expected output:
Edit the
fstab
file
Add the following as a new line at the end, replacing
123456
with your ownUUID
more: complete fstab guide
Create the data directory as a mount point
Assing to the
admin
user as the owner of the(/data)
folder
Make the directory immutable to prevent data from being written on the microSD card if the external drive is not mounted
Mount all drives
Check the file system. Is “/data” listed?
Move swap file to New Drive
The swap file acts as slower memory and is essential for system stability. MicroSD cards are not very performant and degrade over time under constant read/write activity. Therefore, we move the swap file to the external drive and increase its size as well.
Edit the
dphys-swapfile
configuration file
Uncomment the entry
CONF_SWAPSIZE
by deleting the#
in front of it, and editing to match this
Comment the
CONF_SWAPSIZE
by placing a#
in front of it
Recreate and activate new swapfile
Continue with the guide
That’s it: your Raspberry Pi now boots from the microSD card while the data directory /data
is located on the external drive.
You can now continue with the Remote access section
Last updated