Archive

Posts Tagged ‘Mount’

Mount VDI file

October 25, 2008 1 comment

Hey!

Well as a part of my studies we learn assembly under Dos (crap >.<). Anyway to ged rid of Windows I decided to install a Virtual Machine with FreeDOS. The problem was that its pretty hard to transfer files between Linux and the virtual drive, and I couldn’t setup network transfer (I wonder if its possible at all with FreeDOS). So I decided to mount my VDI file and be able to read/write to it as it was a directory on my filesystem. I googled for “mount vdi” and found this link

http://forums.virtualbox.org/viewtopic.php?t=52&start=0&postdays=0&postorder=asc&highlight=

So lets start 🙂

Tools:

1. Linux :p

2. VDI file – Create new partition with Virtual Box, I used fixed size of 90MB and Installed FreeDOS on it.

3. khexedit – sudo apt-get install khexedit

The moves:

khexedit .VirtualBox/VDI/FreeDOS.vdi

Note: You should use decimal instead of hex, View->Offest as decimal

Now is the hard part: you should look for the beginning of the partition

Mine looks like this:

0000033216 ……………………………………………………….
0000033280 �<.FRDOS4.1……….��.?…?…a�..�.)..p$FREEDOS    FAT16
0000033344 1�.ؽ.|��..�.�.��..���^|�…`..�.�.f��.~$�u..V$�F�..�F�…^��FÄ 
0000033408 c.v..~..v..�..v�.~�.F..�f..�.�.v�.~�.^.�.��.F.1���P.�.�..v�.~�.F
0000033472 �.V�_�^Z�..�~Z�..��}W��_&.E.t..� &.=.u�reP�^Z.~..F�.V��g.X…^\�

As you can see before offset 33216 there are almost nothing, and the partition starts at offset 33280.

So now we know the start offset of the partiton lets mount it:

sudo mkdir /mnt/vdifs

sudo mount -o loop,offset=33280,umask=000 .VirtualBox/VDI/FreeDOS.vdi /mnt/vdifs

And we done 🙂

To understand what loop, offset and umask stands for read this

http://forums.virtualbox.org/viewtopic.php?t=52&start=0&postdays=0&postorder=asc&highlight=

Better then I can explain 🙂

Now you can read/write files from your partition like it was part of your system 🙂

To un mount it use:

sudo umount /mnt/vdifs

Enjoy 🙂

Categories: Linux Tags: , , ,