The Queen's Gambit Declined... 1. d4 d5 2. c4 ...

Friday Mar 21, 2008

Network transfers between a Windows guest and a Solaris host through NAT are very slow (a few KB per secs).

I am sure this problem will go away once VB will be more mature but it is currently very painful to transfer files

from the host to the guest. One solution to overcome this issue that I've found fast and easy to set up, is to mount

the Virtual Disk Image file (.vdi), used by the guest, directly on Solaris.

I've created my VDI files in a ZFS filesystem


# zfs list
NAME                                        USED  AVAIL  REFER  MOUNTPOINT
export_pool                                37.1G  1.31G  2.46G  /export
[...]
export_pool/vm                             15.2G  1.31G    21K  /export/vm
export_pool/vm/snv                           18K  1.31G    18K  /export/vm/snv
export_pool/vm/winxp                       15.2G  1.31G    21K  /export/vm/winxp
export_pool/vm/winxp/winxp0                15.2G  1.31G  14.7G  /export/vm/winxp/winxp0
export_pool/vm/winxp/winxp0@after_install   515M      -   932M  -
export_pool/vm/winxp/winxp0@mar_20         60.5M      -  14.7G  -
export_pool/vm/winxp/winxp0_tests            18K  1.31G  14.7G  /export/vm/winxp/winxp0_tests

# ls /export/vm/winxp/winxp0
NewHardDisk1.vdi  NewHardDisk2.vdi  winxp.vdi


First, I clone the ZFS filesystem so the data are safe during the operation (and the VM can keep running).


# zfs snapshot export_pool/vm/winxp/winxp0@mar_20
# zfs clone export_pool/vm/winxp/winxp0@mar_20 export_pool/vm/winxp/winxp0_tests
# cd /export/vm/winxp/winxp0_tests
# ls
NewHardDisk1.vdi  NewHardDisk2.vdi  winxp.vdi


As you can see in the zfs list output the cloned data only use 60MB (Thanks to ZFS!!)

From this post, we learn that a NTFS filesystem starts off by


eb 52 90 4e 54 46 53 20  20 20 20 00 02 08 00 00  |ëR.NTFS    .....|

Then, let's find this string in our VDI file


# od -t x1 NewHardDisk2.vdi | grep "eb 52 90 4e 54 46 53 20 20 20 20 00 02 08 00 00"
0140000 eb 52 90 4e 54 46 53 20 20 20 20 00 02 08 00 00
^C
#


The first column gives us the offset within the file that we need to mount the image.

Solaris doesn't support NTFS by default and doesn't know how to mount those filesystems.

However, you can use mount_ntfs, a freeware available on sourceforge.net, to do the job


# mount_ntfs NewHardDisk2.vdi /mnt -off 0140000
To unmount the file system type "kill 24697".
#
(make sure you keep the first 0 in the offset)


Et Voila!

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed