Linux Mint VMWare VM – Resize Hard Drive

It took me a while to figure out how to resize a hard drive on a Linux Mint 17.x VM running under VMWare.  Basically it’s a mashup of instructions I found online for resizing drives in Ubuntu and LVM guides.

My Linux Mint 17 installation isn’t very special.  I basically ran through the default FDisk setup steps and put everything in one partition, the main drive.  Mint ended up creating a boot partition and an extended partition with a logical LVM partition containing all the drive data.  I don’t have a picture of this from GParted but it looks like 2 partitions as I described.

My version of VMWare (7.1.x) doesn’t recognize Linux Mint so I created it in VMWare as an Ubuntu 14 machine.  I try to avoid too much customization of the VMWare instance since it’s not Ubuntu, it’s Mint.

You will need:

  • Linux Mint 17.x VM running under VMWare
  • Linux Minut 17 installation ISO

I tried to use GParted to finish the steps but I wasn’t able to specify all the needed information for the new partition, so I ended up going with FDisk.  FDisk provides low-level disk partition operations so be careful, you can nuke your installation!  Here are the steps:

  1. Power down the Linux Mint VM.  Use the Linux Mint start menu/power-off.
  2. Resize the SCSI hard drive in VMWare.  Keep track of the exact size difference as you’ll want this later.
  3. Connect the CD/DVD-ROM Drive to the Linux Mint 17 ISO
  4. Set the machine to start from CD-ROM in VMWare
  5. Start the VM.  Immediately focus the window.  When it starts you can press F2 to enter the boot menu.  Choose boot option #1 to boot from the CD-ROM (ISO installation file).
  6. Linux Mint 17 Live installation will boot.  Once booted no login is required.
  7. Open a terminal in the Live boot desktop.
  8. First run gparted to verify your installation resembles mine and to get a visual picture of the partition table.
  9. sudo gparted &
  10. If things look OK in GParted then proceed with fdisk.  My installation has the primary drive mapped to /dev/sda — this might be different in your installation if you customized it or have a different version of Mint.
  11. sudo fdisk /dev/sda to start the FDisk command line.
    1. Enter command ‘q’ to abort any changes made below.
    2. Enter command ‘p’ to list partition tables.
    3. Write the start cylinders for the Extended partition (/dev/sda2 on my installation) and the Logical Partition (/dev/sda5 on my installation) on a piece of paper.
    4. Delete the logical and extended partitions.  DO NOT delete the boot partition.
      1. Enter command ‘d’ to delete a partition – choose 5 to delete /dev/sda5, for example
      2. Enter command ‘d’ to delete a partition – choose 2 to delete /dev/sda2, for example
    5. Re-create the extended and logical partitions.
    6. Enter command ‘n’ to create a partition.  Choose ‘e’ for extended partition type.  Choose 2 to create /dev/sda2.  Set the start cylinder to what you noted from fdisk ‘p’ above.  For end cylinder I used the maximum value to allocate all of the new space from VMWare.
    7. Enter command ‘n’ to create a partition.  FDisk should know you are creating a logical partition.  Choose 5 for /dev/sda5.  Now you need to choose the default start cylinder given in FDisk.  This is because the default partition type in FDisk is Linux (0x83), not LVM (0x8e).  Accept the minimum start and end values to use the maximum space.
    8. Now the twist is to reset the start cylinder.
    9. Enter the ‘x’ command to enter expert mode.
    10. First set the new logical partition type to LVM.  Enter the ‘i’ command, enter 8e for LVM.
    11. Next move the beginning of data.  Enter the ‘b’ command, then enter the start cylinder of the logical drive you noted above.
    12. Enter the ‘p’ command to verify the new table.
    13. If the changes look OK then enter ‘w’ to write the new partition table and exit.  Particularly verify that all start cylinders for the extended and logical partitions match your notes.  Also the end cylinders should be larger than before (larger HDD).  Do not proceed (enter ‘q’ and start over) if the start cylinders are different – you will probably lose your VM installation!
  12. We’re not done yet so return the Mint CLI.  Now we need to allocate the new space in LVM.  Again, be very careful with these steps!  Unlike FDisk these commands are executed immediately!  You may need to refer to for more information, however things are quite different in Mint.
  13. df -h to find the name of the volume group (mine is mint-vg).
  14. lvm to open the LVM CLI. You should see a prompt like lvm>.  Now enter these commands.
    1. vgextend mint-vg /dev/sda5
    2. lvextend -L+5G /dev/mint-vg/lv_root to extend the logical volume by 5gigabytes.  Adjust this number for the size you increased the VMWare drive.
    3. resize2fs /dev/mint-vg/lv_root to expand the filesystem in the logical volume.  You may have to run this command twice (2x) because an error is generated the first time with instructions to resolve.  Follow the instructions provided upon the first execution.  The instruction says something like execute mkfs /dev/mint-vg/lv_root first.
    4. Exit the LVM CLI.
  15. df -h to verify that all new space is allocated.
  16. Restart the VM from the Mint start menu.  VMWare should automatically unmount the cd-rom Live installation ISO, but if not then do this manually before restarting.
  17. Your Linux Mint VMWare VM should now have all the new disk space you allocated to it.

Thanks to the following links for helpful info: