The Web

How To Increase Root Partition Size on Ubuntu

I have an Ubuntu VM that is running low on root partition lately. And here is what I did to increase it without reinstalling the system.

First, expand the virtual disk to get more space ready for the system.

Once the system boots up, turn off swap.

sudo swapoff /dev/sda5

Fire up cfdisk, then

  • Use Delete to remove the logical partition (/dev/sda5) and the extended partition (/dev/sda2)
  • Use Delete to remove the primary partition (/dev/sda1) – don’t worry, the change hasn’t been written to the disk until you choose to later on.
  • Use New to create a new primary partition (/dev/sda1). Make sure the start cylinder is exactly the same as the old /dev/sda1 and the new end cylinder to include expanded space minus space you need for the swap.
  • Use to toggle the bootable flag on the new primary partition (/dev/sda1).
  • Use W to write the new partition table to the disk after reviewing the change.

Reboot (sudo reboot).

Once booted, there will be a smaller system living inside a larger partition. Use the following magic command to make the file system to take all available space.

sudo resize2fs /dev/sda1

That’s it. Hope it helps.

edge

Share
Published by
edge
Tags: Ubuntu

Recent Posts

Disable Copilot on Windows 11 via Group Policy GPO

If using Copilot right from the Taskbar isn't your thing, you should disable it. Even…

2 weeks ago

Setting Default Fonts in Word, Excel, Outlook, and PowerPoint via Group Policy

In an environment where standardizing things does matter, setting default fonts in Microsoft Office apps…

1 month ago

Wake-On-LAN (WOL) with Windows and PowerShell

Wake-On-LAN is a networking standard that lets you wake up a computer from either a…

1 month ago

How To Remove Restrictions Set in A Password-Protected PDF File

First of all, this is not to bypass a PDF file that requires a password…

2 months ago

How To Move My Outlook Navigation Bar Back From Left Back To the Bottom

Microsoft has been lurking about the idea of placing the Outlook navigation bar to the…

1 year ago

Headset with Microphone Echoing My Own Voice on Windows, What To Do?

One colleague came up to me the other day asking me to take look at…

1 year ago