Usually this issue happens when you have a virtual machine with minimal specs.then, you need to extend some partitions whichever partition type primary, logical ,or LVM partition. This article explains how to resize any Linux partitions specially root partition without restart.
In this scenario we expects that you increased the size of the Virtual machine instead of adding new disk. After changing the Disk size by following the virtualization software
Increase Virtual machine disk size
The detailed steps can differ from tool to another. however, you will achieve you objective by following these general steps:
- Open Virtual machine properties.
- Navigate to Disk / Storage section.
- Increase the disk size
Re-scan disk information without restart.
Operating system scan the hardware on startup. so restarting the machine will make OS detect the changes. However, in many cases restarting or powering off the OS is not an option. There for we will instruct it to reread the disk information. To scan the disk information without restart
Now, we can confirm that Linux has detected the new size. List partition information by executing lsblk command the output should be like the following image
Linux partition resize using parted
In Linux, there are many powerful tools for disk partitioning. We will use parted a modern tool which provide user friendly interaction which is parted. As the famous fdisk is a bit risky. It easy to resize the partition despite its type Physical Volume. use parted command
It might ask you to update disk GPT table to fix size mismatch, Fix it.
Then, resize the partition (in our example sda3)
List disk information
use partition editing software to extend the partition
This example uses parted that comes with OS.
# List disk information and list partition details
To extend the size of this partition
resizepart 3 100%free
in this example partition number 3 holds is physical volume of our LVM and 100% is the percentage of free space to add to partition
quit the application
List partition information
lvextend -n -l +100%free /dev/os/root
Increase XFS File System
XFS is a 64-bit journaling file system. It support parallel I/O based on allocation groups. to update the XFS system with the new size without restarting the OS just execute the following command
Increase Ext3/ Ext4 File System
Finally, after updating the file system. check the disk free space to confirm the changes.
to summarize, In this article we increased root par