LVM in a Virtual Environment
I have been fighting against my owncloud server the past couple of nights.
The drive is too small and I need to grow the disk. Now, I’m used to a Windows environment and this is a pretty simple task:
- Grow the disk in esxi
- Open Disk Management
- Right click, Extend
- Profit.
Easy-peesy. Even the command line in Windows is fairly straight forward:
diskpart
list partitions
select partition #
extend
(Online resizing of boot/system partitions arrived with Server 2008.)
Not so much in Ubuntu. Now, I’m also dealing with LVM which adds annoyances and I’m left to wonder, “Why am I even using LVM in a virtual environment?” I’m late to the game figuring this stuff out. I’ve found other posts that share my sentiment.
I did some mucking around with a desktop version of 15.04. I think my final choice will be to move the swap to a file (which I will name pagefile.sys just to annoy anti-Microsoft fans), then delete the swap partitions. This will allow me to have a single partition and resize it more easily:
- Grow disk in esx
- resize the partition with parted*
- reboot**
- resize the filesystem with resize2fs*.
I’m not finding anything that says I can get rid of LVM volumes and convert them to a partition scheme. Unfortunately, I’ll probably end up with a rebuild.
*I resized the partition while mounted with parted. It gave me a warning but it did work.
**I read somewhere that I’d need to reboot after resizing the partition if I did that while it’s mounted. I didn’t test to see if it was necessary.
This page was very useful for changing between a swap partition and swap file.