Nov 23, 2014

0 Resize virtual disks in VMware

Resizing virtual disks in VMware.
Note: You can't change the disk size if you take a snapshot.

1. Shutdown the VMware virtual machine.
2. Right click on the VMware virtual machine and select "Edit Settings".
3. On the "Hardware" tab, select the virtual disk you would like to resize 
and in the "Capacity" section enter the required size.
!! If you see a disk greyed out, it's because the disk controller is set to IDE in the VM.












When you boot the virtual machine now the OS will not see the new size, 
it will only see the old size. You need to expand the volume into the new free space.
For this I use fdisk, because it's embedded in every linux distribution.

If you have /dev/sda1 as the filesystem, and /dev/sda2 as the unused partition, 
check the partitions with 
fdisk /dev/sda:

# fdisk /dev/sda
...    
Command (m for help): p
...
  Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048     8016434   268434432   83  Linux
/dev/sda2         8016435  1953520064   972751815   83  Linux
You need to make sure that your new sda1 starts in the same location (here, 63) and ends where sda2 ended (here, 8016434). And double-check that where sda1 ends is immediately before where sda2 starts (here, 8016434 is immediately followed by 8016435) just to be sure.

Then delete the unused partition, and the filesystem partition:

Command (m for help): d
Partition number (1-4): 2
...
Command (m for help): d
Partition number (1-4): 1
Recreate the filesystem partition:
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4, default 1): 1
First sector (63-1953520064, default: 63): 63
...
Last sector, +sectors or +size{K,M,G} (63-1953520064, default 1953520064): 1953520064

Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): 83
Check result : 

Command (m for help): p
...
  Device Boot      Start         End      Blocks   Id  System
/dev/sda1          2048      8016434  268434432    83  Linux
Save all changes : 

Command (m for help): w
Now you should reboot.

After reboot , re-size file-system : 

# resize2fs /dev/sda1

After all changes, check for result : 

janis@ubuntu01:~$ df -h
Filesystem      Size  Used Avail Use%  Mounted on
/dev/sda1       252G   48G  194G  20%  /








0 comments :

Post a Comment

Comment: