VMware Cloud Community
JonasHolm
Contributor
Contributor

How to expand harddrive online on Ubuntu VM

Hi

Im trying to dokument a method for expanding the storage on a Ubuntu VM but I hit a little bump in the road.

I can change the size of the harddrive in the vm but how can I get the OS to know tat the drive got bigger.

I'm planning to use LVM to manage te storage and extend the physical volume and the expand the logical volume, but I can't get the OS to know that the drive is expanded unless I reboot the OS and that's not what I want to do.

I have had no luck with the command rescan-scsi-bus.sh

I refuse to accept that Windows 2003 does a better job of handling expandning of drives than Linux... It can't be...

Please prove me wrong...

Best regards

Jonas

0 Kudos
5 Replies
jbruelasdgo
Virtuoso
Virtuoso

why do not you try gparted?

regards

Jose Ruelas

Jose B Ruelas http://aservir.wordpress.com
0 Kudos
jbruelasdgo
Virtuoso
Virtuoso

type sudo gparted

Jose B Ruelas http://aservir.wordpress.com
0 Kudos
Texiwill
Leadership
Leadership

Hello,

The steps are:

0) BACKUP your VM

1) BACKUP your LVM configuration (vgcfgbackup)

2) Add new space to existing VMDK or add an additional VMDK

3) Add a new partition to encompass the added space using gparted/fdisk, if this is the 'boot' volume you may have to reboot.

4) Use LVM tools (lvextend,vgextend) to include the new space into the logical volume


Best regards, Edward L. Haletky VMware Communities User Moderator, VMware vExpert 2009, DABCC Analyst[/url]
Now Available on Rough-Cuts: 'VMware vSphere(TM) and Virtual Infrastructure Security: Securing ESX and the Virtual Environment'[/url]
Also available 'VMWare ESX Server in the Enterprise'[/url]
[url=http://www.astroarch.com/wiki/index.php/Blog_Roll]SearchVMware Pro[/url]|Blue Gears[/url]|Top Virtualization Security Links[/url]|Virtualization Security Round Table Podcast[/url]

--
Edward L. Haletky
vExpert XIV: 2009-2023,
VMTN Community Moderator
vSphere Upgrade Saga: https://www.astroarch.com/blogs
GitHub Repo: https://github.com/Texiwill
0 Kudos
JonasHolm
Contributor
Contributor

Doesn't that method demand that I dismount the filesystem? have to do this without dismount and without reboot of the server.

I'm looking for a "Best Practise" method to expand a linux filesystem in a vmware environment which is a little different from the non virtual world...

Is lvm the way to go?

Should I create a new harddrive instead of expanding the one I have and then put the new drive in the LVM-group?

What I'mafter is some crude version of thin provisioning so that I don't have to create a big harddrive from start that never will be used if the system owner have overestimated the needed space for the system.

/Jonas

0 Kudos
darkdragon001
Enthusiast
Enthusiast

I'm having the same problem. After some research, I found the following article:

http://echenh.blogspot.com/2010/04/how-to-extend-lvm-on-vmware-guest-os.html

Because I already rebooted, I cannot say, if you need a reboot to let "fdisk -l" recognize the new size.

There was the following warning:

"WARNING: Re-reading the partition table failed with error 16: Device or resource

The kernel still uses the old table. The new table will be used at

the next reboot or after you run partprobe(8) or kpartx(8)"

I rebooted, but perhaps, it works with one of the two commands without rebooting.

Hope, this article helps you!

0 Kudos