Followers

Monday, August 4, 2008

Ext3, ReiserFS & XFS in Windows thanks to coLinux

If you ever: needed to access your ext3, reiserfs or XFS partitions from Windows, wanted to use one of your favorite file systems via FUSE, or had an idea to mount an image of your hard drive, then this article is for you. This is a how-to, describing what to do, if you want Windows to handle file systems in a similar way as Linux does.

For our task we will use coLinux. coLinux is a modified linux kernel that can be executed as an application or a service in the Windows environment. The web page of the project is http://www.colinux.org/.

The installation procedure was tested on the stable version of the coLinux project (as of 28.06.2008). Installation was performed on the Windows 32-bit architecture. As far as other operating systems are concerned, there might be some modifications needed.

In short, we install coLinux on a windows machine, assure access to disk partions, and export all the mounted file systems using Samba.

Windows Vista users have to run the commands (e.g., cmd.exe, setup) via the context menu “run as …”. It is important, that while doing that, they are in the administrators mode.

coLinux's terminal

Get ready for the installation

  1. Download the program from the projects website (v0.7.3), and
    install it in the C:\coLinux directory
  2. Edit the connection settings of the virtual ethernet card installed by the coLinux (TAP Win32 Adapter V8 (coLinux)).
    In the TCP/IP settings, set: IP address: 192.168.37.10 Subnet Mask: 255.255.255.0
  3. Download Ubuntu-7.10.ext3.2GB.7z image from the the project’s webpage, and extract it to C:\coLinux
  4. The swap file comes together with the image so the next step can be omitted
  5. (Optional) If really needed, this command will create a 128MB swap: fsutil file createnew c:\coLinux\swapp128.fs 134217728 (one also has to run mkswap in Linux, and make sure that there is a corresponding line in fstab)
  6. Change of filenames:Ubuntu-7.10.ext3.2gb.fs -> ubuntu.fsswap128.fs -> ubuntu-swap.fs
  7. Copy example.conf to ubuntu.conf
  8. Edit of ubuntu.conf, by inserting these in proper places:cobd0="c:\coLinux\ubuntu.fs"cobd1="c:\coLinux\ubuntu-swap.fs"mem=32eth0=slirpeth1=tuntap
  9. Create ubuntu-start.cmd with the following content:colinux-daemon.exe -t nt @ubuntu.conf
  10. Runs ubuntu-start.cmd
  11. Login as root with the default “root” password
  12. Change the root password (passwd)
  13. Run: editor /etc/network/interfaces and add:auto eth1iface eth1 inet staticaddress 192.168.37.20network 192.168.37.0netmask 255.255.255.0broadcast 192.168.37.255
  14. ifup eth1
  15. ping 192.168.37.10 (from Linux to Windows) it should work now
  16. editor /etc/apt/sources.list (replace gutsy with hardy in all the paths)
  17. aptitude update
  18. aptitude safe-upgrade
  19. aptitude install samba openssh-server mc fuse-utils
  20. apt-get clean
  21. editor /etc/fuse.conf remove # at the beginning of the line user_allow_other
  22. editor /etc/ssh/sshd_config change PermitRootLogin to “no”
  23. Add a new user:adduser user1 (from now on, you can ssh to this account)
  24. adduser user1 fuse (this allows the user to use FUSE)
  25. /etc/init.d/ssh reload
  26. Check if you are able to establish a ssh connection with 192.168.37.20 in Windows
  27. Halt Linux: halt

How to mount the file system?

  1. Search for the partition you want to mount.http://colinux.wikia.com/wiki/Partitions.In my case, it is \Device\Harddisk2\Partition2.
  2. Edit ubuntu.conf again, and insert the following# partition to be mountedcobd2="\Device\Harddisk2\Partition2"
  3. Run ubuntu-start.cmd
  4. Login as root
  5. mkdir /media/codb2
  6. Add:/dev/cobd2 /media/cobd2 ext3 defaults 0 0 to fstab (it is an ext3 partition in my case).
  7. mount /media/cobd2

How to share file systems via Samba?

  1. Should you want to share a whole file system with user1, you must give him read and write permissions.(chown, chmod…).
  2. After setting the permissions, add at the following, at very end of /etc/samba/smb.conf:[my data]path = /media/cobd2valid users = user1read only = no
  3. Add the user to the password’s database of samba:smbpasswd -a user1 (samba does not use the system accounts by default)
  4. /etc/init.d/samba reload
  5. Type the address in Windows \\192.168.37.20, and login as user1 using the password generated by smbpasswd. You can map this file system to a “letter” in your OS

the view of an exported file system

FUSE-based file systems

To use the FUSE file systems (e.g., sshfs, encfs, …), you have to mount them using the allow_other option (which should be enabled in /etc/fuse.conf).How to mount:encfs $WHAT $WHERE -- -o allow_othersshfs $SERVER:$PATH $WHERE -o allow_other

More details

  1. To make, connecting to coLinux, easier add the IP address to WINDOWS\system32\drivers\etc\hosts by adding:192.168.37.20 colinux
  2. If you don’t want to start coLinux manually, it can be installed as a service:colinux-daemon.exe --install-service colinux @ubuntu.conf
  3. When running coLinux as a service, you can use the following commands to control it:net start colinuxnet stop colinux
  4. You can also set this service to start automatically. By doing so, you will get access to the mounted file systems immediately after the OS starts (provided that the disk was was mapped to be automatically mounted). One can access coLinux via a console (all of them are installed in C:\coLinux) or via ssh.
  5. If you want to have the same data under Windows and Linux, you have to sync the UID numbers (in /etc/passwd) of the user, who handles the files under Linux and coLinux.

Service settings

Stop the service

Performance

This solution does not provide an outstanding performance, but the benefits compensate for it. I’ve obtained transfers of up to 5 MB/s on an Athlon XP 2000+, SATA disk and an ext3 file system. Any ideas, on how to improve these results, are welcome.

Original here

No comments: