Showing posts with label VMware. Show all posts
Showing posts with label VMware. Show all posts

File System Extension on Live Linux VMware Guest using vmdisk size extended



Many thanks to RAM for this Article.

---

This article explains, Filesystem extension on live Linux VMware Linux Guest where vmdisk size is extended and by not new disk added.

We had a scenario as follows:

1.       File system extension requirement on a live mounted file system without reboot.
2.       It’s a Linux guest on VMware required a FS extension from 600 GB to 900 GB. The FS was a single 600 GB disk  /dev/sdb
3.       While assigning storage, the team did increase the underlying disk to 900 GB than adding a new disk.
4.       Even after extension,  /dev/sdb was not picking up the additional 300 GB space. [ rescan or partprobe did not help here ]

Note: The case also applies for situations where you have the underlying partition has been changed ( using fdisk ).

Following are the steps taken to make the kernel recognize the new partition structure and to extend the filesystem

First we verified the disk sizes and allocations

# pvs
# vgs
# lvdisplay -m /dev/vg_name/lv_name  [ to get the underlying block devices ]
 
Now we had the partition table re-read for the underlying block device.

blockdev --rereadpt /dev/sdb
OR# sfdisk –R /dev/sdb

Do note that if you are doing this on a physical machine where we have multipath involved, we would need to re-read the partition tables for all the underlying disks involved.

Now that we have the partition table re-read, we would need to make PV resized to the new disk. Else it would still show the old size.

pvresize /dev/sdb

Check pvs / vgs output to see whether the new size is detected:

# pvs
# vgs

Once you have the new size detected, you can use the standard procedure to extend the filesystems

# lvextend -L +300G /dev/vg/lv
# resize2fs /dev/vg/lv

Check whether the new file systems are showing the correct sizes:

# df -h


Following are the screenshots of the entire activity which I performed in a test VM. A test VG and LV were created for this activity.

Verify current disk size of the mounted volume :



Check and verify on the available disk space on the underlying disk(s)



Increased the size of the vmware disk than adding a new disk in the virtual machine settings in vCenter.


Now,

Make the new sizes/partition visible on the system without reboot or taking the volume offline:



Extend the LV:



Resize FS:



Using NTP in VMware Virtual Machine

Timekeeping on Linux VMware guests can be a is difficult to handle and frustrating. This post shows the various settings required to make things work. More information can be found at http://kb.vmware.com/kb/1006427.

VMware recommends using NTP and turning off VMware Tools periodic time synchronization in the guest. 


To turn off Time Synchronization between Virtual machine (Guest) and Host (ESX server) , there are three options:


  1. Set tools.syncTime = "False" in the configuration file (.vmx file) of the virtual machine.

Enable SSH in VMware ESXi Server

One of the things that annoyed in VMware ESXi Server is the lack of SSH support.   By default, VMware ESXi Server does not support SSH. But it is there in the operating system, Its just not enabled.   


Here is the steps to make SSH turn on in your VMware ESXi Server :


  1. Get on the console of the ESXi server.
  2. Press ALT-F1 to get to the OS system console
  3. Type “unsupported”
  4. Enter the root password at the password prompt.
  5. Edit /etc/inetd.conf with vi, and uncomment the SSH line
  6. Run:  kill -1 $(cat /var/run/inetd.pid)


Thats all.. Now you can SSH to your ESXi Server..

Expand Virtual disk (VMDK) in VMware


How to Grow a virtual disk in a VMWare virtual machine

A VMDK file can be grown while no virtual machine is using it. Growing the VMDK only makes the virtual harddrive bigger - filesystem within the VMDK must still to be grown with other methods. 

On ESX Server:
          vmkfstools -X <newsize>Gb  filename.vmdk
On ESX 3.5, you can also edit the VM settings and edit the harddrive when the VM is not running.

Note:  On ESX the filename.vmdk file is just a  file containing metainformation and "filename-flat.vmdk" is the actual data file. 

However, vmkfstools operations are used on the metafile