1. Introduction
When using Ubuntu, you may encounter situations such as “running out of disk space” or “not being able to install new applications due to a lack of free storage.” In such cases, a useful solution is partition expansion. Partition expansion is the process of increasing the size of an existing disk partition in order to use storage space more efficiently.
Ubuntu is widely used for both server and desktop purposes, and partition management is often required in various environments such as virtual machines, VPS (Virtual Private Servers), and dual-boot systems. However, many users feel uncertain, wondering “Which method should I use?” or “Will I lose my data if I make a mistake?”
This article explains partition expansion on Ubuntu as clearly as possible, from simple procedures to advanced examples in LVM and virtualized environments. Since partition operations involve important risks, we also cover preparation steps and key points for performing the task safely.
This guide is designed to be helpful for a wide range of users, from beginners who are new to Linux command-line operations to intermediate users who have previously worked with partitions on other distributions.
Partition expansion requires careful handling, but by following the correct steps, you can protect your important data while making effective use of your storage capacity.
2. Prerequisite Knowledge for Partition Expansion
Before expanding partitions on Ubuntu, understanding some basic concepts will help prevent mistakes and issues. This section explains the fundamentals of partitions and file systems, whether LVM is in use, and current trends in Ubuntu partition layouts.
2.1 What Is a Partition?
A partition is a mechanism that divides a physical storage device such as a hard disk or SSD into multiple virtual sections. For example, a single disk can be divided into areas for the system, user data, and swap space, each treated as an independent region. Ubuntu system files, user data, and swap space are often separated into different partitions.
2.2 Types of Partition Tables (GPT and MBR)
There are two main methods for recording disk partition layouts: GPT (GUID Partition Table) and MBR (Master Boot Record).
- MBR: An older format that supports disks up to 2TB and allows up to four primary partitions.
- GPT: A newer format that supports disks larger than 2TB and more than 128 partitions. GPT is now the standard in modern Ubuntu systems.
If you are unsure which format your system uses, you can check with commands such as sudo parted -l.
2.3 Whether LVM (Logical Volume Manager) Is Used
In Ubuntu, partitions can be expanded either directly or by using LVM (Logical Volume Manager), which provides flexible volume management.
- Without LVM (standard partitions)
A common setup where a file system such as ext4 is created directly on a partition. - With LVM
A structure where physical volumes (PV) are created on disks, combined into volume groups (VG), and then divided into logical volumes (LV). This approach allows flexible resizing and is widely used in server and cloud environments.
The steps for partition expansion differ depending on whether LVM is used.
2.4 Typical Partition Layouts in Ubuntu
During Ubuntu installation, you can choose whether to use LVM. In recent server environments (especially Ubuntu 20.04 and later), LVM is often recommended or used by default.
On the other hand, desktop installations and dual-boot systems frequently use simpler layouts with a single ext4 partition.
2.5 Important Notes Before Expanding Partitions
Before performing partition expansion, there must be unallocated space available on the disk. Depending on disk layout and partition positioning, expansion may not be possible. Always check the current disk configuration using commands such as lsblk or parted.
Additionally, it is strongly recommended to back up important data in advance. If data loss occurs due to mistakes or unexpected issues, having a backup will allow you to proceed with confidence.
3. Partition Expansion Methods by Environment
The procedure for expanding partitions on Ubuntu varies depending on the environment and disk configuration. This section explains four common scenarios: non-LVM environments, LVM environments, online expansion in VPS or cloud systems, and dual-boot environments.
3.1 Expanding Partitions in Non-LVM (ext4) Environments
This is the most common case, where a file system such as ext4 is created directly on a partition without using LVM.
- Increase the disk size
- For virtual machines or VPS, increase the disk size from the management console.
- For physical PCs, ensure that unallocated space is available.
- Expand the partition
- Use
sudo partedorsudo fdiskto expand the target partition. - With parted, you can use commands like the following (example: expanding /dev/sda1):
sudo parted /dev/sda (parted) resizepart 1 <new end position (e.g., 100%)>
- Expand the file system
- After expanding the partition, you must also expand the file system.
- For ext4, run the
resize2fscommand:sudo resize2fs /dev/sda1 - This applies the new space to the file system.
- Verify the expansion
- After completion, use
df -hto confirm the increased disk capacity.
3.2 Expanding Partitions in LVM Environments
When using LVM, disk space can be expanded more flexibly.
- Increase the disk size
- First, expand the physical or virtual disk.
- On physical disks, ensure unallocated space is available.
- Resize the Physical Volume (PV)
- Make the newly added space available to LVM:
sudo pvresize /dev/sda2 - (Device names vary depending on the environment.)
- Extend the Logical Volume (LV)
- Specify the logical volume to expand:
sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv -l +100%FREEallocates all available free space.
- Expand the file system
- If ext4 is used, expand it with
resize2fs:sudo resize2fs /dev/ubuntu-vg/ubuntu-lv
- Verify
- Check the results with
df -horlsblk.
3.3 Online Expansion in VPS and Cloud Environments
In VPS or cloud environments, it is often desirable to expand partitions without rebooting the server. The growpart command is useful in such cases.
- Expand the disk size
- Add disk capacity through the provider’s management console.
- Expand the partition using growpart
- If the cloud-utils package is installed, you can use
growpart:sudo growpart /dev/sda 1 - This automatically expands the partition (e.g., /dev/sda1).
- Expand the file system
- Then expand the file system with
resize2fs:sudo resize2fs /dev/sda1
- Verify
- Confirm the expansion with
df -h.
3.4 Adjustments in Dual-Boot (Windows / Ubuntu) Environments
When Windows and Ubuntu are installed on the same disk, expansion may not be possible if unallocated space is not adjacent to the Ubuntu partition.
- Move unallocated space
- Use Windows partition tools (such as MiniTool Partition Wizard) to move unallocated space next to the Ubuntu partition.
- Expand from Ubuntu
- Follow the standard expansion steps described above.
- Backup is mandatory
- Dual-boot environments are more prone to issues, so always back up data before proceeding.
4. Troubleshooting and FAQ
Various questions and issues may arise before, during, or after partition expansion. This section summarizes frequently asked questions and typical errors with solutions.
4.1 Frequently Asked Questions (FAQ)
Q1. I cannot find free (unallocated) space. What should I do?
A. Partition expansion requires unallocated space. Use lsblk or sudo parted /dev/sda print free to check disk status. If no unallocated space exists, delete unnecessary partitions or increase the disk size in a virtual environment.
Q2. Do I need pvresize or lvextend if I am not using LVM?
A. No. These commands are only required for LVM. For standard ext4 partitions, follow the steps “expand partition → expand file system.” You can check whether LVM is used with lsblk or sudo pvs.
Q3. There is no unallocated space adjacent to the partition. Can I still expand it?
A. Partition expansion requires adjacent unallocated space. If it is located elsewhere, adjust partition order or position using tools such as MiniTool Partition Wizard. Always back up data before modifying partitions.
Q4. Is it safe to modify partitions while Ubuntu is running?
A. System partitions (such as /) or mounted partitions may not be expandable while in use. If possible, boot from a live USB and perform the operation. Many cloud and VPS environments allow online expansion, but temporary unmounting or rebooting may be required if errors occur.
Q5. The swap partition is blocking expansion. What should I do?
A. Temporarily disable swap using swapoff, remove the swap partition, perform the expansion, and recreate swap afterward if necessary. Update /etc/fstab accordingly.
Q6. I increased disk size in a virtual environment, but the OS does not recognize it. Why?
A. After expanding the disk in the hypervisor (VMware, VirtualBox, etc.), the OS must rescan the device. Use commands such as:echo 1 > /sys/class/block/sdX/device/rescan, reboot the system, or run partprobe.
Q7. What is the difference between GPT and MBR, and which should I choose?
A. GPT supports disks larger than 2TB and many partitions, and is recommended for modern systems. Choose MBR only if compatibility with older systems is required.

4.2 Common Errors and Solutions
- “no free space available”
→ Adjacent unallocated space is required. Adjust partition positions and retry. - “device is busy” or “resource busy”
→ The partition is mounted or in use. Unmount it or use a live USB. - “The partition is currently in use”
→ The target partition is active. Stop related services or reboot and retry. - “resize2fs: Bad magic number in super-block”
→ Verify the file system type. For XFS, usexfs_growfsinstead ofresize2fs.
5. Post-Execution Checks and Summary
After completing partition expansion, always verify the results to ensure there are no issues caused by mistakes or unexpected problems.
5.1 How to Verify Expansion Results
(1) Check disk usage
Use df -h to display usage and available space for mounted partitions. Confirm that the expanded partition shows the expected increase.
df -h(2) Check partition layout
The lsblk command displays storage devices and partitions in a tree format, allowing you to verify sizes and layout.
lsblk(3) Detailed check with parted
Commands such as sudo parted /dev/sda print free provide detailed information about partition tables and unallocated space.
(4) Additional checks for LVM
If using LVM, confirm volume group and logical volume sizes with sudo lvs and sudo vgs.
5.2 Post-Operation Considerations
- Managing backup data
If the expansion was successful and the system is stable, temporary backups may be cleaned up. If you have concerns, keep backups for a while longer. - File system checks
For added safety, consider running a file system check usingfsck.
sudo fsck /dev/sda1(Run only after unmounting the partition.)
- Reboot requirements
In most cases, a reboot is not required. However, in some virtual or physical environments, rebooting ensures the OS fully recognizes the new disk size.
5.3 Summary
Partition expansion on Ubuntu can be performed smoothly by following proper preparation steps and correct procedures. Always back up data in advance and verify results carefully to handle unexpected issues with confidence.
Partition and storage management are essential tasks for both system administration and everyday use. We hope this article helps you effectively manage disk space in your Ubuntu environment.


