<< Method 1 – Using vmkfstools and GParted to extend a disk >>
- Download the GParted Live CD ISO and make it available so it can be mounted by the virtual machine’s CD-ROM
- Shutdown the virtual machine you want to resize
- Log into the ESX Server console via Putty
- Type “vmkfstools -X /vmfs/volumes/<volume name>/<VM directory name>/<virtual disk file name>” ie. /vmfs/volumes/Storage1/my_vm.vmdk. New disk size can be specified in kilo, mega or gigabytes and will be the total size of the new disk. So if you want to increase a virtual disk from 20GB to 24GB you would specify either 24000m or 24g
- Power on the Virtual Machine and make sure it boots properly, load Disk Management and you will see the new unallocated space
- Now to join the unallocated space to the primary partition, first shutdown the Virtual Machine
- Connect the Virtual Machine to the GParted ISO file and make sure you enable Connected at Power On
- Power on the Virtual Machine
- Press ESC at the Bios screen to get to the Boot Menu
- Select CD-ROM as the Boot device
- Gnome Partition Editor will load, press Enter at the boot screen
- At the Boot option screen select Manual Video Card and then select Done
- Select US English at the Language screen
- Select qwerty/us.map at the Keyboard screen
- Select Generic VESA Compatiable at the Video Driver screen
- Select 8 at the Display Depth screen
- Select 1024×768 at the Resolution screen
- Once the partition editor loads, click on /dev/sda1 in the partition list
- Click the Resize/Move button
- Click and drag the arrow to extend the size of the partition, make sure you do a resize (double arrow) and not a move (four way arrow) so you should 0 free space preceding and following and then click the Resize/Move button
- Next click the Apply button and then the operation will start, you can expand Details to see the progress, once completed click the Close button
- Click the power button in the bottom right corner, then select reboot
- Edit the VM and remove the ISO from the CD/ROM device (change to Client)
- When the server restarts it will do a Check Disk, let this complete, Windows will prompt for a reboot after you login
- Reboot and load Disk Management and your Primary Partion will be the new size without any unallocated space
<< Method 2 – Using VMware Converter to shrink or extend a disk >>
- When you use Converter to copy a VM it will transfer the data to the destination server by one of two ways. If you do not change the disk size or increase the size of your original disks then it does a block level clone of the drive. If you reduce the size of your original disks it instead does a file level clone of the drive.
- Download Converter and install it on the VM that you want to resize the drives, reboot after the install completes
- Start Converter application, click the Import Machine button
- Click Next at the Welcome screen and then Next again at the Source screen
- Select ‘Physical Computer’ and click Next o Select “This Local Machine” and click Next
- At the Source Data screen select your volumes and change “Maintain Size” to “Type Size in GB” and enter your new disk size and click Next
- At the Destination screen click Next
- Select “Import this machine to a Vmware ESX Server or VirtualCenter virtual machine” and click Next
- At the Destination login screen, select your ESX/VC server and enter the login information and click Next
- At the Virtual Machine Name and Folder screen enter a new name for your VM and select a folder and click Next
- At the Host or Cluster screen select a host for your destination and click Next
- At the Datastore screen, select a datastore and click Next
- At the Networks screen, configure your NICs and click Next
- At the Customization screen, click Next
- Click Finish and the conversion will begin
- Once the Conversion is complete, edit the new VM settings and remove any extra hardware that Converter adds (USB/serial/parallel ports, etc.)
- Shutdown your original source VM and power on your new destination VM
- Make sure everything is functioning properly on the new VM and you can delete the original VM
<< Method 3 – Using vmkfstools and another Windows virtual machine to extend a disk >>
- Shutdown the virtual machine you want to resize
- Log into the ESX Server console via Putty
- Type “vmkfstools -X /vmfs/volumes/<volume name>/<VM directory name>/<virtual disk file name>” ie. /vmfs/volumes/Storage1/my_vm.vmdk. New disk size can be specified in kilo, mega or gigabytes and will be the total size of the new disk. So if you want to increase a virtual disk from 20GB to 24GB you would specify either 24000m or 24g
- Shutdown the second helper virtual machine
- Edit the settings of the second VM and add the hard disk from the first VM
- Power on the second VM and load the Disk Management snap-in and verify that the disk from the first VM has un-allocated space on it
- Select Start, Run and enter diskpart.exe
- The command ‘list volume’ will show you all volumes.
- Select your volume based on the results of the list volume command, ie. ‘select volume 1′
- Type the command ‘extend’ to extend the volume
- Check the Disk Management snap-in again and the volume should be extended with a larger capacity
- Shutdown the second VM and remove (not delete) the disk from it
- Power on your first VM and the new space should be there and ready to use
<< Method 4 – Using vmkfstools and System Rescue CD to extend a disk >>
- Download the System Rescue ISO and make it available so it can be mounted by the virtual machine’s CD-ROM
- Shutdown the virtual machine you want to resize
- Log into the ESX Server console via Putty
- Type “vmkfstools -X /vmfs/volumes/<volume name>/<VM directory name>/<virtual disk file name>” ie. /vmfs/volumes/Storage1/my_vm.vmdk. New disk size can be specified in kilo, mega or gigabytes and will be the total size of the new disk. So if you want to increase a virtual disk from 20GB to 24GB you would specify either 24000m or 24g
- Power on the Virtual Machine and make sure it boots properly, load Disk Management and you will see the new unallocated space
- Now to join the unallocated space to the primary partition, first shutdown the Virtual Machine
- Connect the Virtual Machine to the System Rescue ISO file and make sure you enable Connected at Power On
- Power on the Virtual Machine
- Press ESC at the Bios screen to get to the Boot Menu
- Select CD-ROM as the Boot device
- Press Enter at the boot screen
- Press Enter after boot sequence is complete and then type ‘startx’
- Once X-windows loads, double-click the GpartEd icon (drive icon, 3rd down on the right hand side)
- Once the partition editor loads, click on /dev/sda1 in the partition list
- Click the Resize/Move button
- Click and drag the arrow to extend the size of the partition, make sure you do a resize (double arrow) and not a move (four way arrow) so you should 0 free space preceding and following and then click the Resize/Move button
- Next click the Apply button and then the operation will start, you can expand Details to see the progress, once completed click the Close button
- Click the power button in the bottom right corner, then select reboot
- Edit the VM and remove the ISO from the CD/ROM device (change to Client)
- When the server restarts it will do a Check Disk, let this complete, Windows will prompt for a reboot after you login
- Reboot and load Disk Management and your Primary Partion will be the new size without any unallocated space
<< Method 5 – Using Knoppix Live CD with QtPartEd to shrink a disk >>
- Download the Knoppix Live CD ISO and make it available so it can be mounted by the virtual machine’s CD-ROM
- Shutdown the virtual machine you want to resize
- Add a second virtual disk of the new smaller desired size to the VM you want to resize
- Connect the Virtual Machine to the Knoppix Live CD ISO file and make sure you enable Connected at Power On
- Power on the Virtual Machine
- Press ESC at the Bios screen to get to the Boot Menu
- Select CD-ROM as the Boot device
- Press Enter at the boot screen
- Click on the K Menu icon and then select System and then QTPartEd
- Select your original drive (usually sda) and click on the partition 1
- Select Operations from the top menu and then Resize, resize the drive so it is just less then the new drives (sdb) capacity
- Select File from the top menu and then Commit, click Yes at the warning window
- Once complete, select Cancel if you get a unmounted hard disk window and then OK at the Progress window
- Open a Konsole window and type “dd if=/dev/sda of=/dev/sdb” This copy will take a long time and will not show a status while it is running. Yyou will get an insufficient space error at the end of the copy, this is normal because the drive you’re copying from is bigger then the destination. But as long as the partition is smaller, everything will work
- Shutdown the VM and edit the VM settings, remove the original C: drive and change the SCSI ID of the new drive to match the old one (usually 0:0)
- Power on the VM and it will run a Chkdsk and you will be all set
<< Method 6 – Use Ghost or another 3rd party imaging product to shrink a disk >>
- Shutdown the virtual machine you want to resize
- Add a second virtual disk of the new smaller desired size to the VM you want to resize o Use Ghost to clone the first disks partition to your second virtual disk
- Once complete make sure the second virtual disk is ‘Active’
- Switch your disks by editing the virtual machine settings and switching the SCSI id’s (0:0 and 0:1)
- If the virtual machine boots OK and you verify that everything works then shutdown the VM and remove the larger disk and delete it
Reference:
Re-sizing Virtual Disks
No comments:
Post a Comment