Increase Storage Space for larger SD Card:
You spent hard earned money on a higher capacity Micro SD card. Additionally, like a pro you backed up your Raspberry Pi. Consequently, you mastered restoring your OS onto the new Micro SD Card. However, when you turn on your Raspberry Pi, you notice you still have the same storage space as before. It is time to Expand Filesystem.
By expanding the filesystem on Micro SD card, you will be able to access the new storage space. This page shows how to use rasp-config in the Raspberry Pi Terminal to expand filesystem. This ensures that all of the Micro SD card storage is available for use.
Expand Filesystem Example:
For example, let us assume that you replaced your 16GB with a 128GB Micro SD Card. Power on your Raspberry Pi which is now using the larger Micro SD Card. Open the Raspberry Pi Terminal from the Desktop and enter the following command as shown below:
df -h
As a result, you will see an example something like the picture shown below:
In the above example the /dev/root filesystem is 15GB and there is only about 1GB available. In fact, restoring the Raspberry Pi OS Image to a larger Micro SD card does not necessarily change the size of the disk partition. However, expanding the file system after upgrading your Micro SD card is a simple and fast process.
Expand Filesystem – Step by Step Instructions:
Using the Raspberry Pi Desktop or ssh, open up the Terminal and enter the following command:
sudo raspi-config
Example of Raspi-config shell command is shown in picture below:
Once Raspi-config is running you will see a menu of choices as shown below:
After selecting Advanced Options, select Expand Filesystem in Raspi-Config as in picture below:
Select Yes to Expand Filesystem in Raspi-config as shown below:
Select Finish from the Main Menu of choices as in picture below:
On exit, Select Yes to reboot now as shown below:
After reboot of your Raspberry Pi, open up the Terminal and enter the following df command used above:
df -h
As a result, you will see more disk space available as in picture shown below:
Congratulations:
As a result, the df Shell Command in the above example shows a total size of the /dev/root filesystem. Instead of 15GB there is now 117GB. The amount of disk space used is about 6GB with 107GB available.
Summary:
As can be seen, writing images such as the Raspberry Pi OS to a larger Micro SD Card does not mean the disk partition size will be changed. Therefore, using Advanced Settings in the Raspi-config Shell Command will allow you to expand Filesystem. Expanding the Filesystem will maximize the size of the Partition to match what is available on physical Micro SD card.