vhd-util tool to inspect the VHD headers of a VHD

vhd-util tool to inspect the VHD headers of a VHD

book

Article ID: CTX217640

calendar_today

Updated On:

Description

vhd-util is a native utility of a XenServer used to inspect the VHD headers of a VHD. This will be useful to inspect the parent child relationship in VHD files


Instructions

Here are some vhd-util scan options you can use.
 
usage: [OPTIONS] FILES

options: [-m match filter] [-f fast] [-c continue on failure] [-l LVM volume] [-p pretty print] [-a scan parents] [-v verbose] [-h help]

1. Login into XenServer shell using putty

2. Run the following command to find the parent child relationship

vhd-util scan -m "VHD-*" -f -c -l VG_XenStorage-7ec18595-0bf0-859a-1e85-7e19721dad84 -p –v

Here 7ec18595-0bf0-859a-1e85-7e19721dad84 is your Storage Repository UUID.
 
[root@xenserver ~]# vhd-util scan -m "VHD-*" -f -c -l VG_XenStorage-7ec18595-0bf0-859a-1e85-7e19721dad84 -p –v

vhd=VHD-79d0aca7-eda7-4d73-9238-c3b5c9378aa7 capacity=26843545600 size=4630511616 hidden=1 parent=none
   vhd=VHD-691d986e-e84a-4ab4-9672-b6f9b3148cab capacity=26843545600 size=26902265856 hidden=0 parent=VHD-79d0aca7-eda7-4d73-9238-c3b5c9378aa7
   vhd=VHD-838154db-db5c-42b7-8ec3-2ebb31f73683 capacity=26843545600 size=8388608 hidden=0 parent=VHD-79d0aca7-eda7-4d73-9238-c3b5c9378aa7
vhd=VHD-80c4d84c-8aea-4391-9d31-fcc2be388ce6 capacity=21474836480 size=4626317312 hidden=1 parent=none
   vhd=VHD-0eaa0588-3668-4697-956d-bd6e98478585 capacity=21474836480 size=8388608 hidden=0 parent=VHD-80c4d84c-8aea-4391-9d31-fcc2be388ce6
   vhd=VHD-240a20e8-0d70-4b4a-88c1-e4b2a6e138e7 capacity=21474836480 size=21525168128 hidden=0 parent=VHD-80c4d84c-8aea-4391-9d31-fcc2be388ce6
vhd=VHD-a5d73baa-1eb6-4fe6-a2e9-32ddcf14555a capacity=2147483648 size=2101346304 hidden=1 parent=none
   vhd=VHD-87e8553e-340d-4269-8401-f2b4be874b62 capacity=2147483648 size=8388608 hidden=0 parent=VHD-a5d73baa-1eb6-4fe6-a2e9-32ddcf14555a
vhd=VHD-1b10a183-ef8d-4c53-a031-b9aeeb38e0be capacity=10737418240 size=10766778368 hidden=0 parent=nonevhd=VHD-2e45811f-c3a1-48bf-b6b0-0d0fb671da8e capacity=5368709120 size=5385486336 hidden=0 parent=none
vhd=VHD-6fe32f92-bc88-4f98-a4e1-47bf04894ce8 capacity=21474836480 size=21525168128 hidden=0 parent=none
vhd=VHD-8336df72-992d-4a52-a5e3-4a776f1f86f8 capacity=5368709120 size=5385486336 hidden=0 parent=none

To read the metadata of VHD, run the following command

eg
#vhd-util read -n /dev/mapper/XSLocalEXT--42df0738--cef9--81bf--6512--4940ce625835-42df0738--cef9--81bf--6512--4940ce625835
]# vhd-util read -n /dev/mapper/XSLocalEXT--42df0738--cef9--81bf--6512--4940ce625835-42df0738--cef9--81bf--6512--4940ce625835
Failed to open /dev/mapper/XSLocalEXT--42df0738--cef9--81bf--6512--4940ce625835-42df0738--cef9--81bf--6512--4940ce625835: -22

/dev/mapper/XSLocalEXT--42df0738--cef9--81bf--6512--4940ce625835-42df0738--cef9--81bf--6512--4940ce625835 appears invalid; dumping headers

VHD Footer Summary:
-------------------
Cookie              :
Features            : (0x00000000)
File format version : Major: 0, Minor: 0
Data offset         : 0
Timestamp           : Fri Dec 31 18:00:00 1999
Creator Application : ''
Creator version     : Major: 0, Minor: 0
Creator OS          : Unknown!
Original disk size  : 0 MB (0 Bytes)
Current disk size   : 0 MB (0 Bytes)
Geometry            : Cyl: 0, Hds: 0, Sctrs: 0
                    : = 0 MB (0 Bytes)
Disk type           : None
Checksum            : 0x0|0xffffffff (Bad!)
UUID                : 00000000-0000-0000-0000-000000000000
Saved state         : No
Hidden              : 0

VHD Header Summary:
-------------------
Cookie              :
Data offset (unusd) : 0
Table offset        : 0
Header version      : 0x00000000
Max BAT size        : 0
Block size          : 0 (0 MB)
Parent name         :
Parent UUID         : 00000000-0000-0000-0000-000000000000
Parent timestamp    : Fri Dec 31 18:00:00 1999
Checksum            : 0x0|0xffffffff (Bad!)