LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Can you expand a HDD on an online Linux VM? (https://www.linuxquestions.org/questions/linux-newbie-8/can-you-expand-a-hdd-on-an-online-linux-vm-4175472646/)

pwjohnston 08-08-2013 10:24 AM

Can you expand a HDD on an online Linux VM?
 
On Windows (yes I know I’m not making any friends by saying that) since at least 2008, you have been able to expand a disk on a running virtual machine in VMware (or any other virtualization software / SAN LUN) and then expand the disk/volume within Windows without needing downtime/maintenance.

We have SLES 11 VM’s with ext3 partitions in their LUNs that were set up before I took this job. I’m sure that there has to be a way to do this you can do practically anything in Linux that Windows can do. Is this possible with ext3, do I need to be using ext4, LVM, BTRFS, I don’t know. I keep searching for this on the web and as soon as I think I’ve found the answer there is a “now, reboot the virtual machine” in it. Sorry I don’t have as much Linux experience as I do in Windows and the Sr Engineer seems to be unaware that this is even possible.

I'm getting ready to test this:
http://raftaman.net/?p=228

But if anyone has a better way, I'd love to read up on it.

Ser Olmy 08-08-2013 10:44 AM

Expanding a physical device shouldn't be a problem. At worst you may have to rescan the SCSI/SAS/SATA bus to detect the change.

Expanding partitions is another matter. If the partition is at the end of the disk, then you just edit the partition table and expand the file system afterwards. If the partition is between other partitions, then you're out of luck (just as you would be with Windows).

The blog post you linked to just details how you edit the partition table by simply deleting the old partition and then creating a new, larger partition starting at the same sector as the old one. If you're worried about making a mistake, back up the partition table with dd before you start.

LVM is generally a good idea, but there's no need to set up LVM inside a VM. Just stick to single-partition virtual disks, and you will always be able to add space as needed.

pwjohnston 08-08-2013 11:15 AM

Quote:

Originally Posted by Ser Olmy (Post 5005655)
Expanding a physical device shouldn't be a problem. At worst you may have to rescan the SCSI/SAS/SATA bus to detect the change.

Expanding partitions is another matter. If the partition is at the end of the disk, then you just edit the partition table and expand the file system afterwards. If the partition is between other partitions, then you're out of luck (just as you would be with Windows).

The blog post you linked to just details how you edit the partition table by simply deleting the old partition and then creating a new, larger partition starting at the same sector as the old one. If you're worried about making a mistake, back up the partition table with dd before you start.

LVM is generally a good idea, but there's no need to set up LVM inside a VM. Just stick to single-partition virtual disks, and you will always be able to add space as needed.

That seems reasonable. I'll give it a try thank you!

szboardstretcher 08-08-2013 11:30 AM

I always set up LVM. That way, in Xen/VMware, you add a disk, let the OS detect it, add it via LVM. Done. Makes growing specific partitions a cinch. And snapshot backups...

I wouldn't discount LVM.

pwjohnston 08-08-2013 02:14 PM

Quote:

Originally Posted by szboardstretcher (Post 5005681)
I always set up LVM. That way, in Xen/VMware, you add a disk, let the OS detect it, add it via LVM. Done. Makes growing specific partitions a cinch. And snapshot backups...

I wouldn't discount LVM.

Yeah, that was the direction I was going next. I’ve used LVM a little in the past and one of the VMware KB suggested it (kb.vmware.com/kb/1006371‎) I just have not worked with it enough to know. My point of reference is the Netapp filers. If you set an Aggregate pool and then you set up volumes inside you can later grow it if you run out of space. I have only used LVM on bare metal machines and didn’t know if I could grow the LV after it has been allocated.

Of course, then something blew up in the data center so my test will have to wait.

Ser Olmy 08-08-2013 07:43 PM

Quote:

Originally Posted by szboardstretcher (Post 5005681)
I always set up LVM. That way, in Xen/VMware, you add a disk, let the OS detect it, add it via LVM. Done. Makes growing specific partitions a cinch. And snapshot backups...

I wouldn't discount LVM.

LVM on the storage system (or hypervisor, if storage is local) is a great idea for all the reasons you mention and a few more (thin provisioning). On the VM itself, however, it may not be necessary or even a good idea (LVM in LVM).


All times are GMT -5. The time now is 11:48 PM.