How to Expand Filesystem on Raspberry Pi Easily
To expand the filesystem on a Raspberry Pi, run
sudo raspi-config, select Advanced Options, then Expand Filesystem. After rebooting, the Pi will use the full SD card space.Syntax
The main command to expand the filesystem on Raspberry Pi is sudo raspi-config. This opens a configuration tool with options.
sudo: runs the command as an administrator.raspi-config: the Raspberry Pi configuration tool.- Inside the tool, navigate to Advanced Options > Expand Filesystem.
- After selecting, reboot the Pi to apply changes.
bash
sudo raspi-config
Example
This example shows how to expand the filesystem using the Raspberry Pi terminal.
First, open the terminal and run the command below. Then follow the menu to expand the filesystem and reboot.
bash
pi@raspberrypi:~ $ sudo raspi-config *** Raspberry Pi Software Configuration Tool *** 1 Change User Password 2 Network Options 3 Boot Options 4 Localisation Options 5 Interfacing Options 6 Advanced Options 7 Update 8 About raspi-config Select <6> Advanced Options Advanced Options A1 Expand Filesystem A2 Memory Split A3 SSH A4 SPI A5 I2C A6 Serial A7 Audio A8 Resolution A9 GL Driver Select <A1> Expand Filesystem The root partition will be resized to fill the SD card. Reboot required to apply changes. Would you like to reboot now? <Yes> pi@raspberrypi:~ $
Output
The root partition will be resized to fill the SD card.
Reboot required to apply changes.
Would you like to reboot now? <Yes>
Common Pitfalls
Some common mistakes when expanding the filesystem on Raspberry Pi include:
- Not rebooting after expanding the filesystem, so changes don't take effect.
- Trying to expand the filesystem on a mounted partition manually without tools, which can cause errors.
- Using outdated Raspberry Pi OS versions where
raspi-configoptions differ. - Running the command without
sudo, causing permission denied errors.
Always use sudo raspi-config and reboot after expanding.
bash
Wrong way (no sudo): raspi-config Right way: sudo raspi-config
Quick Reference
Summary tips for expanding filesystem on Raspberry Pi:
- Run
sudo raspi-configto open the config tool. - Navigate to Advanced Options > Expand Filesystem.
- Confirm and reboot the Raspberry Pi.
- Verify expanded space with
df -hafter reboot.
Key Takeaways
Use
sudo raspi-config to safely expand the Raspberry Pi filesystem.Always reboot after expanding the filesystem to apply changes.
Avoid manual partition resizing unless you are experienced.
Check available disk space with
df -h after reboot.Ensure your Raspberry Pi OS is up to date for best compatibility.