Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
I found this article kb.vmware.com/selfservice/microsites/… 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
add comment

3 Answers 3

up vote 1 down vote accepted

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.
share|improve this answer
    
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
add comment

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

share|improve this answer
    
It's Ubuntu Server. I'm trying GParted now, thanks! –  dannymcc Nov 27 '12 at 23:09
add comment

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.

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.