How to Resize Partitions in Ubuntu

  • Post category:Ubuntu

Resizing partitions in Ubuntu can help you optimize disk space and manage your storage more efficiently. Whether you want to expand a partition or shrink it, this guide will walk you through the process using both graphical and command-line methods.

Method 1: Using GParted (Graphical Interface)

Step 1: Install GParted

If GParted is not already installed on your system, you can easily install it by opening a terminal and running:

sudo apt install gparted

Step 2: Open GParted

Once installed, launch GParted from your applications menu.

Step 3: Select the Drive

In GParted, use the dropdown menu in the top-right corner to select the drive that contains the partition you want to resize.

Step 4: Identify the Partition

Locate the partition you wish to resize in the graphical interface.

Step 5: Resize/Move the Partition

  • Right-click on the partition and select Resize/Move.
  • Adjust the size by dragging the arrows or entering a specific size in MiB.

Step 6: Apply Changes

After making your adjustments, click on the green checkmark button to apply the changes. Confirm any prompts that appear.

Method 2: Using Command Line (parted)

Step 1: Open Terminal

Press Ctrl + Alt + T to open a terminal window.

Step 2: List Partitions

Use lsblk or sudo fdisk -l to list your partitions and identify the one you want to resize.

Step 3: Start Parted

Launch parted on your target disk (e.g., /dev/sda) by running:

sudo parted /dev/sda

Step 4: Resize the Partition

  • First, check the current partitions with:
  print
  • To resize a partition, use:
  resizepart <partition_number> <new_end>

For example, to resize partition 1 to end at 50GB, run:

  resizepart 1 50GB

Step 5: Exit Parted

Type quit to exit parted after resizing.

Important Notes

  • Unmounting Partitions: Ensure the partition is unmounted before resizing. In GParted, right-click on the partition and select Unmount.
  • Backup Data: Always back up important data before resizing partitions, as there is a risk of data loss.
  • Live Environment: For system partitions (like root), it’s often safer to use a Live USB session of Ubuntu to perform resizing operations.

Conclusion

By following these steps, you can effectively resize partitions in Ubuntu using either a graphical interface with GParted or command line tools with parted. Proper partition management can enhance your system’s performance and help you utilize disk space more efficiently. For more tips and guides on Ubuntu, check out other articles on CodeAllow.