2

I have a Ubuntu 12.04 VM running on VMWares ESXi 5.1.

The server (VM) itself has run out of space, the results of df -h are as follows:

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        19G   17G  1.2G  94% /
udev            490M  4.0K  490M   1% /dev
tmpfs           200M  232K  199M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            498M     0  498M   0% /run/shm

The original VM HDD size was just under 19GB which is I have now increased to 100GB within the vCenter GUI:

vCenter GIU

Is there a simple way of doing this? The VM doesn't seem to acknowledge the increase at all.

dannymcc
  • 2,677
  • 10
  • 46
  • 72
  • I found this article http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1004071 that might be of some use – smcg Nov 27 '12 at 22:14
  • Please backup your VM before doing anything to the VM. Then use any number of bootable partitioning tools available to resize the partition. – tacos_tacos_tacos Nov 27 '12 at 22:17
  • you did not tell what kind of filesystem you have – cstamas Nov 27 '12 at 22:38

3 Answers3

1

Is it Ubuntu Server or desktop?

Before doing anything make a backup of the VM..

If you have a desktop ISO boot to the live desktop, open GParted and see if the extra space is available. You can then stretch the partition in to the free space

If you don't have a desktop ISO you can boot off download Parted Magic and boot from that and use GParted from there

deveneyi
  • 284
  • 2
  • 3
1

I guess you have one big partition and all your data are on this partition this is sda1.

If this assumption is false do not proceed! (Tell me your setup: fdisk -l and I will update this answer accordingly.)

So you boot some live CD. Ubuntu LiveCD would be fine.

  1. It is always a safe bet to make backups just in case. (You can make a snapshot with vmware which you later delete if everything is fine.)
  2. So you boot some live CD. Ubuntu LiveCD would be fine.
  3. Open a terminal/shell or switch to console. If you are not root sudo bash will get you a root shell.
  4. fdisk /dev/sda
    1. Type d then 1 this will delete you partition from the partition table, but it won't touch your data.
    2. Type n then choosing the defaults is fine.
    3. Type p to see how it looks. We recreated your partition with a bigger size.
    4. Type w to write changes to disk. q exits you back to shell.
  5. resize2fs /dev/sda1 will increase the size of the filesystem.
  6. You can reboot.
cstamas
  • 6,607
  • 24
  • 42
  • Thank you, I'm in the process of trying GParted on a live CD. It seems a little difficult to not end up with unallocated space that can't be moved. If it doesn't work, I'll definitely be giving the above a try. Thanks! – dannymcc Nov 27 '12 at 23:09
  • GParted didn't do exactly what I wanted but the above answer worked perfectly first time. – dannymcc Nov 27 '12 at 23:44
  • Your process only works if there is contiguous space is available before or after partition #1. Notice that a df does NOT show a swap partition which might be located after /dev/sda1. – mdpc Nov 27 '12 at 23:45
  • @mdpc It only works if there is contiguous space *after*. If it is before then the starting block will not match and it won't work (it is unlikely, but not impossible). I guessed and it worked (see the asker's feedback) as his setup was close to defaults. He did not even say the filesystem type, but the default is ext3/ext4 (I think the latter.). – cstamas Nov 27 '12 at 23:52
0

Even though you increased the size of the vmdk file by editing the Virtual Machine settings, your Linux OS will not see that change because it is not sitting on a Logical Volume. For this, you need to setup a LVM (logical volume management).

Take a look at this diagram: http://www.tuxradar.com/files/LXF112.tut_adv.2.png

EDIT: Seems like deveneyi have provided you with a good solution. It is always a good idea to have filesystems on Logical Volumes rather than Physical Volumes.

hanes
  • 84
  • 1
  • 1
  • 4
  • Can LVM be installed/configured once the server is up and running? I.e. if it wasn't installed during the initial server install? – dannymcc Nov 27 '12 at 22:21
  • On an LVM there are several more steps required before the OS sees and would use added space. Its not automatic. – mdpc Nov 27 '12 at 23:43