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

This is for discussing general topics about how to use VirtualBox.
Post Reply
es1
Posts: 38
Joined: 25. Mar 2009, 02:12
Primary OS: Fedora 10
VBox Version: OSE self-compiled
Guest OSses: XP,Vista,Linux,win7,32b,64b

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

Post 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)
Last edited by es1 on 24. Jun 2009, 07:29, edited 1 time in total.
TerryE
Volunteer
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
Contact:

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

Post 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.
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
Post Reply