Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
PhoneBoy
Admin
Admin

Resizing Disk After Increasing Disk Size in VMware

I had originally set up a VM with a much smaller disk and decided to increase it in VMware, which of course you do when the VM is powered off.
Unfortunately, you have to do a little work to get the system to recognize it and use it.

The following is what I was able to work out with some Googling.
I tested this on R77.30 and it should work on later releases (though specifics may differ).
However, this is an unsupported procedure, so take backups, do this at your own risk, etc.

After you've resized the disk container in VMware with the VM powered off, you have to resize the partition in Gaia.
You do this by deleting and re-adding the partition using fdisk:

[Expert@R7730:0]# fdisk /dev/sda

The number of cylinders for this disk is set to 26108.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sda: 214.7 GB, 214748364800 bytes
255 heads, 63 sectors/track, 26108 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          38      305203+  83  Linux
/dev/sda2              39        1082     8385930   82  Linux swap / Solaris
/dev/sda3            1083       16709   125523877+  8e  Linux LVM

The Linux LVM partition is the one we want to delete:

Command (m for help): d
Partition number (1-4): 3

And re-add, using the defaults to use the rest of the virtual disk:

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (1083-26108, default 1083):
Using default value 1083
Last cylinder or +size or +sizeM or +sizeK (1083-26108, default 26108):
Using default value 26108

When the partition is added, it's the wrong type, so we have to change it to the correct type:

Command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): 8e
Changed system type of partition 3 to 8e (Linux LVM)

Now we write the partition table and reboot

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[Expert@R7730:0]# reboot 

After the system reboots, you will need to execute a couple of additional commands:

  • pvresize /dev/sda3 to expand the logical volume to use the rest of the partition
  • lvm_manager to expand lv_current and lv_log to the desired sizes, which will require a reboot afterwords.

And that's it.

2 Replies
Vladimir
Champion
Champion

hat are you still doing with 77.30 ? 🙂

PhoneBoy
Admin
Admin

It's my "Migrate to R80.x" Lab

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.