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.
Get ready for the installation
- Download the program from the projects website (v0.7.3), and
install it in theC:\coLinux
directory - 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 - Download Ubuntu-7.10.ext3.2GB.7z image from the the project’s webpage, and extract it to
C:\coLinux
- The swap file comes together with the image so the next step can be omitted
- (Optional) If really needed, this command will create a 128MB swap:
fsutil file createnew c:\coLinux\swapp128.fs 134217728
(one also has to runmkswap
in Linux, and make sure that there is a corresponding line infstab
) - Change of filenames:
Ubuntu-7.10.ext3.2gb.fs
->ubuntu.fs
swap128.fs
->ubuntu-swap.fs
- Copy example.conf to ubuntu.conf
- 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
- Create
ubuntu-start.cmd
with the following content:colinux-daemon.exe -t nt @ubuntu.conf
- Runs
ubuntu-start.cmd
- Login as root with the default “root” password
- Change the root password (
passwd
) - 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
ifup eth1
ping 192.168.37.10
(from Linux to Windows) it should work noweditor /etc/apt/sources.list
(replace gutsy with hardy in all the paths)aptitude update
aptitude safe-upgrade
aptitude install samba openssh-server mc fuse-utils
apt-get clean
editor /etc/fuse.conf
remove#
at the beginning of the lineuser_allow_other
editor /etc/ssh/sshd_config
changePermitRootLogin
to “no”- Add a new user:
adduser user1
(from now on, you can ssh to this account) adduser user1 fuse
(this allows the user to use FUSE)/etc/init.d/ssh reload
- Check if you are able to establish a ssh connection with 192.168.37.20 in Windows
- Halt Linux:
halt
How to mount the file system?
- Search for the partition you want to mount.http://colinux.wikia.com/wiki/Partitions.In my case, it is
\Device\Harddisk2\Partition2
. - Edit
ubuntu.conf
again, and insert the following# partition to be mountedcobd2="\Device\Harddisk2\Partition2"
- Run
ubuntu-start.cmd
- Login as root
mkdir /media/codb2
- Add:
/dev/cobd2 /media/cobd2 ext3 defaults 0 0
tofstab
(it is an ext3 partition in my case). mount /media/cobd2
How to share file systems via Samba?
- Should you want to share a whole file system with user1, you must give him read and write permissions.(
chown
,chmod
…). - 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
- Add the user to the password’s database of samba:
smbpasswd -a user1
(samba does not use the system accounts by default) /etc/init.d/samba reload
- Type the address in Windows
\\192.168.37.20
, and login as user1 using the password generated bysmbpasswd
. You can map this file system to a “letter” in your OS
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
- To make, connecting to coLinux, easier add the IP address to
WINDOWS\system32\drivers\etc\hosts
by adding:192.168.37.20 colinux
- If you don’t want to start coLinux manually, it can be installed as a service:
colinux-daemon.exe --install-service colinux @ubuntu.conf
When running coLinux as a service, you can use the following commands to control it:
net start colinuxnet stop colinux
- 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. - 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.
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.
No comments:
Post a Comment