The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,510 other followers

Archive for the ‘ESXi5.1’ Category

Using the partedUtil command line utility on ESXi and ESX (1036609) | VMware KB

Posted by jpluimers on 2019/03/13

Reminder to self when checking “new” disks to see what partitions they contain before formatting them as VMFS.

There is a truckload information at [WayBackUsing the partedUtil command line utility on ESXi and ESX (1036609) | VMware KB.

A few tips; example output is further below:

  • Disks are listed under /vmfs/devices/disks/ where there are two entries per device: a path leading to the device, and a link to that path which starts with vml. which I filter out with grep.
  • If a disk under under /vmfs/devices/disks/ ends with :# where # is a number, then it is a partition
  • Just skip partedUtil get as partedUtil getptblwill give you exactly the same information,
    • plus an extra initial line indicating what kind of partition table it is. KB 1036609 has a longer list, but these are the ones you usually see:
      • unknown: the disk has no partition table yet (usually), or the type of partition table cannot be determined (hardly)
      • gpt: there is a GUID Partition Table
      • msdos: there is a Master Boot Record partition table
    • on ESXi 6.x two extra columns listing the partition GUID and partition type description
  • The output of partedUtil is unformatted, which means it is easy to parse, but hard to read for humans. You can pipe through sed 's/ /\t/g' (as there is no tr on the ESXi busybox)

Some more background reading

On scripting:

  • The shell is sh (always been there)
  • There is Python (ESXi 5.1 has Python 2.7.8; ESXi 6.5 has Python 3.5.3; it has likely been available in earlier versions too).

On device names:

On errors:

    1. ~ # find /vmfs/devices/disks/ | grep T1500LM0032D9YH148
      /vmfs/devices/disks/t10.ATA_____ST1500LM0032D9YH148__________________________________Z110C4Q0a
      ~ # partedUtil getptbl /vmfs/devices/disks/t10.ATA_____ST1500LM0032D9YH148__________________________________Z110C4Q0
      unknown
      182401 255 63 2930277168
      ~ # 

I know of three VMFS types:

  • VMFS-3: Supported in ESXi 3.X, 4.X, 5.x & 6.x; deprecated as of 6.0 (cannot be created as of 6.0), has quite some limitations.
  • VMFS-4: got never released.
  • VMFS-5: Can be converted from VMFS-3
  • VMFS-6: Cannot be converted from other VMFS types

Some interesting links about the various VMFS types:

Busybox has been updated over time:

 

Examples and output

Example outputs on one of my systems, of which I stripped most of the disks as they’re not really relevant here.

[root@ESXi-X10SRH-CF:~] ls -1 /vmfs/devices/disks/ | grep -v '^vml\.'
naa.5000c50087762d1b
...
naa.600605b00aa054a0ff000021022683ae
naa.600605b00aa054a0ff000021022683ae:1
...
t10.ATA_____ST1500LM0032D9YH148__________________________________Z110C4Q0
t10.ATA_____Samsung_SSD_850_PRO_2TB_________________S2KMNCAGB04321L_____
t10.ATA_____Samsung_SSD_850_PRO_2TB_________________S2KMNCAGB04321L_____:1
...
t10.SanDisk00Ultra_Fit000000000000004C530001240406103372
t10.SanDisk00Ultra_Fit000000000000004C530001240406103372:1
t10.SanDisk00Ultra_Fit000000000000004C530001240406103372:5
t10.SanDisk00Ultra_Fit000000000000004C530001240406103372:6
t10.SanDisk00Ultra_Fit000000000000004C530001240406103372:7
t10.SanDisk00Ultra_Fit000000000000004C530001240406103372:8
t10.SanDisk00Ultra_Fit000000000000004C530001240406103372:9
[root@ESXi-X10SRH-CF:~] partedUtil getptbl /vmfs/devices/disks/t10.ATA_____ST1500LM0032D9YH148__________________________________Z110C4Q0 
unknown
182401 255 63 2930277168
[root@ESXi-X10SRH-CF:~] partedUtil get /vmfs/devices/disks/t10.ATA_____ST1500LM0032D9YH148__________________________________Z110C4Q0 
182401 255 63 2930277168
[root@ESXi-X10SRH-CF:~] partedUtil get /vmfs/devices/disks/t10.ATA_____SAMSUNG_MZHPV512HDGL2D00000______________S1X1NYAGB09589______
62260 255 63 1000215216
1 2048 1000214527 0 0
[root@ESXi-X10SRH-CF:~] partedUtil getptbl /vmfs/devices/disks/t10.ATA_____SAMSUNG_MZHPV512HDGL2D00000______________S1X1NYAGB09589______
gpt
62260 255 63 1000215216
1 2048 1000214527 AA31E02A400F11DB9590000C2911D1B8 vmfs 0
[root@ESXi-X10SRH-CF:~] partedUtil getptbl /vmfs/devices/disks/t10.SanDisk00Ultra_Fit000000000000004C530001240406103372
gpt
3738 255 63 60062500
1 64 8191 C12A7328F81F11D2BA4B00A0C93EC93B systemPartition 128
5 8224 520191 EBD0A0A2B9E5443387C068B6B72699C7 linuxNative 0
6 520224 1032191 EBD0A0A2B9E5443387C068B6B72699C7 linuxNative 0
7 1032224 1257471 9D27538040AD11DBBF97000C2911D1B8 vmkDiagnostic 0
8 1257504 1843199 EBD0A0A2B9E5443387C068B6B72699C7 linuxNative 0
9 1843200 7086079 9D27538040AD11DBBF97000C2911D1B8 vmkDiagnostic 0
[root@ESXi-X10SRH-CF:~] partedUtil get /vmfs/devices/disks/t10.SanDisk00Ultra_Fit000000000000004C530001240406103372
3738 255 63 60062500
1 64 8191 0 128
5 8224 520191 0 0
6 520224 1032191 0 0
7 1032224 1257471 0 0
8 1257504 1843199 0 0
9 1843200 7086079 0 0
[root@ESXi-X10SRH-CF:~] partedUtil getptbl /vmfs/devices/disks/t10.SanDisk00Ultra_Fit000000000000004C530001240406103372 | sed 's/ /\t/g'
gpt
3738    255 63  60062500
1   64  8191    C12A7328F81F11D2BA4B00A0C93EC93B    systemPartition 128
5   8224    520191  EBD0A0A2B9E5443387C068B6B72699C7    linuxNative 0
6   520224  1032191 EBD0A0A2B9E5443387C068B6B72699C7    linuxNative 0
7   1032224 1257471 9D27538040AD11DBBF97000C2911D1B8    vmkDiagnostic   0
8   1257504 1843199 EBD0A0A2B9E5443387C068B6B72699C7    linuxNative 0
9   1843200 7086079 9D27538040AD11DBBF97000C2911D1B8    vmkDiagnostic   0
[root@ESXi-X10SRH-CF:~] partedUtil get /vmfs/devices/disks/t10.SanDisk00Ultra_Fit000000000000004C530001240406103372 | sed 's/ /\t/g'
3738    255 63  60062500
1   64  8191    0   128
5   8224    520191  0   0
6   520224  1032191 0   0
7   1032224 1257471 0   0
8   1257504 1843199 0   0
9   1843200 7086079 0   0
[root@ESXi-X10SRH-CF:~] partedUtil --help
Usage: 
 Get Partitions : get  
 Set Partitions : set  ["partNum startSector endSector type attr"]* 
 Delete Partition : delete  
 Resize Partition : resize    
 Get Partitions : getptbl  
 Set Partitions : setptbl   ["partNum startSector endSector type/guid attr"]* 
 Fix Partition Table : fix  
 Create New Label (all existing data will be lost): mklabel   
 Show commonly used partition type guids : showGuids 
 Get usable first and last sectors : getUsableSectors  
 Fix GPT Table interactively : fixGpt  

[root@ESXi-X10SRH-CF:~] partedUtil showGuids
 Partition Type       GUID
 vmfs                 AA31E02A400F11DB9590000C2911D1B8
 vmkDiagnostic        9D27538040AD11DBBF97000C2911D1B8
 vsan                 381CFCCC728811E092EE000C2911D0B2
 virsto               77719A0CA4A011E3A47E000C29745A24
 VMware Reserved      9198EFFC31C011DB8F78000C2911D1B8
 Basic Data           EBD0A0A2B9E5443387C068B6B72699C7
 Linux Swap           0657FD6DA4AB43C484E50933C84B4F4F
 Linux Lvm            E6D6D379F50744C2A23C238F2A3DF928
 Linux Raid           A19D880F05FC4D3BA006743F0F84911E
 Efi System           C12A7328F81F11D2BA4B00A0C93EC93B
 Microsoft Reserved   E3C9E3160B5C4DB8817DF92DF00215AE
 Unused Entry         00000000000000000000000000000000
[root@ESXi-X10SRH-CF:~] cat /local/bin/what-is-my-shell.sh 
if test -n "$ZSH_VERSION"; then
  PROFILE_SHELL=zsh
elif test -n "$BASH_VERSION"; then
  PROFILE_SHELL=bash
elif test -n "$KSH_VERSION"; then
  PROFILE_SHELL=ksh
elif test -n "$FCEDIT"; then
  PROFILE_SHELL=ksh
elif test -n "$PS3"; then
  PROFILE_SHELL=unknown
else
  PROFILE_SHELL=sh
fi
echo $PROFILE_SHELL
echo $SHELL
[root@ESXi-X10SRH-CF:~] /local/bin/what-is-my-shell.sh 
sh
/bin/sh
[root@ESXi-X10SRH-CF:~] python --version
Python 3.5.3
[root@ESXi-X10SRH-CF:~] 

–jeroen

Posted in Development, ESXi4, ESXi5, ESXi5.1, ESXi5.5, ESXi6, ESXi6.5, Power User, Software Development, Virtualization, VMware, VMware ESXi | Leave a Comment »

What directories to backup on ESXi apart from the VMs? – Server Fault

Posted by jpluimers on 2017/08/18

What directories to backup on ESXi apart from the VMs? – Server Fault [WayBack]:

You may want to look at purpose-built VMware backup tools. You will be very disappointed if you treat an ESXi host like a Linux/Unix server.

Use the VMware backup commands [WayBack] from a separate station, and you’ll be left with a nice configuration tarball. I would find another approach for the actual VM backups.

Edit: Host-based example

vim-cmd hostsvc/firmware/sync_config
vim-cmd hostsvc/firmware/backup_config

This stores the config in /scratch/downloads:

# vim-cmd hostsvc/firmware/backup_config
Bundle can be downloaded at : http://ip.of.esxi.host/downloads/52fd67ba-2fdf-9876-6651-46c3da638f1a/configBundle-centaur.ewwhite.net.tgz

Also see: http://www.virtuallyghetto.com/2013/02/how-to-backup-restore-free-esxi-host.html [WayBack]

–jeroen

Posted in ESXi5, ESXi5.1, ESXi5.5, Power User, Virtualization, VMware, VMware ESXi | Leave a Comment »

ESXi 4.0.0.Update01-208167 Whitebox on HP xw6600: success!

Posted by jpluimers on 2017/05/19

Boy, I totally forgot to post this. It runs also ESXi 5.x; I’ve not tried more recent ESXi versions as they just run fine.

As a follow-up on [WayBackVMware Communities: ESX 3.5 Whitebox on HP xw6600 …, I have installed ESXi 4.0.0.Update01-208167 on a HP XW6600 workstation.

Good news: the generic ESXi 4 installation works, whereas the HP specific ESXi 4 fails (you get a nice purple screen of death).

[WayBackhttp://www.vm-help.com//esx40i/esx40_whitebox_HCL.php

–jeroen

Posted in ESXi4, ESXi5, ESXi5.1, ESXi5.5, Hardware, HP XW6600, Power User, Virtualization, VMware, VMware ESXi | Leave a Comment »

how to resize (grow) device partition of a multi-device BTRFS filesystem?

Posted by jpluimers on 2016/11/11

To grow you must first change the size of the container: the partition, the LV, or arraydevice. Then you can resize the file system. It’s the same with XFS, and NTFS. I’m only aware of Apple’sdiskutil resizevolume command that resizes the flavors of HFS+ and at the same time sets the new end valuefor the partition entry.

Source: Development of the BTRFS linux file system (not yet archived at the WayBack machine)

I will need the above for a single disk device having a BTRFS partition sandwiched between a swap and xfs partition:

# parted -l
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system     Flags
 1      1049kB  1562MB  1561MB  primary  linux-swap(v1)  type=82
 2      1562MB  17.7GB  16.1GB  primary  btrfs           boot, type=83
 3      17.7GB  21.5GB  3799MB  primary  xfs             type=83

I’ll likekly be:

  1. extend the disk inin ESXi
  2. use gparted to move the xfs partition to the end of the disk
  3. use gparted to extend the btrfs partition
  4. use btrfs to extend the volume inside the btrfs partition

I might be able to do all this from the gparted live CD as moving xfs and growing btrfs is on the GParted — Features list.

Fingers crossed. Luckily I’ve backups (:

–jeroen

Posted in *nix, ESXi4, ESXi5, ESXi5.1, ESXi5.5, ESXi6, Linux, openSuSE, Power User, SuSE Linux, Tumbleweed, VMware, VMware ESXi | Leave a Comment »

VMware ESXi – converting a thick disk to a thin disk – via: Server Fault

Posted by jpluimers on 2016/10/17

There are various places that tell you you cannot resize a thick disk to a thin disk using vmkfstools.

When you do it wrong, you get this error:

DiskLib_Check() failed for source disk. The file specified is not a virtual disk (15).

This happens when you directly try to resize the physical disk image:

# vmkfstools --clonevirtualdisk msmxp-flat.vmdk --diskformat thin msmxp-flat.thin.vmdk
DiskLib_Check() failed for source disk The file specified is not a virtual disk (15).

Whereas you should point vmkfstools to the disk descriptor file which has the shortest name:

# vmkfstools --clonevirtualdisk msmxp.vmdk --diskformat thin msmxp.thin.vmdk
Destination disk format: VMFS thin-provisioned
Cloning disk 'msmxp.vmdk'...
Clone: 100% done.

(Note that many people shorten the --clonevirtualdisk to -i and --diskformat to -d).

For performance, it doesn’t matter much if your disk is thick or thin as explained by Death to false myths: The type of virtual disk used determines your performance.

But various people issues expanding a thick disk. With thin disks, that usually works fine.

This post explains the correct steps of resizing: VMWare ESXi 5.1–convert virtual disk (vmdk) from thick to thin provision.

Here is a summary:

Step zero: shutdown the VM and ensure you have a backup!

For instance with rsync is great for making a local backup:

# time ./850EVO1TBR1B/bin/rsync -aiv --info=progress2 --progress ./850EVO1TBR1B/Raid6SSD-VM/msmxp/ ./850EVO1TBR1A/Raid6SSD-VM/msmxp/

Step one: show the disk files:

/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # du -h *.vmdk
12.0G   msmxp-flat.vmdk
0   msmxp.vmdk

There are two: msmxp.vmdk describes the disk and msmxp-flat.vmdk has the data.

Step two: ensure you have enough free space on the volume:

# ls -al /vmfs/volumes | grep "552f5788-33e30274-8dba-001f29022aed"
drwxr-xr-t    1 root     root          2660 Aug  5 04:35 552f5788-33e30274-8dba-001f29022aed
lrwxr-xr-x    1 root     root            35 Aug  5 06:11 850EVO1TBR1B -> 552f5788-33e30274-8dba-001f29022aed
# df -h | grep "850EVO1TBR1B\|Use%"
Filesystem   Size   Used Available Use% Mounted on
VMFS-5     930.8G 736.8G    194.0G  79% /vmfs/volumes/850EVO1TBR1B

Convert the disk:

# vmkfstools --clonevirtualdisk msmxp.vmdk --diskformat thin msmxp.thin.vmdk
Destination disk format: VMFS thin-provisioned
Cloning disk 'msmxp.vmdk'...
Clone: 100% done.

Observe the size:

In my case the flat disk was almost full and fragmented, so the thin disk is not smaller:

/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # du -h *.vmdk
12.0G   msmxp-flat.vmdk
12.0G   msmxp.thin-flat.vmdk
0   msmxp.thin.vmdk
0   msmxp.vmdk

Rename both disks

Use vmkfstools (do not use mv as that will not keep the descriptor/data vmdk files bound together) and check the rename.

You can replace --renamevirtualdisk with -E:

/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # vmkfstools --renamevirtualdisk msmxp.thin.vmdk msmxp.vmdk
## /vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # vmkfstools -E msmxp.vmdk msmxp.thick.vmdk
/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # du -h *.vmdk
12.0G   msmxp-flat.vmdk
12.0G   msmxp.thick-flat.vmdk
0   msmxp.thick.vmdk
0   msmxp.vmdk

Turn on the Virtual Machine to verify it still works.

If it does, then delete it (you can replace --deletevirtualdisk with -U) which will remove both both the descriptor and data vmdk file:

/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # vmkfstools --deletevirtualdisk msmxp.vmdk 
## /vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # vmkfstools -U msmxp.vmdk 
/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # du -h *.vmdk
12.0G   msmxp-flat.vmdk
0   msmxp.vmdk

After shutting down the VM again and making a new backup, you can now expand the disk as described in VMware KB: Adding space to an ESXi/ESX host virtual disk.

You can replace --extendvirtualdisk with -X.

/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # vmkfstools --extendvirtualdisk 14G msmxp.vmdk 
## /vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # vmkfstools -X 14G msmxp.vmdk 
Grow: 100% done.
/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # du -h *.vmdk
12.0G   msmxp-flat.vmdk
0   msmxp.vmdk


/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # vmkfstools --renamevirtualdisk msmxp.vmdk msmxp.thick.vmdk
/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # vmkfstools --clonevirtualdisk msmxp.thick.vmdk msmxp.vmdk --diskformat thin
Destination disk format: VMFS thin-provisioned
Cloning disk 'msmxp.thick.vmdk'...
Clone: 100% done.
/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # diff msmxp.thick.vmdk msmxp.vmdk
--- msmxp.thick.vmdk
+++ msmxp.vmdk
@@ -7,18 +7,18 @@
 createType="vmfs"
 
 # Extent description
-RW 29360128 VMFS "msmxp.thick-flat.vmdk"
+RW 29360128 VMFS "msmxp-flat.vmdk"
 
 # The Disk Data Base 
 #DDB
 
-ddb.adapterType = "ide"
-ddb.thinProvisioned = "1"
-ddb.geometry.sectors = "63"
-ddb.geometry.heads = "16"
-ddb.geometry.cylinders = "29127"
-ddb.uuid = "60 00 C2 9f 5e f8 33 76-6e c5 48 3c f2 84 d8 1e"
-ddb.longContentID = "5659579edebed2ebdd8e0c8fda15abd4"
 ddb.toolsVersion = "9221"
 ddb.virtualHWVersion = "8"
 ddb.deletable = "true"
+ddb.longContentID = "5659579edebed2ebdd8e0c8fda15abd4"
+ddb.uuid = "60 00 C2 95 66 1b cf 7a-e3 db 3f 30 17 7e 00 2d"
+ddb.geometry.cylinders = "29127"
+ddb.geometry.heads = "16"
+ddb.geometry.sectors = "63"
+ddb.thinProvisioned = "1"
+ddb.adapterType = "ide"
/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # du -h *.vmdk
12.0G   msmxp-flat.vmdk
12.0G   msmxp.thick-flat.vmdk
0   msmxp.thick.vmdk
0   msmxp.vmdk
/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # vmkfstools --extendvirtualdisk 14G msmxp.vmdk
Failed to extend disk : One of the parameters supplied is invalid (1).
/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # vmkfstools --extendvirtualdisk 14G msmxp.vmdk
Failed to extend disk : One of the parameters supplied is invalid (1).
/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # vmkfstools --extendvirtualdisk 14G msmxp.vmdk
Failed to extend disk : One of the parameters supplied is invalid (1).
/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # vmkfstools --extendvirtualdisk 15G msmxp.vmdk
Grow: 100% done.
/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # du -h *.vmdk
12.0G   msmxp-flat.vmdk
12.0G   msmxp.thick-flat.vmdk
0   msmxp.thick.vmdk
0   msmxp.vmdk
/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # vmkfstools --deletevirtualdisk msmxp.thick.vmdk 
/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # du -h *.vmdk
12.0G   msmxp-flat.vmdk
0   msmxp.vmdk
/vmfs/volumes/552f5788-33e30274-8dba-001f29022aed/Raid6SSD-VM/msmxp # 

–jeroen

via: vmware esxi – vmkfstools returns error when trying to copy thin vmdk – Server Fault.

Posted in ESXi4, ESXi5, ESXi5.1, ESXi5.5, ESXi6, Power User, Virtualization, VMware, VMware ESXi | Leave a Comment »

 
%d bloggers like this: