Kasraeian

vWorld

Browsing Posts published by Sohrab Kasraeian Fard

Think about scenario which two or more hard disks should be created and added to a specific VM(s); there are multiple ways like using GUI (vSphere Client) or PowerCLI.   :wink:
If normal GUI (vSphere Client) going to be use, it would be a time-consuming process but when trying to do it with PowerCLI (automated way), it’d be so much faster.

I had two VMs which needed “8 hard disks on SATA and 2 hard disk on SSD” to be added, which means adding 20 disks in total so for preventing suffering from same process in future I made bellow script. ( script demo on YouTube )

Warning:
1. This is first version of script and only work in interactive mode and might have some bug; I’d be really grateful if you could kindly let me know any possible bug/problem you saw. I’d try to update it in a way so it can get parameters or/and accepting file as source.
2. Please test it on one test VM before using it on any production VM.

###################################
# Title: Mass Hard Disk Creator
# Ver: 0.1
# Author: Sohrab Kasraeian Fard (@Kasraeian)
# Date: 11/15/2012
###################################
CLS
# Get VM List
Write-Host "VM List"
Get-VM | sort Name

# Selecting the target VM
$VM = Read-Host ("`nPlease select the target VM to add new hard disk(s) to it")

# Checking VM current state
$CH = Get-HardDisk -VM $VM
$CC = Get-VM -Name $VM | Get-ScsiController

if ($CH.count -ge 2) {
	$AHS = 60 - $CH.count
} elseif ($CH.count -ne "") {
	$AHS = 59
}
if ($CC.count -ge 2) {
	$ACS = 4 - $CC.count
} elseif ($CC.count -ne "") {
	$ACS = 3
}

$vmh = Get-VM -Name $VM | select VMHost
$vmh = $vmh.VMHost.Name
$vmhds = Get-VMHost $vmh | Get-Datastore | sort name

#Main Process
if ($AHS -lt 60 -or $CH.count -ne "") {
	Write-Host "`nThere are $ahs free slot available for adding hard disk for selected VM."

	[Int]$Qty = Read-Host ("How many hard disk(s) do you want to add (Max $ahs)?")
	[Int]$Cap = Read-Host ("Please define new hard disk(s) capacity in GB [Range: 0.001-1024]")
	$NDSR = Read-Host ("Should new hard disk(s) be saved on other datastore?")
	if ($NDSR -like "yes") {
		$k=1; Write-Host "`n"
		$vmhds | %{ Write-Host "$($k).`t$($_.Name)`t$($_.CapacityGB)`t$($_.FreeSpaceGB)"; $k++ }
		$SNDSI = Read-Host ("Please select new datastore from above list")
		$SNDS = $vmhds[$SNDSI-1].Name
	}

	if ($ACS -le 4 -and $ACS -gt 0) {
		$NCR = Read-Host ("Want to add new controller for new disks?")
		if ($NCR -like "yes") {
			$RNCT = Read-Host ("`n[BLP] BusLogic Parallel`n[LLP] LSI Logic Parallel`n[LLS] LSI Logic SAS`n[VPV] VMware Paravirtual`nWhich controller type should be added [Other = OS Default]?")
			switch($RNCT) {
				"BLP" { $NCT = "VirtualBusLogic" }
				"LLP" { $NCT = "VirtualLsiLogic" }
				"LLS" { $NCT = "VirtualLsiLogicSAS" }
				"VPV" { $NCT = "ParaVirtual" }
				default { $NCT = "Default" }
			}
		}
	} else {
		Write-Host "There is no empty slot on selected VM for adding any new SCSI Controller."
	}
	$Approve = Read-Host "Please approve to create new $qty disk(s) for $vm with capacity of $cap GB"

	if ($Approve -eq "Yes" -and $Qty -le $AHS -and $Cap -ge 0.001 -and $Cap -le 1024) {
		for ($j = 1; $j -le $Qty; $j++) {
			if ($j -eq 1 -and $NCR -like "yes" -and $NDSR -notlike "yes") {
				New-HardDisk -VM $VM -CapacityGB $Cap -StorageFormat Thin | New-ScsiController -Type $NCT -Confirm:$false
				$SC = Get-VM -Name $VM | Get-ScsiController
				$SCT = $SC.count - 1
			} elseif ($j -eq 1 -and $NCR -like "yes" -and $NDSR -like "yes") {
				New-HardDisk -VM $VM -CapacityGB $Cap -StorageFormat Thin -Datastore $SNDS | New-ScsiController -Type $NCT -Confirm:$false
				$SC = Get-VM -Name $VM | Get-ScsiController
				$SCT = $SC.count - 1
			} elseif ($j -ge 2 -and $NCR -like "yes" -and $NDSR -notlike "yes") {
				New-HardDisk -VM $VM -CapacityGB $Cap -StorageFormat Thin -Controller "SCSI controller $SCT" -Confirm:$false
			} elseif ($j -ge 2 -and $NCR -like "yes" -and $NDSR -like "yes") {
				New-HardDisk -VM $VM -CapacityGB $Cap -StorageFormat Thin -Controller "SCSI controller $SCT" -Datastore $SNDS -Confirm:$false
			} elseif ($NDSR -notlike "yes") {
				New-HardDisk -VM $VM -CapacityGB $Cap -StorageFormat Thin -Confirm:$false
			} elseif ($NDSR -like "yes") {
				New-HardDisk -VM $VM -CapacityGB $Cap -StorageFormat Thin -Datastore $SNDS -Confirm:$false
			}
		}
	} elseif ($Approve -ne "Yes") {
		Write-Host "Process terminated by user." -BackgroundColor Yellow -ForegroundColor Red
	} elseif ($Qty -gt $AHS) {
		Write-Host "Can't create disk more than available free slot!" -BackgroundColor Yellow -ForegroundColor Red
	} elseif ($Cap -lt 0.001 -or $Cap -gt 1024) {
		Write-Host "Selected capacity is out of possible range!" -BackgroundColor Yellow -ForegroundColor Red
	} else {
		Write-Host "Please check given parameter and try again!" -BackgroundColor Yellow -ForegroundColor Red
	}
} elseif ($AHS -eq 0) {
	Write-Host "There is no empty slot on selected VM for adding any hard disk."
}

In this post I’d try to demonstrate the usage of “VMware PowerCLI” in case of working in some network area, for more clear, I’d create new “Virtual Machine Port Group” and then would add new vNIC to VMs and connect them to the newly created “Port Group”.

Step 1 – Creating new “Port Group”

First of all, I’d checked the networking configuration of two standalone hosts under “HostConfigurationNetworking” and as it shown in the bellow screen shots, there is no “Virtual Machine Port Group” under “vSwitch1″ and it’s only contain one “VMKernel” for vMotion purpose for each host.

 

After running bellow “PowerCLI” command, one port group would be created on each host with indicated name as shown.

$vmh = Get-VMHost; $vmh | %{ Get-VirtualSwitch -VMHost $_ | where {$_.name -like "vSwitch1"} | New-VirtualPortGroup -Name "Sync Channel"}

  

Now lets check each part of code: continue reading…

It’s possible and so easy to install “VMware PowerCLI” on the full edition of “Microsoft Windows (Client/Server)” (with GUI) but what about “Windows Server Core Edition”?

I’ve tried to install it on “Microsoft Windows Server 2012 Core” and here I’m listing some little points needed to take care of.
First of all, “VMware PowerCLI” needs “.NET Framework 2.0″ which is not installed by default, so it should be installed before starting the whole process.

 

Adding or remove of new feature or rule is possible through command line or by using GUI on other server, here I’d install “.NET Framework” using PowerShell.

Step 1 – installing “.NET Framework”

Run “powershell” command so the normal command prompt would change to the “PS C:>”. continue reading…

Today, I’ve searched for some possible Virtual Storage Appliance (VSA) options and found bellow products, some are popular and some are new (at least for me), so here the list.

Brand Product Last Version Product Page Download Page Info
VMware, Inc. vSphere Storage Appliance (VMware VSA) 5.1.1 link link Documentation
HP StoreVirtual VSA ??? link trial Resource Library
NetApp Data ONTAP Edge 8.1 link trial Documentation
StorMagic SvSAN/SvSAN 5 ??? link trial Resources
FalconStor NSS Virtual Appliance 7.0 link trial / free Documentation
DataCore SANsymphony-V Virtual SAN Appliance 9.? link link Resource Center
Openfiler Openfiler 2.3 link link Documentation / About
Nexenta Systems, Inc. NexentaStor Community Edition 3.1.3.5 link free Documentation
OmniTI Computer Consulting, Inc. OmniOS  r151004 link free Documentation / VMware Note

Also, There are some other applications or custom build OS which can be used to create a “Virtual Storage Server”.

Brand Product Last Version Product Page Download Page Info
StarWind Software, Inc. StarWind iSCSI SAN & NAS (SAN) 6.0.4837 link / free version link / free Editions Comparison / Resources
iXsystems, Inc. FreeNAS 8.3 link free Documentation
NAS4Free NAS4Free 9.1.0.1 link free Documentation
OpenIndiana OpenIndiana 151a5 link free Documentation
Illumian Project Illumian 1.0 link free Documentation
ZFSguru ZFSguru 0.2-beta8 link free Documentation / Roadmap
Server Elements NASLite-2 / NASLite-M2 2.67 / 1.67 link - Documentation

Update 1 [Nov 10, 2012]:
Thanks to “David Robertson (@daverdfw ) for his kind help, “FreeNAS, NAS4Free and Nexenta Community Edition” has been added.

Update 2 [Nov 11, 2012]:
“OmniOS”, “NASLite-2/NASLite-M2″ as well as “Info” section has been added.

:?: There might be other VSA as well and I’d be happy and thankful if you kindly share any others VSA you know, so I’d update this table.

After long absence I’m starting my work on this blog and other projects. For the first post I’d try to summarize the step needed to install and configure iSCSI or NFS server by using “Microsoft Windows Server 2012″ for home lab based on “VMware ESXi 5.x” but for step-by-step visual guide “Windows Server 2012 – File and Storage Services” page can be check.  :wink:

Requirements:
Virtual/Physical server with Windows Server 2012
Host/vHost with VMware ESXi 5.x
Server should have some free space to be able to present them as NFS or iSCSI storage.

Config #1 – iSCSI implementation
First of all make sure “VMware ESXi” hosts can use and connect to iSCSI storage, for more information on “Basic software iSCSI setup”, KB1008083 can be checked.

On the server side, “iSCSI Target Server” role should be install from “Server ManagerManageAdd Roles and FeaturesFile And Storage ServicesFile and iSCSI Services” and then configured.

After installation of role completed successfully, open the “Server Manager” and select “File and Storage Services”; now by selecting “iSCSI” option, server can create new virtual disk and present them (as LUN) to other server (initiators) or simply edit/delete existing iSCSI virtual disks and targets.

For creating new iSCSI virtual disk and target, right click on free space area of “iSCSI VIRTUAL DISKS” and select “New iSCSI Virtual Disk”; in the first step of wizard window select one drive with sufficient disk space and press “Next”.

In “iSCSI Virtual Disk Name” type file name for new virtual disk and for future use and simplicity enter short description for it and press “Next”. for example:
Name: Pro-iSCSI-C1
Description: iSCSI virtual disk for production server on cluster 01

Now, based on free space showing and space needed to present to other servers enter the disk size.

It’s possible to create new iSCSI Target or use the existing one;
By creating new one, new virtual disk would be presented as LUN0 on new target.
By selecting from existing “Targets”, the new virtual disk would be other LUN on that target, for example LUN2 on Target1.

Check the confirmation information and if everything is correct press the “Create” button, after short time new virtual disk (LUN) would be ready to present.

Microsoft Windows Server 2012 is like other iSCSI servers/targets and VMware ESXi host can connect to this “iSCSI Target” as well and work.

Notes:
Please note that “Microsoft Windows Server 2012″ would create one file on selected drive for each virtual disk and would assign disk space to that file based on size which would be configure later! for example if 40 GB selected for size of one virtual disk, one file with 40 GB size would be created. (Pre-allocate)

Config #2 – NFS implementation

Creating and using NFS on Windows Server is easy and straight forward process; bellow steps can help to prepare and present NFS Storage to the VMware ESXi 5.x. 

First of all, install “Server for NFS” role from “Server ManagerManageFile And Storage ServicesFile and iSCSI Services” and then few clicks is needed to make this feature up and running.

After successful installation of NFS role, right click on selected drive or folder and select “Properties”. then select “NFS Sharing” tab and press the “Manage NFS Sharing …” button; as this share would be presented to VMware ESXi, few changes should be made to the default settings.

Make sure the “Allow unmapped user Unix access (by UID/GID)” radio button should be selected.

If this “NFS Share” should be able to be written by VMs and Hosts, the “Type of access” on the “NFS Share Permission” window should be change from “Read-Only” to “Read-Write”.

The last step would be adding NFS Share to the VMware ESXi hosts and it can be easily done by pressing “Add Storage …” from “HostConfigurationStorage”; in the new window select the “Network File System” and in the next step provide the server name/ip and “NFS Share” address.

“NFS Share” address or “Folder” would be the name of NFS starting with “/“; for example, if I made folder on Windows with name of NFS_Share and share that with same name on “NFS Share Tab” I should give “/NFS_Share” as the folder or address here.

And the last part would be “Datastore Name” which would be appear on the “Datastores” list.

Notes:
One drive can be selected for NFS share and the whole process is the same as for folders, but if the drive is selected for  be done simply for one or more folder with same process.

If drive is selected for being shared as “NFS Share” two or more hidden folders might be visible on the “Datastore Browser”; folders like “$RECYCLE.BIN” or “System Volume Information”.

Kerberos option can be checked or unchecked and this change don’t prevent hosts from adding and using “NFS Share”.

Also it’s possible to use “NFS Shares” with both “Root Access Disallowed” and “Root Access Allowed” configuration.

VMware vSphere 5.1

No comments

Few days back, “VMware, Inc.” has released newest version of “VMware vSphere” (Sept 10, 2012) and in this post, I want to share some links for documents, pages and posters.

All in one place:
Thanks to “Eric Siebert“, Here is a another great post on his site (vSphere-Land) which will help you find all links for applications, documents and KB and lots more.

Pages:
VMware vSphere PowerCLI ( Link )
VMware vSphere Command-Line Interface [vCLI] ( Link )
VMware vSphere Management Assistant [vMA] ( Link )

Applications:
VMware vSphere PowerCLI ( Main, Tenant )
VMware vSphere Command-Line Interface [vCLI] ( Main )
VMware vSphere Management Assistant [vMA] ( Link )

Documentation:
VMware vSphere PowerCLI ( Main, Tenant )
VMware vSphere Command-Line Interface [vCLI] ( Main )
VMware vSphere Management Assistant [vMA] ( Link )

Posters:
VMware vSphere PowerCLI 5.1 Poster ( Page, PDF )
VMware vCloud Networking Poster ( Page, PDF )

This post a little different from my other posts here and title might look unrelated but here the story.

I’ve made a little online presentation (road map) using “SlideRocket” for “Microsoft Certifications” and I’m going to update time to time based on “Microsoft” announcements.
When I tried to place it here (tested both post and page), I just found out “WordPress” is not supporting “iframes” for some reasons so after searching for solution online (instead of looking for it in “SildeRocket” Support portal) I found multiple plugins for handling this situation and bellow you can find some of them; I’ve chosen “iframes” plugin just based on its information on “Other Notes” tab.

  1. iframes
  2. embed-iframe
  3. Advanced iframe
  4. Iframe Preserver

And now, here is the presentation; it’s based on certifications related to “Windows Server 2012″ and it made on “June 8, 2012″.

If you are interested on “Microsoft Certification” you can check “Microsoft Learning” or visiting/bookmarking this link as I’m going to keep it simple and update.

I’m working on new SMB project which need running application remotely and I thought it’s good time to work on “Microsoft Remote Desktop Service” on “Windows Server 2008 R2 SP1″.
In this case, server should be configured in a way to present application for remote access and here I came up with idea of presenting “VMware PowerCLI” for remote access to the lab, this way it will save some bandwidth and speed up the whole process.
Well, There might be (guess there’s) a way for connecting to Other server and use PowerCLI remotely but I didn’t look for it yet, so for those who know the way, it might look super-complex way of doing simple work.  :wink:

Bellow, you can find related steps I’ve taken so far …

  • Currently 3.1/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Update #1
I Found this post by “Niklas” ( @vniklas ) about “PowerShell Web Access” on “Windows Server 2012″.

Yesterday “June 04, 2012″, “Veeam Software, Inc.” has released one new awesome product.
This product is based on newer version of their award-winning product, “Veeam Backup & Replication” with no host, physical socket or virtual machine limitation (Free Edition).

And here, just part of great news about “Free Edition”:

  • Backup & Recover VMs form Environments based on both hypervisor (VMware and Microsoft)
  • Support both managed and standalone hosts (VMware vCenter/Microsoft SCVMM).
  • Do Compression and Deduplication (included my own result in screen shot)
  • Recover file/files from VM
  • Recover file/files from guest OS inside VM
  • And now, it’s possible to “Migrate VMs between hosts and/or datastores

One other great thing about “Veeam Backup Free Edition” is the upgrade path (from administration point of view), there’s no need to uninstall/re-install this software if the license bought latter, just enter the license in the software and use same UI* and same system.
* Some features/options might not be shown in “Free Edition” but they would be shown as soon as software get proper license.  :wink:

New product got lots of improvement from new interface, Veeam ZIP, capability of migrating live VMs and lot more.
Bellow I’ve attached few screen shots from internally ran beta version on my lab but I highly recommend to get it yourself and work with it, sure you’d love it as well!

  • Currently 3.1/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Here, are some review and posts from VMware Experts, vExperts, SME and …

This new product can be found by this link and for comparison of “Free Edition vs. Full (paid) Edition” this PDF can be used.

“VMware” has been released new three PowerPoint files which contains cool diagrams as well as product icons and images which is a great resource for creating new presentations.
You can simply download these three files from this link.

 

Note:
This document was created using the official VMware icon and diagram library. Copyright © 2012 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents.

VMware does not endorse or make any representations about  third party information included in this document, nor does the inclusion of any VMware icon or diagram in this document imply such an endorsement.