Home > Database, ESX, ESXi, Linux, Oracle, SLES, VI, VMware > Extending VMDK file and resizing the partition – SLES 10 Linux

Extending VMDK file and resizing the partition – SLES 10 Linux

April 7th, 2009

1. ESXi 3.5 Extending the VMDK file [Virtual Machine Hard Disk]

The main reason behind this is the fact that I needed more space for 2 more Oracle databases on a SLES10 Linux system. The partition mounted on /u01 was initially created as 21GB but I quickly depleted the space with 3 oracle 10g databases that took more than 17GB and the space left was not sufficient for the 2 new databases that I had to create.

Before I advanced with the extension of the VMDK file I connected to each separate instance and performed “shutdown immediate” command as sysdba.
Then I stopped the listener, dbconsole, isqlplus and once I confirmed that no oracle related processes were present on the system I performed a shutdown “shutdown -h now”.

In order to extend an existing hard drive attached to a virtual machine you have to make sure no snapshots of the virtual machine are present. I know that this is quite uncomfortable considering the risky operation that you are about to perform but there is a work around. (The work around is not in this post, so please let me know if you are interested or simply search for it. There is a good chance that I will have an article concerning that topic)

I removed all snapshots of this test system since the current state completely comforts me.

Once you delete all snapshots here is where you edit the HDD size using Virtual Infrastructure Client connected to the ESXi host.

ESX Extend Disk

On the image above I have increased the size of Hard Disk 2 to 41GB when the previous size was 21GB.

Once this was done I safely booted the system up and opened the console.

2. Resizing / extending the SLES10 partition.

I checked the current disk state with fdisk -l

Fdisk -l check of the disks

I noticed that the disk has the total size of 41GB but the /dev/sdb1 partition needs to be extended.

I checked the mount points and unmounted the /u01 partition that I am to extend.

  • sles10test:~ # mount
    /dev/sda2 on / type reiserfs (rw,acl,user_xattr)
    proc on /proc type proc (rw)
    sysfs on /sys type sysfs (rw)
    debugfs on /sys/kernel/debug type debugfs (rw)
    udev on /dev type tmpfs (rw)
    devpts on /dev/pts type devpts (rw,mode=0620,gid=5)
    /dev/sdb1 on /u01 type reiserfs (rw,acl,user_xattr)
    securityfs on /sys/kernel/security type securityfs (rw)
    sles10test:~ # umount /dev/sbd1
    umount: /dev/sbd1: not found
    sles10test:~ # umount /dev/sdb1
    sles10test:~ # mount
    /dev/sda2 on / type reiserfs (rw,acl,user_xattr)
    proc on /proc type proc (rw)
    sysfs on /sys type sysfs (rw)
    debugfs on /sys/kernel/debug type debugfs (rw)
    udev on /dev type tmpfs (rw)
    devpts on /dev/pts type devpts (rw,mode=0620,gid=5)
    securityfs on /sys/kernel/security type securityfs (rw)
    sles10test:~ #
  • Then I decided to test if the powerful yast could offer help right away and here is what I found.

    Yast!!

    In the Partitioner application I selected the partition that I wanted then selected resize and got the following warning.

    Partitioning Warning

    Here is the screen I was presented to:

    Initial Partitioning Screen of Yast Partitioner

    And by using the slider I increased the partition size on the physical (virtual) disk!

    Extending the Partition Size using Yast Partitioner

    Select “OK”

    And we are finished!

    Select “Finish” and wait for the Yast Partition application to finish.

    Once this is done you can perform few tests. Something that I noticed is that once the Partition application is done it remounts the partition if it’s listed in the /etc/fdisk file.

    Here are the tests that I have performed upon the completion of the Partition application.

  • sles10test:~ # fdisk -l

    Disk /dev/sda: 6466 MB, 6466118656 bytes
    255 heads, 63 sectors/track, 786 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/sda1 1 73 586341 82 Linux swap / Solaris
    /dev/sda2 * 74 783 5703075 83 Linux

    Disk /dev/sdb: 44.0 GB, 44021817344 bytes
    255 heads, 63 sectors/track, 5352 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/sdb1 1 5353 42990024+ 83 Linux
    sles10test:~ #

  • And then I checked the size.

  • sles10test:~ # df -h
    Filesystem Size Used Avail Use% Mounted on
    /dev/sda2 5.5G 2.5G 3.0G 46% /
    udev 1014M 92K 1014M 1% /dev
    /dev/sdb1 41G 17G 25G 40% /u01
  • Enjoy!

    Comments are closed.