Developer Cookies Blog

Increase Disk-Size on Linux

If your disk size is running out you can easily extend the disk space on virtual image on ESXi side. But if within your VM container is running Linux the increase of disk size is a little bit tricky. Below you find a checklist how you increase the disk size of a linux partition. The checklist describes an extension of /dev/sda2 on Ubuntu Linux.

  1. Make a snapshot of the VM if something goes wrong
  2. Shut down VM
  3. Increase disk size of VM on ESXi side as desired
  4. Startup VM
  5. Show mounting Point
    screenshot_df
  6. Start fdisk
    fdisk /dev/sda
  7. Select and delete 2. partition
    Important: Write down starting sector value (in our example with /dev/sda2 is the starting sector 4096) and the file system type. You will need it by partition creation in the next step.

    p
    d
    2

    screenshot_delete_partition

  8. Create new partition
    Important: First sector value and file system type has to be the same as written down in step before. Do not change anything, otherwise you are going to loose data!

    n
    2
    4096
    N
    w

    screenshot_create_partition

  9. Resize disk
    fsadm resize /dev/sda2

    screenshot_resize

  10. Restart VM
  11. Now you should have an increased partition regarding to increased disk size

Related Articles