Lothar Kruse's picture

Hello, I have installed a TURNKEY LAMP that is about 7 years old. The system was set up once by another administrator. I'm not a Linux expert myself ...
The TURNKEY is installed as a virtual machine.
Unfortunately, the data hard drive is now full. I shut down the server and expanded the virtual hard drive. But how can I expand the Linux data partition and allocate the new storage space? I would be very grateful for any help!

Jeremy Davis's picture

Something of note for starters, this server would no longer be getting security updates. If it's running on a local network and isn't available via the internet, then that's possibly not an issue. If it is accessible via the internet, then you should be planning on how you might go about bringing it back up to date. If you want/need a hand with that, please let me know and also share the output of the following command:


Regarding your question, there is actually a (really old) blog post that covers this. If you want the background so you can understand what is going on and how it works, then start at the start. If you just want to extend the free space and move on, then scroll down to the heading "Extending a Logical Volume".

As you've already added more space to the virtual hard-drive, you want to follow 'example #2'. I.e.:

Create a new partition (this assumes the new partition will be '/dev/sda3' - which it probably will be) and add it as a "physical volume". Then add the new "physical volume" to the "volume group" 'turnkey' (which is the default "volume group"):

cfdisk /dev/sda  # creating /dev/sda3 (you may need to reboot before you can see this)
pvcreate /dev/sda3
vgextend turnkey /dev/sda3

Then increase the "logical volume" 'turnkey/root'. The following assumes you want to increase the size by 10GB (change the '10G' to a relevant value):

lvextend -L+10G /dev/turnkey/root

Then finally resize the filesystem:

resize2fs /dev/turnkey/root

Hopefully that all "just works" and you are now good to go! If you hit any issues and/or want to explore upgrade/migration please post back.

Add new comment