Logo Linux Bash SSH Ubuntu Git Menu
 

Extend ext4 during runtime

I am using a VMMware client and running a Debian 6.0 instance. I am running out of disk space.

Is it possible to extend the ext4 filesystem while the instance is running? I cannot reboot due to critical services running on it and the filesystem nearly out of space.

like image 544
Sudeep Avatar asked May 03 '26 13:05

Sudeep


2 Answers

You didn't really give much to work with, but if you're using LVM this isn't terribly difficult. The 'lvextend' command increases the space available to your partition. Here's I'm adding 10GB to my HomePart logical partition on my TeraStor volume

lvextend -L+10G /dev/TeraStor/HomePart

And then you resize the partition:

resize2fs /dev/TeraStor/Homepart
like image 141
Magellan Avatar answered May 06 '26 02:05

Magellan


Growing the disk in VMware will not do what your expecting. Expanding the drive will grow the size of the disk, BUT the partitions on the disk don't grow with it.

If your system is using LVM, adding the new space and growing the file system is fairly easy.

  1. grow the drive in vmware
  2. create a new LVM partition in the new space
  3. add it to the LVM volume group
  4. add space to the logical volume
  5. expand the file system.

If you are not using LVM your going to have to figure out how to expand the partition without losing data while the server is running. Not something I recommend doing. My recently re-installed DB server will back me up on that. :-)

No matter what the setup, your playing with your server's disks and file systems while it's live. Things can go wrong, make sure you have a working backup ready.

like image 27
David Avatar answered May 06 '26 03:05

David