SHIFT

--- Sjoerd Hooft's InFormation Technology ---

User Tools

Site Tools


resizeesxvirtualdisk
Differences

This shows you the differences between two versions of the page.

Link to this comparison view

resizeesxvirtualdisk [2013/04/20 13:23] (current)
sjoerd created
Line 1: Line 1:
 += Resize ESX Virtual Disk =
 +It's possible to resize disks in a VMware ESX / Infrastructure environment. Increasing is easy, and there'​s almost no risk on losing data. If you need to make a disk smaller you should always turn the guest off, since there is a serious chance of losing data. To resize disks there are two steps to follow, first resize the actual disk and then you need the guest operating system to recognize the new available disk space. ​
  
 += Disk Resize =
 +There are two ways to resize disks:
 +== Through the Client ==
 +* Open the client in the VMware Console and open the settings
 +* Select the disk you're about to resize:
 +{{resizeclient.jpg}} \\
 +* Just make the disk the correct size and click OK.
 +
 +== Through the Commandline ==
 +Before you start following this procedure keep these points in mind:
 +* Shrinking the volume works on the same way, just add an extra switch {{{--force}}}
 +** Note: This is THE way to lose data!
 +* This functionality only works with ESX editions prior to 3.
 +\\ 
 +Procedure:
 +* Use the just described way to check where in the filesystem the diskfile is located
 +* Log on to the ESX server on the commandline and become root
 +* Navigate to the diskfile
 +* Issue this command to resize the disk:
 +** Note: New size is the complete new size, not the size you want to increase or decrease with
 +<​code>​
 +vmkfstools -X <new size> <disk name>​.vmdk
 +</​code>​
 +* You're done now!
 +
 += Operating System =
 +== Windows and Linux ==
 +* Start the Virtual Machine guest with a Knoppix CD
 +* Start in knoppix the tool qtpart
 +* Resize the partition
 +* Start the OS, and allow it to perform file system checks
 +
 +== Linux Extra ==
 +In linux you could also assign the disk to another guest to resize the partition, you can use the normal system tools then. In Suse, that would be: Yast2 -> System -> Partitioner. ​
 +
 +=== Note ===
 +Not so long ago, I tried this procedure on a SLES 10 SP2 box and ran into some problems. I downloaded the latest Knoppix version, 6.2.1 and there was no qtpart application available, on both the CD and the DVD. So eventually, I resized the disk using '​gparted'​. When I rebooted the machine I ran into the problem that only the partition was resized and not the file system:
 +Partitioner:​
 +<​code>​
 +/dev/sdb │     20.0 GB│   ​│VMware-Virtual disk│ ​      ​│ ​       │    0│2609│
 +/​dev/​sdb1│ ​    19.9 GB│   ​│Linux native ​      ​│/​opt ​  ​│K ​      ​│ ​   0│2609│
 +</​code>​
 +This is however what df -h said:
 +<​code>​
 +/​dev/​sdb1 ​            ​9.9G ​ 4.2G  5.3G  45% /opt
 +</​code>​
 +
 +So, I still had to resize the filesystem:
 +<​code>​
 +slesbox:~ # resize2fs /dev/sdb1
 +resize2fs 1.38 (30-Jun-2005)
 +Please run '​e2fsck -f /​dev/​sdb1'​ first.
 +
 +slesbox:~ # e2fsck -f /dev/sdb1
 +e2fsck 1.38 (30-Jun-2005)
 +Pass 1: Checking inodes, blocks, and sizes
 +Pass 2: Checking directory structure
 +Pass 3: Checking directory connectivity
 +Pass 4: Checking reference counts
 +Pass 5: Checking group summary information
 +/dev/sdb1: 9143/​1310720 files (8.1% non-contiguous),​ 1205470/​2620595 blocks
 +
 +slesbox:~ # resize2fs /dev/sdb1
 +resize2fs 1.38 (30-Jun-2005)
 +Resizing the filesystem on /dev/sdb1 to 5241198 (4k) blocks.
 +The filesystem on /dev/sdb1 is now 5241198 blocks long.
 +</​code>​
 +After these steps I could mount the filesystem again and use the new space:
 +<​code>​
 +slesbox:~ # mount /opt
 +
 +slesbox:~ # df -h
 +Filesystem ​           Size  Used Avail Use% Mounted on
 +/​dev/​sdb1 ​             20G  4.5G   ​15G ​ 24% /opt
 +</​code>​
 +
 +{{tag>​vmware linux}}
resizeesxvirtualdisk.txt · Last modified: 2013/04/20 13:23 by sjoerd