Page 1 of 1

file magic entry for VDI files - tells the file size & UUID

Posted: 4. Jun 2009, 01:37
by es1
Hi
Here is a simple entry for the ~/.magic file, which enables the file command to identify VDI files and print their size and uuid.

Code: Select all

# VirtualBox VDI
# Base on: http://forums.virtualbox.org/viewtopic.php?f=1&t=8046
#
0       string          \x3c\x3c\x3c\ Sun        VirtualBox VDI Disk Image
>64     string          \x7F\x10\xDA\xBE
>68     byte            x               - Version %d
>70     byte            x               ^H.%d
>368    lequad          x               - Size: %lld
>392    lelong          x               - UUID: %lx
>396    leshort         x              -%x
>398    leshort         x              -%x
>400    beshort         x              -%x
>402    beshort         x              -%x
>404    belong          x              %lx
Example of use:
# file disk-image1.vdi
disk-image1.vdi: VirtualBox VDI Disk Image - Version 1.1 - Size: 10485760000 - UUID: 381c53ba-05ed-4de0-895c-4b47cf0bbb1e

HTH 8)

Re: file magic entry for VDI files - tells the VDI file size

Posted: 10. Jun 2009, 21:40
by TerryE
Note for others that the ^H is the CTL-H character (type Ctl-VCtl-H in vi). This works fine. You can use my tutorial All about VDIs + man magic to extend this info.