How to Expand Disk Space on Ubuntu Installed on Raspberry Pi 400
- Get link
- X
- Other Apps
How to Expand Disk Space on Ubuntu Installed on Raspberry Pi 400
The Raspberry Pi 400 is a compact, keyboard-integrated single-board computer widely used for learning, development, and general-purpose computing.
It is characterized by its affordable price, low power consumption, and compact design.
Ubuntu Linux is one of the most widely used operating systems today, offering a familiar desktop environment, a rich software ecosystem, and a modern Linux development environment.
After installing Ubuntu, the available disk space on an SD card or SSD may appear limited due to default settings.
This is especially common when using Ubuntu Server or minimal installation images, where the usable storage space may appear smaller than the actual disk capacity.
1. Why Disk Space May Be Limited
When installing Ubuntu on the Raspberry Pi 400, the installation image typically comes with pre-defined partition sizes. Even if your SD card or SSD has a large capacity, the installation process may create smaller partitions, leaving unused space.
This can lead to the following situations:
-
The
df -hcommand shows less available space than expected -
Extra space exists on the SD card or SSD but is not allocated
Therefore, after installation, it is recommended to resize partitions and the filesystem to use the entire disk capacity.
![]() |
| Disk Free Space |
2. Preparation for Expanding Disk Space
Before expanding disk space, make sure to prepare the following:
3.1 Backup
-
Back up important files and settings to an external drive or cloud storage to prevent data loss.
3.2 Internet Connection
-
Internet access may be required for updates or package installation.
3.3 Administrative Privileges
-
Expanding partitions requires system administrator privileges, so log in with a
sudo-enabled account.
3. Check Current Partition Layout
First, check the current partition structure and filesystem.
Open a terminal and run:
lsblk
Example output:
4. Using raspi-config (SD Card Only)
On Raspberry Pi OS, raspi-config offers an automatic partition expansion feature.
Ubuntu does not provide this by default, so manual resizing is required.
5. Expanding Partitions (Ubuntu Desktop / Server)
5.1 Using GParted (GUI)
On Ubuntu Desktop, you can use GParted for graphical partition management.
Install GParted:
sudo apt update
sudo apt install gparted -y
Open GParted and select the unallocated space to expand the root partition (/).
Note: the root partition must be unmounted to modify it, so performing this in a live session or USB boot is safer.
5.2 Using growpart and resize2fs (CLI)
On Ubuntu Server or command-line environments, you can expand partitions via terminal.
-
Install required utilities:
sudo apt update
sudo apt install cloud-guest-utils -y
-
Expand the partition:
sudo growpart /dev/mmcblk0 2
-
/dev/mmcblk0: Disk device (SD card) -
2: Partition number to expand (usually root partition)
-
Resize the filesystem:
sudo resize2fs /dev/mmcblk0p2
After completion, check the available space with df -h to confirm that the root partition now uses the full disk capacity.
6. Using an SSD
If using a USB SSD with the Raspberry Pi 400, the same steps can be followed.
The disk name may differ (e.g., /dev/sda, /dev/sdb), so be sure to select the correct device.
7. Verify the Expansion
After resizing, verify the changes:
df -h
lsblk
If the root partition (/) now matches the total disk capacity, the expansion was successful.
8. Precautions
-
Interrupting the process or selecting the wrong partition may result in data loss; always back up important data.
-
Resizing the root partition directly is safer when done from a live USB or external system.
-
Check the health and endurance of the SD card or SSD, and avoid excessive write operations.
9. Conclusion
Expanding disk space on Ubuntu installed on the Raspberry Pi 400 allows you to fully utilize storage for learning, development, and general computing tasks.
Key points:
-
Ubuntu may initially create smaller partitions than the total disk size
-
CLI users can use
growpart+resize2fs -
GUI users can use GParted
-
Always verify with
df -handlsblkafter expansion
- Get link
- X
- Other Apps


