VMware Cloud Community
continuum
Immortal
Immortal
Jump to solution

Who has a sh.script to read the size of sesparse.vmdks ?

For delta.vmdks I used a script to extract some useful details from the header.
Does anybody has something similar for sesparse.vmdks ?

===========================================================================

#!/bin/sh
# Display some basic details for a VMware ESXi - Delta.vmdk
echo
echo '### SNAPSHOT INFO '
echo 'file snapinfo: ' "$1"
hexdump -n 4 -v -e '"magic : " 4/4 "%s" "\n"' "$1" | grep -v /vmfs
hexdump -s 12 -n 4 -v -e '"size basedisk : " "%4u" "\n"' "$1" | grep -v /vmfs
hexdump -s 28 -n 4 -v -e '"min size delta : " "%4u" "\n"' "$1" | grep -v /vmfs

echo '-------------------------------------------------------------------'
echo
=========================================================================

A script like that is required to figure out to which basedisk a sesparse.vmdk belongs after the user renamed files.
Thank you

Ulli


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

0 Kudos
1 Solution

Accepted Solutions
a_p_
Leadership
Leadership
Jump to solution

I created 2 disks real quick, one with 10GB and another with 100GB provisioned size.
If you want another size, let me know.

a_p__0-1651781009227.png
10 GB

 

a_p__1-1651781132277.png
100 GB

André

 

 

View solution in original post

0 Kudos
9 Replies
a_p_
Leadership
Leadership
Jump to solution

I didn't so much with sesparse files so far, and there's not much documentation available.
However, maybe the following will help you.

https://lists.gnu.org/archive/html/qemu-devel/2019-06/msg04459.html

I did create a small script based on that information, to display the metadata of a 40GB sample sesparse file.

a_p__1-1651779074214.png

André

0 Kudos
continuum
Immortal
Immortal
Jump to solution

Hi Andre
the decimal value for capacity may be what I need
it uses 2 x the value for numbers of sectors in the descriptorsize.

Do you have another sesparse.vmdk available to check the assumption ?

Ulli


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

0 Kudos
a_p_
Leadership
Leadership
Jump to solution

I created 2 disks real quick, one with 10GB and another with 100GB provisioned size.
If you want another size, let me know.

a_p__0-1651781009227.png
10 GB

 

a_p__1-1651781132277.png
100 GB

André

 

 

0 Kudos
continuum
Immortal
Immortal
Jump to solution

Thanks a lot
looks like a small change will do the job.
Instead of
hexdump -s 12 -n 4 -v -e '"size basedisk : " "%4u" "\n"' "$1" | grep -v /vmfs
I will try with
hexdump -s 16 -n 4 -v -e '"size basedisk : " "%4u" "\n"' "$1" | grep -v /vmfs

I will keep you updated - need to create some sesparse testfiles now ...

Ulli


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

0 Kudos
a_p_
Leadership
Leadership
Jump to solution

I've attached two SeSparse test files to this reply in case you need them.
Both are newly created snapshots from powered off VMs.

André

0 Kudos
continuum
Immortal
Immortal
Jump to solution

Perfect service Andre 🙂
Mission accomplished:

Sample output

-------------------------------------------------------------------


moon@debserv:~/Downloads$ ./sesparse-info.sh SeSparse-Test-10GB-000001-sesparse.vmdk

### SESPARSE SNAPSHOT INFO
file : SeSparse-Test-10GB-000001-sesparse.vmdk
size basedisk : 20971520
-------------------------------------------------------------------


moon@debserv:~/Downloads$ ./sesparse-info.sh SeSparse-Test-100GB-000001-sesparse.vmdk

### SESPARSE SNAPSHOT INFO
file : SeSparse-Test-100GB-000001-sesparse.vmdk
size basedisk : 209715200
-------------------------------------------------------------------

script:

#!/bin/sh
# Display some basic details for a VMware ESXi - Sesparse.vmdk
echo
echo '### SESPARSE SNAPSHOT INFO '
echo 'file : ' "$1"
# hexdump -n 4 -v -e '"magic : " 4/4 "%s" "\n"' "$1" | grep -v /vmfs
hexdump -s 16 -n 4 -v -e '"size basedisk : " "%4u" "\n"' "$1" | grep -v /vmfs
# hexdump -s 28 -n 4 -v -e '"min size delta : " "%4u" "\n"' "$1" | grep -v /vmfs

echo '-------------------------------------------------------------------'
echo
echo




________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

0 Kudos
a_p_
Leadership
Leadership
Jump to solution

You are reading only 4 bytes instead of 8. The size is a 64 bit value.

André

0 Kudos
continuum
Immortal
Immortal
Jump to solution

Oops - you are right.
Got to do some google about how to format the hexdump ...

Ulli


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

0 Kudos
continuum
Immortal
Immortal
Jump to solution

Bingo - that looks good
sample output:

Note the red lines ...


root@debserv:/home/moon/esxi-rw/testvm# ./vmfs-file-info.sh testvm-flat.vmdk

### VMFS6 FILE INFO
file : testvm-flat.vmdk
magic : 109063eb
basedisk capacity: 13332344569296109307
bootflag : aa55
-------------------------------------------------------------------


root@debserv:/home/moon/esxi-rw/testvm# ./vmfs-file-info.sh testvm-000001-sesparse.vmdk

### VMFS6 FILE INFO
file : testvm-000001-sesparse.vmdk
magic : cafebabe
basedisk capacity: 33554432
bootflag : 0000
-------------------------------------------------------------------


root@debserv:/home/moon/esxi-rw/testvm# ./vmfs-file-info.sh testvm_1-000001-sesparse.vmdk

### VMFS6 FILE INFO
file : testvm_1-000001-sesparse.vmdk
magic : cafebabe
basedisk capacity: 34359738368
bootflag : 0000
-------------------------------------------------------------------

testvm-000001-sesparse.vmdk is a sesparse snapshot for a 16GB vmdk        ### - magic is cafebabe
testvm_1-000001-sesparse.vmdk is a sesparse snapshot for a 16TB vmdk    ### - magic is cafebabe
testvm-flat.vmdk is a formatted 16GB flat vmdk                                              ### - bootflag aa55 is present

Todo: add routine for delta.vmdks

Ulli


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

0 Kudos