One of the problem with Windows Operating System is the narrow-range variety of available filesystem. When using Windows, you are limited to FAT and NTFS family file system. Now, suppose you want to access ext3, reiserfs, or XFS partition on Windows there is no way Windows facilitate this unless you do something. This article will describe the step for doing it using coLinux as tool.
In this article I use following:
- Windows 7 32-bit
- coLinux 0.7.9
- Ubuntu Image 9.04
Note: when this article written (18 January 2014) coLinux can only be used on 32-bit Windows!!
You can try any 32-bit Windows (Vista, 7, 8) but the system tested here is Windows 7 32-bit.
There are some alternative to Ubuntu: Alpine,Debian, Fedora, Gentoo, ArchLinux, Slackware. All of them use kernel 2.6. As the reason for using 9.04 is personal, you can use higher version available.
The Idea Behind
coLinux or cooperative Linux, is a free and open source Linux kernel running on Windows natively. We can say the linux kernel is run alongside Windows on single machine, like a virtual machine does. However the difference is we don’t emulate a machine to do this instead we run the linux kernel itself. Thus it is theoretically much more optimal than using any general purpose PC virtualization software.
So in general, we will do following scenario:
- install coLinux on Windows machine
- Assure access to disk partition
- Export all the mounted file system using samba
Much of the process will use command line interface (cmd.exe) which you should open using administration privilege.
coLinux can be obtained freely from their official site, or go to sourceforge site to download it. The version used here is 0.7.9-linux220.127.116.11. Download the installer and install it in C:\coLinux directory.
Edit the connection settings of the virtual ethernet card installed by the coLinux (It should be listed as “TAP Win32 Adapter V8 (coLinux)”). In the TCP/IP settings, set: IP address to 192.168.37.10 and Subnet Mask to 255.255.255.0
Download Ubuntu 9.04 disk image from sourceforge (listed as Ubuntu-9.04-1gb.7z). Extract the image file (Ubuntu-9.04.ext3.1gb.fs) to C:\coLinux. Note that you should have 7zip to extract this file. Now create a swap (for example 128MB swap) using following command on coLinux:
fsutil file createnew c:\coLinux\swap128.fs 134217728
You should know where the magic number comes
Also make sure you run mkswap in Linux and make sure there is corresponding line in fstab.
Rename the file Ubuntu-9.04.ext3.1gb.fs to ubuntu.fs so we have two files: ubuntu.fs and swap128.fs.
Copy the example.conf to ubuntu.conf and edit it. Alternatively you can copy this text and save it as ubuntu.conf.
# # This is an example for a configuration file that can # be passed to colinux-daemon in this manner: # # colinux-daemon @example.conf # # Note that you can still prepend or append configuration and # boot parameters before and after '@', or you can use more # that one '@ to load several settings one after another. # # colinux-daemon @example.conf @overrider.conf mem=32 # # Full list of config params is listed in colinux-daemon.txt. # The default kernel kernel=vmlinux # File contains the root file system. # Download and extract preconfigured file from SF "Images for 2.6". cobd0="c:\coLinux\ubuntu.fs" # Swap device, should be an empty file with 128..512MB. cobd1="c:\coLinux\swap128.fs" # Tell kernel the name of root device (mostly /dev/cobd0, # /dev/cobd/0 on Gentoo) # This parameter will be forward to Linux kernel. root=/dev/cobd0 # Additional kernel parameters (ro = rootfs mount read only) ro # Initrd installs modules into the root file system. # Need only on first boot. initrd=initrd.gz # Maximal memory for linux guest mem=32 # Select console size, default is 80x25 #cocon=120x40 # Slirp for internet connection (outgoing) # Inside running coLinux configure eth0 with this static settings: # ipaddress 10.0.2.15 broadcast 10.0.2.255 netmask 255.255.255.0 # gateway 10.0.2.2 nameserver 10.0.2.3 eth0=slirp # Tuntap as private network between guest and host on second linux device eth1=tuntap # Setup for serial device #ttys0=COM1,"BAUD=115200 PARITY=n DATA=8 STOP=1 dtr=on rts=on" # Run an application on colinux start (Sample Xming, a Xserver) #exec0=C:\Programs\Xming\Xming.exe,":0 -clipboard -multiwindow -ac"
If you copy and edit from example.conf, there are lines you need to change. In the end you should make sure following entries exist:
cobd0=C:\coLinux\ubuntu.fs cobd1=C:\coLinux\swap128.fs mem=32 eth0=slirp eth1=tuntap
Now create ubuntu-start.cmd with following content:
set COLINUX_CONSOLE_FONT=Lucida Console:12 set COLINUX_CONSOLE_EXIT_ON_DETACH=1 colinux-daemon.exe -t nt @ubuntu.conf
Then run ubuntu-start.cmd.
Next we do some configuration. Login as root with default password “root”. You can change the root password if you want.
Run the editor and edit /etc/network/interfaces. Add following:
auto eth1 iface eth1 inet static address 192.168.37.20 network 192.168.37.0 netmask 255.255.255.0 broadcast 192.168.37.255
Bringing up the eth1 by
Test the network by pinging from our Linux to Windows. It should work now.
Next we do update to install necessary package.
aptitude update aptitude safe-upgrade aptitude install samba openssh-server mc apt-get clean
Open /etc/fuse.conf and remove # at the beginning of the line user_allow_other
Open /etc/ssh/sshd_config and change PermitRootLogin to “no”
Add new user named user1 (or any name you wish) and next we can login to this account via ssh:
But first, we need to reload the SSH server:
At this point, use SSH client such as putty to check whether you can login to Linux via SSH.
Mount File System
First, search for the partition you want to mount. Let’ say it is \Device\Harddisk1\Partition4
If you have ran ubuntu-start.cmd (the system is running) then halt it before going further.
Edit ubuntu.conf and insert following:
Then run ubuntu-start.cmd (or halt the previous machine and restart it). Then login as root.
Do following to create a mount point:
Then edit /etc/fstab and add following line (assuming my partition is xfs):
/dev/codb2 /media/codb2 xfs defaults 0 0
Then mount it like usual.
Share via Samba
Give user1 the appropriate privilege. If you want to share a whole file system with user1, you must give read and write permissions.
After setting permission, add the following at the very end of /etc/samba/smb.conf
[my data] path = /media/cobd2 valid users = user1 read only = no
Next add the user to the password’s database of samba:
smbpasswd -a user1
Then reload the samba
On Windows, type \\192.168.37.20 and login as user1 using the password generated by smbpasswd.