How To Resize Or Extend a Partition in Linux/Ubuntu (GUI & Commands)

Here you can learn how to safely resize the Linux/Ubuntu partitions without losing data via GUI & command line.

ubuntu partitions editing

Regardless of your operating system, you may need to reallocate the space to your existing partitions at any point. The resizing complexity may vary with the running OS. For instance, resizing Linux partitions might be tricky if you aren't tech-savvy.

Part 1. Are Ubuntu and Linux The Same?

To differentiate between Ubuntu & Linux often seems confusing to beginners, as they perceive both operating systems as the same. Contrarily, Ubuntu is a distribution of the Linux operating system. For further demonstration, a distribution can be considered a customized version of Linux OS that comprises a collection of pre-installed packages & applications.

linux vs ubuntu

Part 2. Is It Safe To Resize Partition Linux?

Many Linux users who intend to resize the ubuntu partitions are concerned over the security perspective associated with Ubuntu expand partition methods. So, if you're in the same boat, there is no need to worry; resizing Linux partitions can be totally safe by adopting the appropriate resizing strategies. But still, to ensure the safe resizing of the ubuntu partition, you can take a backup of your important before performing any operation. You can use a reliable backup tool like Ubackit to best serve your backup-related needs in this connection.

Part 3. How to Resize a Partition in Linux/Ubuntu with Built-in Tools?

Linux operating system comes with built-in utilities like Fdisk to manage hard drive partitions, which you can launch using GNOME Terminal. Here are the detailed procedures for resizing or expanding your partitions in Linux using these CMD-based tools.

Fdisk

Fdisk is a built-in command-line Linux utility to manage your system partitions, with the ability to resize, delete, create, shrink, or extend Linux partitions. However, the only way to resize a partition using Fdisk is to delete the pre-existing partition and create the new one.

Important Fdisk Commands:

  • P: Print the partition table
  • D: Delete the partition
  • N: Create a partition
  • W: Save changes and exit

Operational Steps:

Step 1: Unmount the partition using the following command:

# unmount /dev/vda

Step 2: Use the following command to List the available disks in your system:

sudo fdisk -l

Step 3: Use the p command to print the partition table to determine which partition to be deleted.

use the p command in fdsik

Step 4: Now enter the d command to delete the partition; also input the number of the partition to be deleted, for example, 2.

use the d command in fdisk

Step 5: Create a new partition using the n command after deleting the partition. You can specify your partition size by defining the first and last sector or entering the human-readable size, such as +500M.

use the n command in fdisk for new a partition

Step 6: Enter the n command to keep a swap signature.

Step 7: Now, use the p command to print the partition table to check whether the changes have been made to the partition table.

print table fdisk

Step 8: If the changes are correct, use the w command to write all the changes.

w command fdisk to write changes

Step 9: Mount the partition using the following command:

# mount /dev/vda

Resize2fs

Resize2fs is not a utility but a command to resize the ext2/3/4 file system on your Linux OS. You can extend or shrink your file system, but it demands unmounting of the partition. It is important to note that resize2fs does not resize partitions but only the file systems; to resize (extend or shrink) the partition, employ Fdisk or LVM tools.

Note: If you want to expand the file system, you must first enlarge the size of that respective partition; this can be accomplished using Fdisk. On the other hand, you must shrink the partition file system using the resize2fs command if you wish to shrink its size. Also, ensure that your partition size does not go down than the required size of the ext2/3/4 file system.

Operational Steps:

Step 1: First, unmount the partition using Fdisk to enable partition-related operations; use the following command:

# unmount /dev/vda

Step 2: Use the d command to Delete the existing partition.

enter d command to delete a partition

Step 3: Create a new partition (Larger if you want to expand the file system, smaller if you want to shrink the file system) using the n command.

use the n command to create a partition

Step 4: Enter the fsck (File System Consistency Check) command to check the file system consistency. Fdisk will now start analyzing block numbers, sizes, and directory structures.

input fsck command in fdisk

Step 5: Now, use the resize2fs command to expand or shrink your file system; enter the number of blocks you want on your partition, for example, 1044192 or 1K blocks.

use resize2fs command to resize the file system

Step 6: The file system on your partition has been resized; now, remount the partition using the following command:

# mount /dev/vda

Part 4. How To Resize a Partition in Linux/Ubuntu Using GUI Tools

Resizing your partition via GUI tools in Ubuntu is relatively straightforward and safe. For this, you might need some sort of expert assistance. So, We have presented how to use GParted and KDE Partition Manager to shrink or extend your Linux partitions.

Ubuntu Resize Partition Using GParted

GParted is a GUI-based program in Linux operating systems that allows you to manage the hard drive partitions in just a few clicks. You can resize, delete, create, extend, or shrink your system’s partitions conveniently and straightforwardly using GParted.

Note: You can’t perform any operation on the partition if it’s in use; a partition in use (Active partition) has a key sign next to it. If your partition is mounted, unmount it by right-clicking and choosing the Eject option.

Operational Steps:

Step 1: Install GParted from Ubuntu Software Centre or using the “sudo apt install gparted” terminal command.

gparted installation via Ubuntu software centre

Step 2: Launch GParted from the Dash to access its main interface.

launch gparted from dash

Step 3: If your system has multiple hard drives, select the one from the top right corner at the main window to perform any partition-management operation. (Skip this step if your system has only one drive.)

select drive in gparted

Step 4: To resize a partition, right-click it and choose the Resize/Move option.

choose resize option in gparted

Step 5: In the slider window, drag the slider to adjust your partition size; you can also enter the exact size in numbers in the box given under the slider.

move the slider in gparted

Step 6: Your changes won’t apply immediately; each operation you perform is queued and appears at the bottom of the window.

queued operations in gparted

Step 7: Click the green Tick option to apply all the changes.

click the tick mark in gparted

Step 8: A window will warn you against data loss; if you have backed up your data, click Apply to make the changes.

warning window in gparted

Ubuntu Resize Partition Via KDE Partition Manager

KDE Partition Manager is a utility that you can use for Linux extend partition, partition resizing, formatting, deletion, and creation. The interface is user-friendly and interactive as of GParted, supporting various file systems, including NTFS, FAT16/32, exFAT, XFS, JFS, ext2/3/4, and so on. 

Operational Steps:

Step 1: Install KDE Partition Manager by entering the “sudo apt-get install partitionmanager” command in GNOME Terminal and launch to access its interface.

kde partition manager interface

Step 2: Right-click on the partition you intend to resize and click on the Resize/Move option from the dropdown menu.

resize partition via kde partition manager

Step 3: KDE Partition Manager will lead you to the resize wizard with the Partition Slider. You can drag the slider to resize the partition or enter the exact size you want in the Size Box under the slider.

partition slider in kde partition manager

Step 4: All the operations will appear in the form of a list in the main window; click the Apply option at the top to save all the changes you made.

pending operations in kde partition manager

Step 5: KDE will start resizing your partition, which will take some time; after finishing all the operations successfully, click OK and get back to the main interface.

operation finishing in kde partition manager

Part 5. What To Do If The Data Get Deleted Mistakenly While Editing a Partition Table?

In the first attempt of the Ubuntu expand partition, you are at risk of mistakenly deleting your data from the targeted partition. So, unfortunately, if you have been sunk in a similar scenario, then this isn't a thing to panic over; rather, you must find a way to restore your deleted data. Therefore, Recoverit Data Recovery is a highly reliable data recovery tool that can recover all your lost data from the Linux operating system with a little effort.

Why we recommended using Recoverit?

Users always rely on a data recovery tool that is considered the best choice. Recoverit is a highly-rated and worldwide recognized tool to efficiently recover unlimited files lost in multiple data loss scenarios. You can conveniently use it on any operating system to meet data recovery needs on all scales.

To recover your lost data on Linux operating system, you need to follow the below-stated instructions:

Video Tutorial on How to Recover Files on Linux?

Free Download

For Windows Vista/7/8/10/11

Free Download

For macOS X 10.10 or later

Operational Steps:

Step 1: Launch the App & select Linux Recovery

  • Download & install the Wondershare Recoverit application on your Linux operating system.
  • Launch the Recoverit application.
  • Select NAS and Linux option from the left panel and click on the Linux Recovery button.
recoverit nas and linux recovery

Step 2: Connect the Linux system

Fill in the accurate information in the required fields to establish a remote connection, and then click on the Connect button.

connect linux system in recoverit

The Recoverit will automatically start the scanning process once the connection establishes successfully.

recoverit scanning process

Step 3: Preview & recover your lost files

  • You can preview the files upon completion of the scanning process.
  • Then select the recoverable files and click on the Recover button.
recoverit file preview and recovery
  • Now you must select a path to save your restored fields on the computer. Proceed by hitting the Recover button.
select the path to save files

FAQs

Although Ubuntu and Windows are two different operating systems, you can still resize a Ubuntu partition from Windows if your computer system is dual-boot.

Resizing a partition indicates both the increasing and shrinking process, so if you resize your partition in terms of expansion, it won't affect your data; contrarily, the partition shrinking process may delete the data in various cases.

Resizing the Linux partition is safe if you accurately perform the resizing process. However, taking a backup of your important data is suggested before editing or resizing the partitions to avoid data loss risks.

Conclusion

Various Linux users often interrogate how to increase Linux partition size, especially in the Ubuntu distribution. Because resizing a Linux partition is a relatively tough chore. Therefore, to ease out this resizing process, here we have presented a detailed explanation of how you can increase or shrink your ubuntu partition size in different ways.

Free Download

For Windows Vista/7/8/10/11

Free Download

For macOS X 10.10 or later

You May Also Like

How To Remove Files or Directories Recursively in Linux

Here are the steps to recursively remove files or directories/folders in Linux

How To Use Foremost to Recover Files on Linux and Its Alternative

Here’s how to install and use Foremost to recover data in Linux and its best alternative.

How To Install and Use TestDisk on Linux and Its Alternative

Detailed here are the ways to install and use the TestDisk Linux data recovery tool, plus its alternative.

Top 10 Linux Partition Recovery Tools

Restore your deleted or lost data with the 10 best Linux partition recovery software.

How to Recover Deleted Files from Linux Partition?

Try these tested and proven methods to recover deleted files from Linux partitions.