WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: access to ext4 fs through vm in windows?  (Read 11195 times)

Offline xunil

  • Newbie
  • *
  • Posts: 1
access to ext4 fs through vm in windows?
« on: October 05, 2010, 10:55:49 AM »
today i installed tinycore linux in virtualbox on my windows xp and i wanted to copy some files from a ext4 partition, but i cant tell virtualbox to show that, because im using winxp.

can someone help?

Offline Arslan S.

  • Hero Member
  • *****
  • Posts: 825
Re: access to ext4 fs through vm in windows?
« Reply #1 on: October 05, 2010, 12:43:50 PM »
you need to create a shared folder and copy the files from ext4/ext3 partition to shared folder then you will have access them in windows tough in order to do that you need to access real hard drive, and i think that's the hardest part

http://www.ubuntugeek.com/howto-access-ext3-partition-from-windows.html
« Last Edit: October 05, 2010, 12:50:25 PM by Arslan S. »

Offline SamK

  • Hero Member
  • *****
  • Posts: 713
Re: access to ext4 fs through vm in windows?
« Reply #2 on: October 05, 2010, 12:58:44 PM »
Don't know if this will be of interest, I've used Explore2fs to get RO access to ext3 from XP.
http://www.chrysocome.net/explore2fs

I've also seen this for ext4 but never used it.
http://sourceforge.net/projects/ext2read/files
   

Offline danielibarnes

  • Hero Member
  • *****
  • Posts: 548
Re: access to ext4 fs through vm in windows?
« Reply #3 on: October 05, 2010, 01:46:49 PM »
WinSCP is the easiest tool for simply copying files if you have a network between your VM and your host. I use it all the time for that.

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
Re: access to ext4 fs through vm in windows?
« Reply #4 on: October 05, 2010, 07:22:32 PM »
I believe I've got a bit of experience in this matter and like to offer my opinion:

  • As far as I know from my earlier testing, tools like Explore2fs all assume a "raw" disk image. That means a full sized (i.e. non-sparse) image without special "add-ons". The default disk format of VBox is VDI, and that is certainly not a "raw" image format. Now, you could convert a VDI image back to "raw", but then you end up with a full sized copy just for a one-off extraction. Not a particular efficient approach in my book.

    I think I've found a way that allows me to use something like Explore2fs and even create a single virtual disk that all the major emulators (apart from maybe Virtual PC) do support. So the same virtual disk could be used between them all (obviously just one at a time):

    I first create a "raw" disk image (e.g. with QEMU's 'qemu-img'). To this I'd add a separate "hand-crafted" VMDK description file with createType="monolithicFlat" (some details can be found on the sanbarrow.com page, e.g. here). This descriptor file contains a reference to the "raw" disk image, and should work for all the "usual" VMs. For me this approach is working quite well, but it's not widely documented, so might not be the right one for you.

  • Using the shared folder feature of VBox would work well, but you would need the VBox guest additions. Those are currently not yet available as a TC 3.x extension, but can be used for TC 2.x. I assume this might change soon-ish as Arslan has just shown some interest to look into this matter.

  • I only had a quick glance at the ubuntugeek.com page, but I believe it refers to something quite different: It assumes your physical harddisk contains a EXT3 partition that you want to make available under Windows. It suggests to create a Ubuntu VM that accesses this hard disk partition and shares it with the Windows host via a Samba server running in the VM.

  • Now, my preferred method of sharing files between a guest OS and the host is via networking. It's difficult to imagine to use a VM without networking (in particular easy for TC, which detects straight away all the typicall network adaptors supported by the usual emulators). Whilst I don't doubt that Winscp will work well, it still requires a running SSH server inside the VM. This requires not only the installation of a suitable extension (i.e. 'openssh.tcz'), but also to choose the right networking method in the emulator to such a server in the VM.

    I personally prefer to use the venerable "netcat" method, but this might not be to everyone's taste. The 'nc' command is avaiable as a BusyBox applet (albeit with a weakness for failing to detect the end of the file, for which I'm planning to raise a bug with BusyBox, but haven't done yet). So you just need to download yourself the Windows version of the tool (e.g. from here) and put it somewhere in the %PATH% (e.g. 'c:\windows'). You might have to be "brave" and ignore the advice of your virus scanner, since some of those consider "netcat" to be dangerous (which is in my view the potential of all powerfull tools, so it's best one knows what one is doing).

    Well, with this done you could use something like nc -lp 1234 > received_file on the host and then start something like nc 10.0.2.2 1234 < file_to_transfer in the VM. Please note that I'm using '10.0.2.2' as the hosts IP address, which is the default for NAT networking in many emulators. Obviosly if I have multiple files I'm using 'tar' to create an "on-the-fly" archive with tar cvf - file1 file2 dir1 dir2 | nc 10.0.2.2 1234 On the host I either had started earlier nc -lp 1234 > archive.tar, or rather using a Windows version of 'tar' to do: nc -lp 1234 | tar xvf -

    A few more remarks:
    • All this works equally well in the opposite direction, i.e.to get files from the host to the VM, one just have to change the input / output redirections around (e.g. nc -lp 1234 < file_to_transfer on the host and nc 10.0.2.2 1234 > received_file on the guest)
    • You will allways have to start the 'nc' command on the host system first, no matter whether it's in send or receive mode.
    • As stated earlier: The BusyBox version of 'nc' seems to have a bug (which does not show for the "full blown" version available in other distributions). It seems to not be able to detect the end of a transfer. As a workaround I just interupt one end to the transfer (by pressing 'Ctrl-C') when it's all over. For small files you can do it almost straight away, for larger files (e.g. multiple MBytes) you just have to monitor the size of the file at the receiving end, and then terminate the transfer when all has come through. Not nice, but also not a "biggie" for me.

  • If you need more than an "on and off" file transfer method, I'd suggest to use CIFS. By this I mean to let your guest OS become a client of a Windows share on the host. Obviously you will have to ensure that your host is supportive of Windows shares (and not blocking it e.g. via a firewall).

    You'll need to have the respective "filesystems" extension (i.e. 'filesystems-2.6.33.3-tinycore.tcz' for TC 3.x) installed. Afterwards you can use something like mkdir /mnt/windows_d ; sudo mount -t cifs //10.0.2.2/d$ /mnt/windows_d -o user=USER,pass=PASSWD where USER and PASSWD are to be replaced with the respective values from the host system. There are quite a few additional options that can be specified. I believe I've used 'nounix' on occasion, but as I have not used this method too much recently I probably have to take a look at the man page to remind myself on what is supported.

So you see there are several ways to achieve your goal, it really depends on what you need and how much effort you are prepared to invest either for a quick or for a longer-lasting solution.

Online curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10963
Re: access to ext4 fs through vm in windows?
« Reply #5 on: October 06, 2010, 12:24:15 AM »
I believe explore2fs does not support ext4.
The only barriers that can stop you are the ones you create yourself.