<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Hypervisor.fr &#187; vmdk</title>
	<atom:link href="http://www.hypervisor.fr/?feed=rss2&#038;tag=vmdk" rel="self" type="application/rss+xml" />
	<link>http://www.hypervisor.fr</link>
	<description>French Bare-Metal weblog</description>
	<lastBuildDate>Wed, 26 Jun 2024 22:42:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Disk UUID match VMware/Windows &#8211; MAJ</title>
		<link>http://www.hypervisor.fr/?p=5070</link>
		<comments>http://www.hypervisor.fr/?p=5070#comments</comments>
		<pubDate>Wed, 23 Apr 2014 18:16:22 +0000</pubDate>
		<dc:creator>NiTRo</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[UUID]]></category>
		<category><![CDATA[vmdk]]></category>
		<category><![CDATA[Win32]]></category>
		<category><![CDATA[WMI]]></category>

		<guid isPermaLink="false">http://www.hypervisor.fr/?p=5070</guid>
		<description><![CDATA[MAJ 21/05/2014 : Mise à jour du script (version 1.2) : Ajout de la taille des disk VMware/Windows

MAJ 25/04/2014 : Mise à jour du script (version 1.1) : A la demande express de notre ami DR, nous avons rajouté le paramètre -VIX pour faire la requête WMI via les vmtools et le paramètre -noSSO pour [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><em><span style="color: #ff0000;">MAJ 21/05/2014</span> : Mise à jour du script (version 1.2) : Ajout de la taille des disk VMware/Windows</em></p>
<p style="text-align: center;"><a href="http://files.hypervisor.fr/img/Get-VMWinUUIDMap/Get-VMWinUUIDMap_grid_size.png"><img class="aligncenter" src="http://files.hypervisor.fr/img/Get-VMWinUUIDMap/Get-VMWinUUIDMap_grid_size.png" alt="" width="500" height="334" /></a></p>
<p style="text-align: justify;"><span style="color: #ff0000;">MAJ 25/04/2014</span><span style="font-style: italic;"> : Mise à jour du script (version 1.1) : A la demande express de notre ami DR, nous avons rajouté </span><strong>le paramètre -VIX pour faire la requête WMI via les vmtools</strong><span style="font-style: italic;"> et le paramètre -noSSO pour spécifier des credentials autre que ceux de votre session courante. A ce propos, et à notre plus grande surprise, </span><strong>la cmdlet Invoke-VMScript semble dorénavant supporter le SSO </strong><span style="font-style: italic;">donc si votre compte AD à les bons droits sur le vCenter et dans le GuestOS, plus besoin du paramètre &#8220;GuestCredential&#8221; pour faire du VIX !</span></p>
<p style="text-align: center;"><em><em><a href="http://files.hypervisor.fr/img/Get-VMWinUUIDMap/VIX_SSO.png"><img class="aligncenter" src="http://files.hypervisor.fr/img/Get-VMWinUUIDMap/VIX_SSO.png" alt="" width="510" height="193" /></a><br />
</em></em></p>
<p style="text-align: justify;">Lorsqu&#8217;on vous demande de retirer quelques disques d&#8217;une VM Windows qui en possède une cinquantaine, c&#8217;est généralement le début d&#8217;une longue chasse où on essaye de faire correspondre <a href="http://kb.vmware.com/kb/2021947" target="_blank">les id scsi</a>, <a href="http://kb.vmware.com/kb/2051606" target="_blank">les contrôleurs</a> ou les tailles de volume quand on est vraiment au bout du rouleau&#8230;</p>
<p style="text-align: justify;">Il y a bien <a href="https://communities.vmware.com/docs/DOC-12180" target="_blank">des scripts PowerCLI</a> pour surmonter la tâche mais l&#8217;élément de référence est toujours l&#8217;<strong>id scsi</strong> ce qui pose parfois des problèmes comme ça l&#8217;à été pour nous lors d&#8217;une opération similaire :</p>
<p style="text-align: center;"><a href="http://files.hypervisor.fr/img/Get-VMWinUUIDMap/disk_mgmt_win_disk.png" title="disk_mgmt_win_disk" rel="lightbox[5070]"><img class="alignnone size-thumbnail wp-image-5072" title="disk_mgmt_win_disk" src="http://www.hypervisor.fr/wp-content/uploads/2014/04/disk_mgmt_win_disk-150x150.png" alt="" width="150" height="150" /></a> <a href="http://files.hypervisor.fr/img/Get-VMWinUUIDMap/scsi_id_win_disk.png" title="scsi_id_win_disk" rel="lightbox[5070]"><img class="alignnone size-thumbnail wp-image-5073" title="scsi_id_win_disk" src="http://www.hypervisor.fr/wp-content/uploads/2014/04/scsi_id_win_disk-150x150.png" alt="" width="150" height="150" /></a> <a href="http://files.hypervisor.fr/img/Get-VMWinUUIDMap/scsi_id_vm_disk.png" title="scsi_id_vm_disk" rel="lightbox[5070]"><img class="alignnone size-thumbnail wp-image-5074" title="scsi_id_vm_disk" src="http://www.hypervisor.fr/wp-content/uploads/2014/04/scsi_id_vm_disk-150x150.png" alt="" width="150" height="150" /></a></p>
<p style="text-align: justify;"><a href="http://kb.vmware.com/kb/2051606">Une kb VMware</a> décrit comment faire une correspondance via le device manager de windows (et non pas le disk manager) mais où il faut chercher à la main la propriété &#8220;location&#8221; qui correspond au contrôleur scsi :</p>
<blockquote><p>To correlate the virtual device node SCSI controller to the Windows drive letter. Each controller increments by 32.<br />
The first SCSI controller is given a location ID of 160. Therefore the second controller is 192, 224 for the third and 256 for the fourth.</p></blockquote>
<p style="text-align: justify;">Nous vous laissons apprécier l&#8217;ampleur de la tache lorsqu&#8217;on a plusieurs disques à détacher :</p>
<p style="text-align: center;"><a href="http://files.hypervisor.fr/img/Get-VMWinUUIDMap/dev_mgmt_win_disk.png" title="dev_mgmt_win_disk" rel="lightbox[5070]"><img class="alignnone size-thumbnail wp-image-5075" title="dev_mgmt_win_disk" src="http://www.hypervisor.fr/wp-content/uploads/2014/04/dev_mgmt_win_disk-150x150.png" alt="" width="150" height="150" /></a> <a href="http://files.hypervisor.fr/img/Get-VMWinUUIDMap/scsi_location_win_disk.png" title="scsi_location_win_disk" rel="lightbox[5070]"><img class="alignnone size-thumbnail wp-image-5076" title="scsi_location_win_disk" src="http://www.hypervisor.fr/wp-content/uploads/2014/04/scsi_location_win_disk-150x150.png" alt="" width="150" height="150" /></a> <a href="http://files.hypervisor.fr/img/Get-VMWinUUIDMap/scsi_dev_win_disk.png" title="scsi_dev_win_disk" rel="lightbox[5070]"><img class="alignnone size-thumbnail wp-image-5077" title="scsi_dev_win_disk" src="http://www.hypervisor.fr/wp-content/uploads/2014/04/scsi_dev_win_disk-150x150.png" alt="" width="150" height="150" /></a></p>
<p style="text-align: left;">
<p>En cherchant un peu sérieusement, nous avons trouver un point commun parfaitement identique entre Hard disk et PHYSICALDRIVE : l&#8217;<strong><a href="http://pubs.vmware.com/vsphere-55/topic/com.vmware.wssdk.apiref.doc/vim.vm.device.VirtualDisk.FlatVer2BackingInfo.html" target="_blank">UUID</a></strong> (ou SerialNumber sous Windows). Un petit coup de PowerCLI plus tard, on obtient un beau tableau pour faire la correspondance sans risque (avec le chemin du vmdk en bonus) :</p>
<p style="text-align: center;"><a href="http://files.hypervisor.fr/img/Get-VMWinUUIDMap/Get-VMWinUUIDMap_grid.png"><img class="aligncenter" src="http://files.hypervisor.fr/img/Get-VMWinUUIDMap/Get-VMWinUUIDMap_grid.png" alt="" width="452" height="433" /></a></p>
<p style="text-align: justify;"><strong>Les prérequis du script sont que vous soyez connecté au bon vcenter et que vous puissiez accéder en WMI à la VM en question</strong> (si le FQDN de la vm ne correspond pas à son nom, il faut utiliser le paramètre -winname). Le paramètre -grid controle la sortie dans un GridView pour ceux qui n&#8217;aime par le style CLI :</p>
<p style="text-align: center;"><a href="http://files.hypervisor.fr/img/Get-VMWinUUIDMap/Get-VMWinUUIDMap_cli.png"><img class="aligncenter" src="http://files.hypervisor.fr/img/Get-VMWinUUIDMap/Get-VMWinUUIDMap_cli.png" alt="" width="422" height="386" /></a></p>
<p style="text-align: center;">
<div class="wp-caption aligncenter" style="width: 110px"><a href="http://files.hypervisor.fr/img/Get-VMWinUUIDMap/Get-VMWinUUIDMap.ps1" target="_blank"><img class="  " title="Get-VMWinUUIDMap" src="http://files.hypervisor.fr/img/super_mario_piranha_plant.png" alt="" width="100" height="100" /></a><p class="wp-caption-text">Get-VMWinUUIDMap</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.hypervisor.fr/?feed=rss2&amp;p=5070</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Thin provisioning : inGuest vs outGuest</title>
		<link>http://www.hypervisor.fr/?p=4857</link>
		<comments>http://www.hypervisor.fr/?p=4857#comments</comments>
		<pubDate>Tue, 03 Sep 2013 23:47:35 +0000</pubDate>
		<dc:creator>NiTRo</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[overcommit]]></category>
		<category><![CDATA[thin provisioning]]></category>
		<category><![CDATA[TRIM]]></category>
		<category><![CDATA[UNMAP]]></category>
		<category><![CDATA[vmdk]]></category>

		<guid isPermaLink="false">http://www.hypervisor.fr/?p=4857</guid>
		<description><![CDATA[Quand on joue un peu trop &#8220;le cowboy de l&#8217;overcommit&#8221;, on peut se retrouver dans une situation où les VM et donc les datastore sont pleins de vide : les filesystem des VM ont été rempli au moins une  fois mais ont été vidé depuis. Il y a plusieurs moyens de palier à cela [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Quand on joue un peu trop &#8220;le cowboy de l&#8217;overcommit&#8221;, on peut se retrouver dans une situation où les VM et donc les datastore sont <strong>pleins de vide</strong> : les filesystem des VM ont été rempli au moins une  fois mais ont été vidé depuis. Il y a plusieurs moyens de palier à cela mais avant il est intéressant de savoir quelle volumétrie serait récupérable. Donc on a fait péter le oneliner :</p>
<pre class="brush: powershell; title: ; notranslate">Get-View -ViewType virtualmachine -Property Name, Summary, Config, Guest|?{!$_.snapshot -and $_.Guest.GuestFamily -eq &quot;windowsGuest&quot; -and $_.Guest.ToolsRunningStatus -eq &quot;guestToolsRunning&quot;}|?{!($_.Config.Hardware.Device|?{$_ -is [VMware.Vim.VirtualDisk]}|?{$_.Backing.ThinProvisioned}) -eq $false}|select name, @{n=&quot;GuestId&quot;;e={$_.Guest.GuestId}}, @{n=&quot;vmdkCommitted&quot;;e={[math]::round($_.Summary.Storage.Committed/1GB,1)}}, @{n=&quot;GuestCommitted&quot;;e={[math]::round(($_.Guest.Disk|%{$_.Capacity - $_.FreeSpace})/1GB,1)}}, @{n=&quot;ThinDiff&quot;;e={[math]::round((($_.Summary.Storage.Committed - (($_.Config.Hardware.MemoryMB*1MB - $_.Config.MemoryAllocation.Reservation) + $_.Config.InitialOverhead.InitialSwapReservation)) - ($_.Guest.Disk|%{$_.Capacity - $_.FreeSpace}))/1GB,1)}}|?{$_.ThinDiff -gt 20}|Out-GridView</pre>
<p style="text-align: justify;">Ce petit bout de script vous affichera un beau tableau des VM (windows uniquement &#8211; pour l&#8217;instant) dont la différence entre la taille commitée outGuest (vmdk) et inGuest (ntfs) est supérieure à 20Go.</p>
<p style="text-align: center;"><a href="http://files.hypervisor.fr/img/ThinDiff.png"><img class="aligncenter" src="http://files.hypervisor.fr/img/ThinDiff.png" alt="" width="441" height="494" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hypervisor.fr/?feed=rss2&amp;p=4857</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>7zip lit les vmdk</title>
		<link>http://www.hypervisor.fr/?p=4585</link>
		<comments>http://www.hypervisor.fr/?p=4585#comments</comments>
		<pubDate>Tue, 08 Jan 2013 23:20:16 +0000</pubDate>
		<dc:creator>NiTRo</dc:creator>
				<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[7zip]]></category>
		<category><![CDATA[vmdk]]></category>

		<guid isPermaLink="false">http://www.hypervisor.fr/?p=4585</guid>
		<description><![CDATA[C&#8217;est totalement par hasard que nous avons découvert avec que 7zip pouvait ouvrir les vmdk (les -flat.vmdk uniquement) :

Par contre, nous n&#8217;avons pu naviguer que dans des partitions FAT ou NTFS sans pouvoir les modifier&#8230;
]]></description>
			<content:encoded><![CDATA[<p>C&#8217;est totalement par hasard que nous avons découvert avec que 7zip pouvait ouvrir les vmdk (les -flat.vmdk uniquement) :</p>
<p style="text-align: center;"><a href="http://files.hypervisor.fr/img/7zip/7z_vmdk_w2k12_ntfs_in.png" target="_blank"><img class="aligncenter" src="http://files.hypervisor.fr/img/7zip/7z_vmdk_w2k12_ntfs_in.png" alt="" width="512" height="276" /></a></p>
<p style="text-align: left;">Par contre, nous n&#8217;avons pu naviguer que dans des partitions FAT ou NTFS sans pouvoir les modifier&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hypervisor.fr/?feed=rss2&amp;p=4585</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Alarme vCenter pour les snapshots mal consolidés</title>
		<link>http://www.hypervisor.fr/?p=4089</link>
		<comments>http://www.hypervisor.fr/?p=4089#comments</comments>
		<pubDate>Thu, 30 Aug 2012 22:11:53 +0000</pubDate>
		<dc:creator>NiTRo</dc:creator>
				<category><![CDATA[Performance]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[alarm]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[snapshot]]></category>
		<category><![CDATA[vmdk]]></category>

		<guid isPermaLink="false">http://www.hypervisor.fr/?p=4089</guid>
		<description><![CDATA[A la sortie de vSphere 5, la fonctionnalité bien sympathique &#8221;consolidate&#8221; faisait son apparition dans le menu snapshot. Destinée à être utilisé lorsque une consolidation de snapshot (delete/delete all) s&#8217;est mal passée, elle est accompagnée d&#8217;un petit message d&#8217;avertissement au niveau de la VM :

Malheureusement il faut être sur la vm pour voir ce message, d&#8217;où l&#8217;idée d&#8217;un ami champion de badminton de faire [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">A la sortie de vSphere 5, <a href="http://blogs.vmware.com/vsphere/2011/08/consolidate-snapshots.html" target="_blank">la fonctionnalité bien sympathique &#8221;consolidate&#8221; faisait son apparition dans le menu snapshot</a>. Destinée à être utilisé lorsque une consolidation de snapshot (delete/delete all) s&#8217;est mal passée, elle est accompagnée d&#8217;un petit message d&#8217;avertissement au niveau de la VM :</p>
<p style="text-align: justify;"><img class="aligncenter" src="http://files.hypervisor.fr/img/vmdk_consolidation_issue.png" alt="" width="387" height="155" /></p>
<p style="text-align: justify;">Malheureusement il faut être sur la vm pour voir ce message, d&#8217;où l&#8217;idée d&#8217;un ami champion de badminton de faire une alarme pour remonter cet event !</p>
<p style="text-align: justify;">Ni une, ni deux, un petit oneliner qui va créer la précieuse alarme :</p>
<pre class="brush: powershell; title: ; notranslate">if (!((Get-View AlarmManager).GetAlarm((Get-Folder -NoRecursion |Get-View).MoRef)|?{(get-view $_).info.name -match &quot;VM disks consolidation is needed&quot;})){(Get-View AlarmManager).CreateAlarm((Get-Folder -NoRecursion |Get-View).MoRef,(New-Object VMware.Vim.AlarmSpec -Property @{Name = &quot;VM disks consolidation is needed&quot;;Description = &quot;Custom alarm to monitor com.vmware.vc.VmDiskConsolidationNeeded event&quot;;Enabled = $true;expression = (New-Object VMware.Vim.OrAlarmExpression -Property @{expression = @((New-Object VMware.Vim.EventAlarmExpression -Property @{eventType = &quot;EventEx&quot;;EventTypeId = &quot;com.vmware.vc.VmDiskConsolidationNeeded&quot;;objectType = &quot;VirtualMachine&quot;;status = &quot;red&quot;});(New-Object VMware.Vim.EventAlarmExpression -Property @{eventType = &quot;EventEx&quot;;EventTypeId = &quot;com.vmware.vc.VmDiskConsolidatedEvent&quot;;objectType = &quot;VirtualMachine&quot;;status = &quot;green&quot;}))});Action=(New-Object VMware.Vim.GroupAlarmAction -Property @{Action= (New-Object VMware.Vim.AlarmTriggeringAction -Property @{Action = (New-Object VMware.Vim.SendEmailAction -Property @{ToList = &quot;admin@vmware.local&quot;;Subject = &quot;[vAlarm] {targetName} VM disks consolidation is needed - {newStatus}&quot;;CcList = &quot;&quot;;Body = &quot;&quot;});TransitionSpecs = @((New-Object VMware.Vim.AlarmTriggeringActionTransitionSpec -Property @{StartState = &quot;yellow&quot;;FinalState = &quot;red&quot;;Repeats = $false}))})});ActionFrequency = &quot;1800&quot;}))}</pre>
<p>Comme d&#8217;hab, il faut remplacer &#8220;admin@vmare.local&#8221; par le mail qui vous convient et rajouter (ou remplacer) un envoi de trap snmp si besoin. Cette alarme s&#8217;auto-acquittera lorsque la consolidation sera réussie :</p>
<p><img class="aligncenter" src="http://files.hypervisor.fr/img/vmdk_consolidation.png" alt="" width="411" height="187" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hypervisor.fr/?feed=rss2&amp;p=4089</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[PSH] Raiders of the Lost VM files &#8211; MAJ</title>
		<link>http://www.hypervisor.fr/?p=3612</link>
		<comments>http://www.hypervisor.fr/?p=3612#comments</comments>
		<pubDate>Fri, 24 Feb 2012 08:47:20 +0000</pubDate>
		<dc:creator>NiTRo</dc:creator>
				<category><![CDATA[VMware]]></category>
		<category><![CDATA[ZFS]]></category>
		<category><![CDATA[CBT]]></category>
		<category><![CDATA[oneliner]]></category>
		<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[snapshot]]></category>
		<category><![CDATA[vmdk]]></category>
		<category><![CDATA[VMFS]]></category>
		<category><![CDATA[vmx]]></category>

		<guid isPermaLink="false">http://www.hypervisor.fr/?p=3612</guid>
		<description><![CDATA[MAJ 23/05/2015 : Mise à jours des scripts pour exclure que les fichiers &#8220;.lck&#8221; (VSAN).
MAJ 30/10/2012 : Mise à jours des scripts pour n&#8217;exclure que les vm &#8220;invalid&#8221; ou &#8220;orphaned&#8221;.
MAJ 06/07/2012 : Mise à jour des scripts pour exclure &#8220;*/hostCache/*&#8221; pour ne pas remonter les fichiers vswp de la fonction Host Cache d&#8217;ESXi 5.
MAJ 05/07/2012 [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><em><span style="color: #ff0000;">MAJ 23/05/2015</span> : Mise à jours des scripts pour exclure que les fichiers &#8220;.lck&#8221; (VSAN).</em></p>
<p style="text-align: justify;"><em><span style="color: #ff0000;">MAJ 30/10/2012</span> : Mise à jours des scripts pour n&#8217;exclure que les vm &#8220;invalid&#8221; ou &#8220;orphaned&#8221;.</em></p>
<p style="text-align: justify;"><em><span style="color: #ff0000;">MAJ 06/07/2012</span> : Mise à jour des scripts pour exclure &#8220;*/hostCache/*&#8221; pour ne pas remonter <a href="http://www.yellow-bricks.com/2011/08/18/swap-to-host-cache-aka-swap-to-ssd/" target="_blank">les fichiers vswp de la fonction Host Cache d&#8217;ESXi 5</a>.</em></p>
<p style="text-align: justify;"><em><span style="color: #ff0000;">MAJ 05/07/2012</span> : Mise à jour des scripts pour intégrer les fichiers vswp.xxxxxx, <a href="http://vmice.wordpress.com/2012/07/04/vm-swapfiles-leftover-swapfiles/" target="_blank">merci à Larus Hjartarson pour l&#8217;idée</a>.</em></p>
<p style="text-align: justify;"><em><span style="color: #ff0000;">MAJ 21/03/2012</span> : Mise à jour des scripts pour exclure &#8220;var/tmp/cache&#8221; dans le cas d&#8217;une redirection de la partition scratch sur un datastore.</em></p>
<p style="text-align: justify;"><em><span style="color: #ff0000;">MAJ 06/03/2012</span> : Mise à jour des scripts pour le support des <strong>multi-datacenter/multi-vcenter</strong>, des snapshot NetApp et des fichiers zdump qui trainent.</em></p>
<p style="text-align: center;"><em><a href="http://files.hypervisor.fr/img/lostvmfilemulti.png" target="_blank"><img class="aligncenter" src="http://files.hypervisor.fr/img/lostvmfilemulti.png" alt="" width="521" height="379" /></a><br />
</em></p>
<p style="text-align: justify;"><em><span style="color: #ff0000;">MAJ 28/02/2012</span><em> :</em></em><em> Mise à jour des scripts suite à une erreur dans le &#8220;SideIndicator&#8221;</em></p>
<p style="text-align: justify;"><em><span style="color: #ff0000;">MAJ 24/02/2012</span><em> : </em></em><em>Et pour ceux qui ont <strong>*<span style="color: #ff0000;">VRAIMENT</span>*</strong> confiance, voici le script pour supprimer les fichiers vswp orphelins (et si vraiment vous en avez, vous pouvez changer le filtrage au niveau du </em><strong>|?{$_.lostfile -match &#8220;vswp&#8221;}</strong>)<em> :</em></p>
<pre class="brush: powershell; title: ; notranslate">foreach ($lost in (compare -passthru -property path $(foreach ($ds in ((get-view -ViewType datastore|sort name -unique|?{$_.summary.accessible}|%{(get-view $_.browser).SearchDatastoreSubFolders($(&quot;[&quot; + $_.Name + &quot;]&quot;),(New-Object VMware.Vim.HostDatastoreBrowserSearchSpec -property @{matchPattern=(&quot;*zdump*&quot;,&quot;*.xml&quot;,&quot;*.vmsn&quot;,&quot;*.vmsd&quot;,&quot;*.vswp*&quot;, &quot;*.vmx&quot;,&quot;*.vmdk&quot;,&quot;*.vmss&quot;,&quot;*.nvram&quot;,&quot;*.vmxf&quot;); details=(New-Object VMware.Vim.FileQueryFlags -property @{filesize=$true;modification=$true})}))})|?{$_.file})){foreach ($files in $ds.file){$files|?{$_.Path -notmatch &quot;-ctk.vmdk|esxconsole.vmdk|esxconsole-flat.vmdk&quot;}|select @{n=&quot;path&quot;;e={$ds.FolderPath + $files.path|%{$_ -replace &quot; &quot;,&quot;&quot;}}},FileSize,Modification|?{$_.path -notmatch &quot;.zfs|.snapshot|var/tmp/cache|/hostCache/|.lck&quot;}}}) $(get-view -ViewType virtualmachine|?{$_.Runtime.ConnectionState -notmatch &quot;invalid|orphaned&quot;}|%{$_.layoutex.file}|?{$_.type -ne &quot;log&quot;}|%{$_.name}|%{$_ -replace &quot; &quot;,&quot;&quot;}|sort -unique|select @{n=&quot;path&quot;;e={$_}})|?{$_.SideIndicator -eq &quot;&lt;=&quot;}|select @{n=&quot;LostFile&quot;;e={$_.Path -replace &quot;]&quot;,&quot;] &quot;}}, @{n=&quot;FileSize&quot;;e={&quot;{0:N0}&quot; -f ($_.FileSize/1MB)}}, Modification|?{$_.lostfile -match &quot;vswp&quot;})){(get-view (Get-View ServiceInstance|select -first 1).content.filemanager|select -first 1).DeleteDatastoreFile($lost.LostFile,(Get-View -ViewType datacenter|?{$_.Datastore -match (get-datastore $lost.LostFile.split(&quot;[]&quot;)[1]|get-view).moref}|select -first 1).moref)}</pre>
<p style="text-align: justify;"><em><span style="color: #ff0000;">MAJ 24/02/2012</span> : Mise à jour du script pour afficher la taille en <strong>MegaBytes</strong> et la date de modification des fichiers.</em></p>
<p style="text-align: justify;">Très fortement inspiré du célèbre <a href="http://www.lucd.info/2011/08/11/vmx-raiders-revisited/" target="_blank">Raiders of the Lost VMX</a> (mais aussi du post <a href="http://www.lucd.info/2011/04/25/orphaned-files-and-folders-spring-cleaning/" target="_blank">Orphaned files and folders – Spring cleaning</a>) de LucD, nous avons enfin fini de finioler un oneliner PowerCLI qui va vous <strong>lister les fichiers .xml, .vmsn, .vmsd, .vswp, .vmx, .vmdk, .vmss, .nvram et .vmxf qui traînent sur vos datastores</strong> et qui ne sont pas rattachés à une quelconque vm du vcenter depuis lequel vous avez exécuté le script.</p>
<pre class="brush: powershell; title: ; notranslate">compare -passthru -property path $(foreach ($ds in ((get-view -ViewType datastore|sort name -unique|?{$_.summary.accessible}|%{(get-view $_.browser).SearchDatastoreSubFolders($(&quot;[&quot; + $_.Name + &quot;]&quot;),(New-Object VMware.Vim.HostDatastoreBrowserSearchSpec -property @{matchPattern=(&quot;*zdump*&quot;,&quot;*.xml&quot;,&quot;*.vmsn&quot;,&quot;*.vmsd&quot;,&quot;*.vswp*&quot;, &quot;*.vmx&quot;,&quot;*.vmdk&quot;,&quot;*.vmss&quot;,&quot;*.nvram&quot;,&quot;*.vmxf&quot;); details=(New-Object VMware.Vim.FileQueryFlags -property @{filesize=$true;modification=$true})}))})|?{$_.file})){foreach ($files in $ds.file){$files|?{$_.Path -notmatch &quot;-ctk.vmdk|esxconsole.vmdk|esxconsole-flat.vmdk&quot;}|select @{n=&quot;path&quot;;e={$ds.FolderPath + $files.path|%{$_ -replace &quot; &quot;,&quot;&quot;}}},FileSize,Modification|?{$_.path -notmatch &quot;.zfs|.snapshot|var/tmp/cache|/hostCache/|.lck&quot;}}}) $(get-view -ViewType virtualmachine|?{$_.Runtime.ConnectionState -notmatch &quot;invalid|orphaned&quot;}|%{$_.layoutex.file}|?{$_.type -ne &quot;log&quot;}|%{$_.name}|%{$_ -replace &quot; &quot;,&quot;&quot;}|sort -unique|select @{n=&quot;path&quot;;e={$_}})|?{$_.SideIndicator -eq &quot;&lt;=&quot;}|select @{n=&quot;LostFile&quot;;e={$_.Path -replace &quot;]&quot;,&quot;] &quot;}}, @{n=&quot;FileSize&quot;;e={&quot;{0:N0}&quot; -f ($_.FileSize/1MB)}}, Modification|ft -autosize</pre>
<p style="text-align: justify;">Les snapshots ZFS (.zfs/snapshot), les fichiers -ctk.vmdk (fichiers CBT) et les vmdk des COS d&#8217;ESX classic (esxconsole-) sont filtrés, n&#8217;hésitez pas à nous remonter d&#8217;autres faux positifs que vous pourriez rencontrer. <span style="text-decoration: line-through;">Prochaine étape : ménage automatique&#8230;</span></p>
<p style="text-align: center;"><a href="http://files.hypervisor.fr/img/lostvmfile_full.png" target="_blank"><img class="aligncenter" src="http://files.hypervisor.fr/img/lostvmfiles.png" alt="" width="521" height="287" /></a></p>
<p style="text-align: center;"><a href="http://files.hypervisor.fr/img/lostvmfilesize.png" target="_blank"><img class="aligncenter" src="http://files.hypervisor.fr/img/lostvmfilesize.png" alt="" width="504" height="125" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hypervisor.fr/?feed=rss2&amp;p=3612</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Unable to access file  since it is locked</title>
		<link>http://www.hypervisor.fr/?p=2900</link>
		<comments>http://www.hypervisor.fr/?p=2900#comments</comments>
		<pubDate>Mon, 25 Apr 2011 23:03:10 +0000</pubDate>
		<dc:creator>NiTRo</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[lock]]></category>
		<category><![CDATA[SAN]]></category>
		<category><![CDATA[snapshot]]></category>
		<category><![CDATA[vmdk]]></category>
		<category><![CDATA[VMFS]]></category>
		<category><![CDATA[vmx]]></category>

		<guid isPermaLink="false">http://www.hypervisor.fr/?p=2900</guid>
		<description><![CDATA[Suite a une grosse coupure de SAN, nous avons du faire face à des &#8220;power on&#8221; récalcitrants avec lesquels nous avions déjà eu affaires lors de coupures réseaux sur du stockage NFS ou iSCSI :



N&#8217;importe lequel de ces messages vous mènera aux forums VMware, sur des blogs ou même à cette kb qui précise justement ce que nous allons [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Suite a une grosse coupure de SAN, nous avons du faire face à des &#8220;power on&#8221; récalcitrants avec lesquels nous avions déjà eu affaires lors de coupures réseaux sur du stockage NFS ou iSCSI :</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-2901" title="SS-2011-04-25_23.19.25" src="http://www.hypervisor.fr/wp-content/uploads/2011/04/SS-2011-04-25_23.19.25.png" alt="" width="526" height="38" /></p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-2905" title="SS-2011-04-25_23.13.41" src="http://www.hypervisor.fr/wp-content/uploads/2011/04/SS-2011-04-25_23.13.41.png" alt="" width="572" height="74" /></p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-2904" title="SS-2011-04-25_23.19.13" src="http://www.hypervisor.fr/wp-content/uploads/2011/04/SS-2011-04-25_23.19.13.png" alt="" width="571" height="72" /></p>
<p style="text-align: justify;">N&#8217;importe lequel de ces messages vous mènera aux <a href="http://communities.vmware.com/message/909582" target="_blank">forums VMware</a>, sur <a href="http://www.zealkabi.com/2008/10/unable-to-start-vm-unable-to-access.html" target="_blank">des blogs</a> ou même à <a href="http://kb.vmware.com/kb/10051" target="_blank">cette kb</a> qui précise justement ce que nous allons prendre à contre pied :</p>
<blockquote><p>Because a virtual machine can be moved between hosts, the host where the virtual machine is currently registered may not be the host maintaining the file lock. The lock must be released by the ESX host that owns the lock</p></blockquote>
<p style="text-align: justify;">Le point commun de ces troubleshooting est l&#8217;objectif de <strong>faire sauter le lock</strong> du ou des fichiers, ce qui parait tout à fait censé et que nous avons d&#8217;ailleurs déjà suivi par le passé en essayant aussi de redémarrer le service hostd en masse grâce à <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/" target="_blank">plink</a> (ou esxi.txt est la liste des fqdn) avant de redémarrer l&#8217;ESX en dernier recours :</p>

<div class="wp_syntax"><div class="code"><pre class="dos" style="font-family:monospace;"><span style="color: #33cc33;">@</span><span style="color: #b1b100; font-weight: bold;">echo</span> off
<span style="color: #00b100; font-weight: bold;">FOR</span> /F <span style="color: #33cc33;">%%</span><span style="color: #448888;">i</span> <span style="color: #00b100; font-weight: bold;">in</span> <span style="color: #33cc33;">(</span>esxi.txt<span style="color: #33cc33;">)</span> <span style="color: #00b100; font-weight: bold;">do</span> <span style="color: #00b100; font-weight: bold;">call</span> :<span style="color: #b100b1; font-weight: bold;">plink</span> <span style="color: #33cc33;">%%</span><span style="color: #448888;">i</span>
:<span style="color: #b100b1; font-weight: bold;">plink</span>
&quot;C:\Program Files <span style="color: #33cc33;">(</span>x86<span style="color: #33cc33;">)</span>\PuTTY\plink.exe&quot; -pw &quot;password&quot; root<span style="color: #33cc33;">@%</span><span style="color: #448888;">1</span> &quot;/sbin/services.sh restart&quot;
<span style="color: #00b100; font-weight: bold;">GOTO</span> End
:<span style="color: #b100b1; font-weight: bold;">Last</span>
:<span style="color: #b100b1; font-weight: bold;">End</span></pre></div></div>

<p style="text-align: justify;">Cette dernière étape est particulièrement longue et fastidieuse alors que, sauf cas exceptionnel, <strong>la solution &#8220;idéale&#8221; est de trouver le dernier ESX ayant fait tourné la vm</strong> (via le vmware.log ou grâce à <a href="http://www.hypervisor.fr/?p=1738" target="_blank">export régulier</a> des infos du vCenter), de passer DRS en manuel pour être prompté au démarrage de la VM et de selectionner le bon ESX :</p>
<p style="text-align: justify;"><a href="http://www.hypervisor.fr/wp-content/uploads/2011/04/SS-2011-04-25_23.14.03.png" title="SS-2011-04-25_23.14.03" rel="lightbox[2900]"><img class="aligncenter size-medium wp-image-2906" title="SS-2011-04-25_23.14.03" src="http://www.hypervisor.fr/wp-content/uploads/2011/04/SS-2011-04-25_23.14.03-300x123.png" alt="" width="300" height="123" /></a></p>
<p style="text-align: justify;">C&#8217;est tout simple mais ça marche très bien <img src='http://www.hypervisor.fr/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.hypervisor.fr/?feed=rss2&amp;p=2900</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
