One of the great benefits of virtualized infrastructure is no longer are we constrained by the physical limitations of hardware. Before where adding CPU, Memory, or Disk Space would have required a system to be taken down, virtualized infrastructure like our Virtual Cloud Servers allows for changes to disk or RAM at the touch of a button. Here we’ll show you how to utilize this to grow your Linux system’s disk on-the-fly all without ever taking your system down.
This guide was designed around CentOS procedures, but Ubuntu and other distributions should be similar.
First, you’ll need utilize the appropriate method to grow the disk size of the underlying storage for your Virtual Machine, after that’s done you should see something like the following in your system logs:
If this doesn’t happen, you may need to reboot your VM for Linux to pick up that the underlying storage device is now larger.
You just need to run two commands to grow your Linux file system, first, you’ll use
growpart to extend the appropriate partition to the new end of the underlying storage device. Second, you’ll run
resize2fs to complete online resizing of the file system.
That’s it, there’s only two commands you need to run to grow your disk space in a virtualized Linux environment. No more are the days of having to take down your system for extended periods of time waiting for a file system to be expanded.