Tuesday, October 16, 2012

How setup a Windows share as a vmware ESX datastore

To get shell access locally, see bottom of page....

Enabling and Accessing Tech Support Mode

To enable local or remote TSM from the vSphere Client:

  1. Select the host and click the Configuration tab.
  2. Click Security Profile > Properties.

    In ESXi 5.x, select SSH or ESXi Shell and click Options.
    In ESXi 4.1, select Local Tech Support or Remote Tech Support (SSH) and click Options.

  3. Choose the desired startup policy and click Start, then click OK.
  4. Verify that the daemon selected in step 3 shows as running in the Services Properties window. 
*********************************************************************************************************

To enable root login for SSH and SCP clients:
  1. If you have physical access to the ESX host, login to the console of your ESX host as the root user. If you can only connect to the ESX host over the network, connect using an SSH client (such as PuTTY) and log in as a user other than root.

    To create a user in ESX host for using a SSH client:
    1. Log in to the vSphere Client as a root user.
    2. Click Users & Groups.
    3. Right-click on a blank area and click Add.
    4. Enter a username and password. Confirm your password.

      Note: Starting in ESX 4.0, the password needs to be at least 8 characters in length.

    5. Select Grant shell access to this user and click OK.
  2. After you are logged in SSH session, switch to the root user with the command:

    su -Note: If you do not have any other users on the ESX host, you can create a new user by connecting directly to the ESX host with VMware Infrastructure (VI) or vSphere Client. Go to the Users & Groups tab, right-click on the Users list and select Add to open the Add New User dialog. Ensure that the Grant shell access to this user option is selected. These options are only available when connecting to the ESX host directly. They are not available if connecting to vCenter Server.
  3. Edit the configuration file for SSH with the command:

    nano /etc/ssh/sshd_config
  4. Find the line that starts with PermitRootLogin and change the no to yes. You can find this line about 2 pages down from the top.
  5. Save the file by first pressing Ctrl-O and then Enter.
  6. Exit with Ctrl-X.
  7. Restart the sshd service with the command:

    service sshd restartNote: Alternatively, use the command:

    /etc/init.d/sshd restart

src1: http://kb.vmware.com/selfservice/microsites/search.do?cmd=displayKC&docType=kc&externalId=8375637&sliceId=2&docTypeID=DT_KB_1_1&dialogID=459226599&stateId=1%200%20459240961 

src2: http://kb.vmware.com/selfservice/microsites/search.do?cmd=displayKC&docType=kc&docTypeID=DT_KB_1_1&externalId=1017910

 ************************************************************************************

 

I keep all my OS and software media as ISO files on my PC.  At work we have an ISO library on a filer NAS share.  When creating virtual machines on ESX it’s much more efficient to install OS’s and applications by mounting an ISO image.  Its possible to connect to window shares from your ESX servers to access and mount your ISO’s


First you need to enable samba services on your ESX server’s firewall:
(from the ESX server console)

esxcfg-firewall -e smbClient

Next you need to create a location for your mount point.  Because the “vmimages” folder is visable from VirtualCenter, put the mount point in that folder

mkdir /vmimages/iso

Next you need to enable netfs – netfs is a file system interface to the networking stack of the ESX OS

chkconfig netfs on
service netfs start


Now you can mount the share in ESX.  Make sure the username you use is valid on the Windows host.  If its a domain member, use the “domainusername” format

mount -t smbfs -o username=<enter username>,password=<enter password> //servername/sharename /vmimages/iso

Now browse to the vmimages folder under your datastore and there you have it

src: http://www.tonydimaggio.com/blog/2008/02/28/connecting-to-windows-share-from-esx-server/

***************************************************************************

Shell
If you’ve used VMware ESX in the past, you’ll know that one of the most useful administrative features is the Red Hat based console used to interact with the ESX host. With the introduction of VMware’s console-less hypervisor ESXi, many of us were left trying to find ways to accomplish familiar tasks in a shell-less environment.
Fortunately word has gotten out that contrary to VMware marketing, ESXi does include a limited shell which can be accessed in times of need. This shell is actually the open-source BusyBox, which includes among other tools an ssh client/server. To access this shell and enable remote ssh logins, follow the steps below. Note: This assumes you have physical (or console based) access to the ESXi host.
    1) After booting into ESXi, go to the console screen of the host and press the buttons ALT-F1 which will take you another console terminal screen.
    2) Type the word “unsupported” and hit enter at this screen. Note: character echoing is turned off so you will not see what you are typing.
    3) A prompt will appear explaining you are entering “Tech Support Mode”, please read it carefully and understand what you are agreeing to. Enter the root password and hit enter.
    4) To enable sshd, type “vi /etc/inted.conf”
    5) Find the line that begins with ssh and delete the “#” at the beginning. (I assume you know vi editor commands)
    6) Save the file and find the inted service by typing “ps | grep inetd”.
    7) Kill the inetd process by typing “kill -9 process id from step 6
    8) The inetd process will now restart and the sshd service will be enabled. You can now use an ssh client to access the ESXi host as root.

 

No comments:

Post a Comment