Easily Resize And Expand Ubuntu Partitions On A Raspberry Pi

expand ubuntu partitions
Image Credit: www.omgubuntu.com

Are you running out of disk space on Raspberry Pi that is running Ubuntu OS? Maybe you’re getting warning messages that your root partition is almost full, and you’re not sure what to do about it. 

Well, don’t worry, because in this post we’re going to tackle the topic of how to resize and expand Ubuntu partitions on your Raspberry Pi. With a few simple steps, you’ll be able to increase your storage capacity and keep your Pi running smoothly.

Let’s dive in. 

Before You Start Expanding Ubuntu partitions 

Before we discuss how to resize and expand Ubuntu partitions, there are a few things you need to have in order. Here are the prerequisites to make sure you have before diving in:

  • A backup of your important data

    First things first, make sure you have a backup of your important data. Seriously, don’t skip this step. There’s always a chance that something could go wrong when you’re working with partitioning or disk management, and you don’t want to lose your precious files.
  • Enough free space

    You need to have some free space on your hard drive to expand the partitions. If you don’t have any free space available, you’ll need to delete some unnecessary files or move them to an external storage device.
  • Gparted:

    This is a powerful yet user-friendly partition editor that you’ll use to resize and expand Ubuntu partitions. Gparted is typically included with most Linux distributions, including Ubuntu. If it’s not installed on your system, you can easily install it using the command line or the Ubuntu Software Center.
  • Time

    Expanding partitions can take some time, especially if you’re working with a large hard drive. Be prepared to dedicate enough time to the process and don’t rush through the steps – even if you’re in a hurry!

How To Resize And Expand Ubuntu Partitions Using Gparted (GUI)

Now that you have everything you need, it’s time to dive into the process of resizing and expanding Ubuntu partitions. Here’s a step-by-step guide to get you started:

  1. Launch Gparted

    Open up Gparted, either from the command line or by searching for it in your application menu. Make sure you have administrative privileges so that you can make changes to your partitions and unmount them if needed.
  1. Identify the partition you want to expand

    Look for the partition you want to expand in the list of partitions. It should be labeled with the file system type and the amount of space it currently occupies.
Easily Resize And Expand Ubuntu Partitions On A Raspberry Pi
Image Credit: Gparted.org
  1. Shrink the neighboring partition (if necessary)

    If the partition you’d like to expand is surrounded by other partitions, you’ll need to shrink the neighboring partition(s) to make room. Right-click on the partition and select “Resize/Move”. Then, drag the slider to shrink the partition and create some unallocated space.
  2. Expand the partition

    Now it’s time to expand the partition you want to enlarge. Right-click on the partition and select “Resize/Move”. Drag the slider to the right to increase the partition size and take advantage of the unallocated space.
Easily Resize And Expand Ubuntu Partitions On A Raspberry Pi
Image Credit: Superuser.com

RELATED: How To Partition A USB Drive


  1. Apply the changes

    Once you’re happy with the partition sizes, click the “Apply” button in the toolbar. Gparted will show you a summary of the changes you’re about to make. If everything looks good, click “Apply” again to confirm the changes.

  2. Wait for the changes to take effect

    The partition resizing process can take a while, depending on the speed of your hard drive and the amount of data you have stored on it. Don’t panic if it takes a while – just sit back, relax, and let Gparted do its thing.

  3. Reboot

    Once the changes have been applied, you’ll need to reboot your computer for the changes to take effect. Don’t forget to save any open files and close any running programs before you reboot.

And that’s it! You’ve successfully resized and expanded your Ubuntu partitions. Now you can enjoy more space on your hard drive and an optimized Ubuntu experience.

Optional: Ubuntu Expand Root Partition

Expanding the Ubuntu system partition is a bit trickier than expanding a regular data partition, but it’s still doable with the right tools and knowledge. 

This is mainly because if you want to resize a partition, you need to unmount it first. However, the system partition can’t be unmounted, which is why you may need to boot on a Live-USB key. 

Here’s how to expand Ubuntu server partition:

  1. Download Ubuntu from the official website.
  2. Flash it on a USB key using a tool like Etcher or Rufus.
Easily Resize And Expand Ubuntu Partitions On A Raspberry Pi
Image Credit: Superuser.com
  1. Insert the USB key into your computer, and boot on it by pressing F12 or DEL (depending on your computer) to access the boot menu.
  2. Choose the live boot option (remember, we’re not looking to reinstall Ubuntu).
  3. Once you’re in the Live-USB environment, you can follow the same steps as if your partition is no longer hosting your system.

Top Tip: It’s important to note that this process is only required if you want to extend the system partition. In other cases, you can resize the partition directly from your Ubuntu session (as discussed previously).

How To Resize And Expand Ubuntu Partitions Using Command Line

If you’re comfortable with using the Terminal, you can also resize and expand Ubuntu partitions using Command Line. 

Here’s how:

  1. Ensure that the partition isn’t mounted

    Type the following command and adjust the parameter to fit your partition name:
    Easily Resize And Expand Ubuntu Partitions On A Raspberry Pi
    This will unmount the partition so you can safely modify it.
  2. Open fdisk to make changes to the partition table

    Easily Resize And Expand Ubuntu Partitions On A Raspberry Pi
    This will open the fdisk utility, which lets you manage partitions on your disk.
  3. Delete the corresponding partition

    Easily Resize And Expand Ubuntu Partitions On A Raspberry Pi
    Type the corresponding number (in this example, it’s “1”). If you have multiple partitions, adjust the number accordingly. Remember, this won’t format your disk’s content, it’ll just delete the partition so you can create a new one.
  4. Create a new partition:
    Easily Resize And Expand Ubuntu Partitions On A Raspberry Pi
    Follow the prompts to create a new partition. You can either keep the default size or set the new partition size by using something like “+12GB” for the sector.
  1. Check that the new partition table is correct

    Easily Resize And Expand Ubuntu Partitions On A Raspberry Pi
    This will display the new partition table. Make sure it’s what you wanted.
  2. Write the changes to your hard disk

    Easily Resize And Expand Ubuntu Partitions On A Raspberry Pi
    This will save the changes you made to the partition table.
  3. Resize the file system to fit the new partition size

    Easily Resize And Expand Ubuntu Partitions On A Raspberry Pi
    This command will resize the file system to fit the new partition size.
  4. Mount your partition

    Easily Resize And Expand Ubuntu Partitions On A Raspberry Pi
    You have now mounted your partition and can start using it with the new size.

And with that, you’ve successfully finished the process to expand Ubuntu partitions from the Terminal.

buy raspberry pi accessories

Key Takeaways

After going through my guide, you should now be able to resize and expand Ubuntu partitions to accommodate your growing data needs. 

Here are some important highlights to remember:

  • Before attempting to expand your partitions, it’s essential to back up your data, so you don’t lose anything in case something goes wrong.
  • When expanding system partitions, it’s recommended to boot into a Live-USB key to safely unmount the partition.
  • To expand your Ubuntu partitions, you can use either the graphical method or the command line method.
  • When using the graphical method, you can use tools such as Gparted to resize and expand Ubuntu partitions.
  • If you choose to use the command line method, you need to boot into a live USB key and use tools such as “fdisk” and “resize2fs” to resize and expand your partitions.
  • It’s essential to ensure that the partition you’re resizing is not mounted to prevent data corruption or loss.
  • Finally, always make sure to double-check your work and ensure that everything is working correctly before closing the terminal or shutting down your computer.

As someone who has experienced data loss due to a failed partition expansion attempt, I cannot stress enough the importance of backing up your data before attempting any changes. 

It’s also crucial to follow the steps carefully, especially when using the command line method, to prevent any irreversible damage to your system. Remember, it’s always better to be safe than sorry!

If you would like to see a video walkthrough on expanding Ubunti partitions, be sure to check out this clip from SavvyNik.

Erik D

Leave a Comment

Your email address will not be published. Required fields are marked *