Flash Ubuntu Server to a 5TB HDD for Raspberry Pi 5, then resize the root partition to 250GB within MBR partition table limits.
Step 1: Flash Ubuntu Server Image onto the 5TB Drive
- Download the official Ubuntu Server image for Raspberry Pi from the Ubuntu website.
- Use Raspberry Pi Imager to write the image to your 5TB HDD:
- Select the downloaded Ubuntu Server image.
- Select your 5TB drive as the target.
- Flash the image.
- After flashing, the image creates two partitions by default:
sda1— FAT32 boot partition (~512MB)sda2— ext4 root partition (~3.2GB)
Step 2: Resize the Root Partition (/dev/sda2) to 250GB on the Host Linux System you imaged with
Note: Do not connect this to the Pi! These actions need to be performed on a linux PC where this is an external device.
Note: The 5TB disk uses an MBR (msdos) partition table, which limits partitions to a maximum of ~2TB. To avoid partition size errors, resize root to 250GB.
- Check disk and partition layout:
lsblk - Unmount partitions if mounted:
sudo umount /dev/sda1 sudo umount /dev/sda2 - Launch parted to modify partitions:
sudo parted /dev/sda - Inside parted:
- Delete existing root partition:bashCopyEdit
rm 2 - Create a new root partition sized at 250GB:
mkpart primary ext4 512MB 250GB - Verify partitions:arduinoCopyEdit
print - Exit parted:nginxCopyEdit
quit
- Delete existing root partition:bashCopyEdit
- Format the new root partition as ext4:
sudo mkfs.ext4 /dev/sda2 - Run filesystem check on the new partition:
sudo e2fsck -f /dev/sda2 - Resize filesystem to fill the new partition size:
sudo resize2fs /dev/sda2
Step 3: Boot Raspberry Pi 5 with the Resized 5TB HDD
- Connect the 5TB HDD to the Raspberry Pi 5.
- Power on and boot from the drive.
- On first boot, the system will use the 250GB root partition.
- (Optional) Once booted, you can create additional partitions in the remaining space or consider migrating to GPT to use full disk size later.
Step 4: Verify Partition and Filesystem Size on Pi
After boot, verify sizes with:
bashCopyEditlsblk
df -h /
Notes
- MBR Limit: The MBR partition table restricts partition sizes; for disks over 2TB, GPT is preferred.
- Future Expansion: For full 5TB usage as a single partition, convert the disk to GPT and reinstall Ubuntu Server.
- Data Partitions: You can use remaining unallocated space for data partitions formatted separately.
Comments
One response to “Setting Up Ubuntu Server on a 5TB HDD for Raspberry Pi 5 to bypass 2TB limit”
Hi, this is a comment.
To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard.
Commenter avatars come from Gravatar.