Raspberry Pi Expand Filesystem on Micro SD Card.

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:

Use the df Shell Command to view amount of disk space prior to using expand filesystem option in Raspi-Config program.

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:

Use the Raspberry Pi Terminal to run the raspi-config shell command for Raspberry Pi Configuration Tool.

Once Raspi-config is running you will see a menu of choices as shown below:

Select Advanced Options for Raspi-config shell command in Raspberry Pi Terminal.

After selecting Advanced Options, select Expand Filesystem in Raspi-Config as in picture below:

Select Expand Filesystem from Advanced Menu Options in Raspi-config application running in Raspberry Pi Terminal.

Select Yes to Expand Filesystem in Raspi-config as shown below:

Select Ok now that the Root partition has been resized. The filesystem will be enlarged upon the next reboot.

Select Finish from the Main Menu of choices as in picture below:

Select Finish from Main Menu of choices to exit Raspi-config and return to Raspberry Pi Terminal.

On exit, Select Yes to reboot now as shown below:

Raspi-config confirming reboot of Raspberry Pi after changing configuration settings.

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:

Use the df Shell Command to view and verify status of disk space after using the Raspbi-Config program to Expand Filesystem on Micro SD Card.

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.