One Liner Command to Get List of VM on ESX Host

No Comments

Today, I would like to share how to get a list of virtual machine (VM) on a ESX host using one liner command. Make sure you are logged on to an ESX host. Below is the one liner command to get a list of VM on a ESX host: -

for i in $(vmware-cmd -l); do echo "`grep displayName $i | awk '{print $3}' | sed -e 's/"//g'`" "Powered" "`vmware-cmd $i getstate | awk '{print $3}'`" ; done

I will be sharing more useful commands. Stay tune. Thank you and have fun.

Happy 20th Birthday Linux

No Comments

Linux is everywhere and you don’t even notice you are using it everyday when you browse the Internet. Happy 20th anniversary Linux :)


Remote Mount a VMDK File Using vmware-mount

6 Comments

After years of using VMware products, be it VMware Server, VMware Workstation, VMware Infrastructure and VMware vSphere, I haven’t encounter failure on booting a Windows OS. But, one fine day this week itself, one of the Windows Server 2003 virtual machine (VM) can’t boot up because of missing boot.ini file.

Without any delay, I download the Virtual Disk Development Kit 1.2.1 from http://www.vmware.com/support/developer/vddk/ and I copy out the virtual disk from the shared storage which is virtual_machine_name-flat.vmdk (file name is an example only) with the filesize of 20GB. I tried mounting the VMDK file locally but failed. After several tries, I decided to copy the rest of the files in the VM folder from the share storage. Woot woot, I am able to mount the VMDK file using the command below: -

# vmware-mount X: "C:\VM\virtual_machine_name.vmdk"

Now, the VMDK file is mounted as X: drive letter locally so I begin to copy a good copy of boot.ini file. Copying those files to the shared storage is a pain because I have to wait 30 mins. Once the copying is completed, I begin to power on the VM but it failed to boot up telling me that NTDETECT.com is missing. What the heck, I have to copy thoses file again from shared :(

After, copying a good copy of NTDETECT.com and a successfully boot up of the VM then I was relief. Its time for me to hack the remote mount a VMDK file. Indeed, I successfully mount the VMDK remotely. Yatta. Please use the command below: -

# vmware-mount X: "[Shared_Storage] virtual_machine_name/virtual_machine_name.vmdk" /i:"DataCenter/vm/Servers/virtual_machine_name" /h:VCenterName /u:"domain\user_name" /s:your_password

With the command above, the VMDK is mounted as X: drive letter. Please take note as below: -

[Shared_Storage] virtual_machine_name/virtual_machine_name.vmdk = you can get this path in vSphere Client, Edit Settings on the VM and select the virtual disk
/i:”DataCenter/vm/Servers/virtual_machine_name” = you can get this in the tree view of vShphere Client, the “vm” in this path is complusory

To list/view mounted volume(s), run the command below: -

# vmware-mount /L

To umount a mounted volume, run the command below: -

# vmware-mount X: /d

I hope the commands above will help you in your daily VMware job. Please feel free to give comments and suggestions to the commands I shared. Thank you.

Setup a File Only Upload FTP Server with vsftpd

No Comments

This post describes how to setup a FTP server using vsftpd 2.0.5 in CentOS with the ability to allow anonymous users to upload files and don’t have the ability to create directory. You can use this FTP server as a public dropbox to share files. If users would like to upload directory, you can suggest them to zip the directory and they can upload them as a file.

Pre-requisite Check
Run the command below to query for vsftpd rpm: -

rpm -qa vsftpd

If vsftpd is not installed, you can use yum to install it using the command below: -

yum install vsftpd

Initial Configuration
The configuration directory of vsftpd is located in /etc/vsftpd path. It is advisable to backup the good known configuration files for easier quick restoration. Run the command below: -

cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.original

Enable Anonymous User
Change the following parameter below in your /etc/vsftpd/vsftpd.conf file to enable anonymous users access: -

anonymous_enable=YES

Change the following parameter below in your /etc/vsftpd/vsftpd.conf file to enable anonymous users to have upload and download access: -

write_enable=YES
anon_upload_enable=YES
anon_umask=022

Create An Upload Directory
You need to create a special upload directory using the command below: -

mkdir /var/ftp/pub/incoming
chown ftp:ftp /var/ftp/pub/incoming

Restart vsftpd Service
You need to restart vsftpd to take effect using the command below: -

service vsftpd restart

You may now use FileZilla to connect to this file only sharing FTP server.

If you found these helpful, please contribute to help:

Debian Sources List Generator

2 Comments

Having switch to Debian distribution from Red Hat Enterprise Linux or The Community ENTerprise Operating System (CentOS), I am having hard time tweaking the apt-get sources list for Debian. However, there is a great free service named Debian Sources List Generator website.

In the Debian Sources List Generator website, we have the ability to generate the sources list file by selecting the country, Debian release, Debian branches, Debian updates as well as 3rd parties repositories. Nevertheless, there is an Ubuntu Source List Generator which you may try if you are a fan of Ubuntu like me. Both of them are maintained by Miro “churchyard” HronĨok.

Older Entries Newer Entries