<Gniarf> draft documentation. edit at will, refactor at will, copy and paste text as needed in other pages.

(in another page called 'high-level networking with coLinux', provide documentation to access Windows from co Linux, coLinux from Windows, using samba, ftp, www, whatever, once the network is up and running)

Using SMBFS[]

Note regarding Windows 2003:

smbfs works fine for most users, but the SMB protocol that smbfs supports is a bit dated and somewhat insecure. <Franco>In Debian Lenny (5.0), the smbfs is updated, and works fine for me</Franco>

Since smbfs was developed, Microsoft has updated the protocol to include some newer security features. The updated version is often called CIFS. Unfortunately, smbfs does not support some of the newer features of CIFS. Because of the security problems, many Windows 2003 servers are configured to refuse access to clients using the older protocol. Your mount will fail with an error such as "SMB signing is mandatory and we have disabled it." That means your Windows 2003 server is refusing to use the older protocol that smbfs supports. You will need to use the CIFS VFS kernel module. Good luck!

Assuming your Windows box is called THATBOX, that there is a user 'User' sharing a folder or drive called 'mysharedfolder', you can already access this folder from KDE konqueror (web navigator, file manager and info and man pages viewer) using this syntax :


next step : really mount windows shared directories as file systems so you can use shell commands, editors, and all. among other things, you can copy files from and to coLinux this way.

get smbfs (Samba file system) under Debian :

apt-get install smbfs
smbmount //THATBOX/mysharedfolder /mnt -o username=User,password=myTrickyPassword
ls /mnt

result :

 /dev/cobd0 on / type ext3 (rw,noatime)
 proc on /proc type proc (rw)
 devpts on /dev/pts type devpts (rw,gid=5,mode=620)
 tmpfs on /dev/shm type tmpfs (rw)
 //THATBOX/mysharedfolder on /mnt type smbfs (rw)

alternative syntax :

mount -t smbfs -o username=User,password=myTrickyPassword //THATBOX/mysharedfolder /mnt

Gentoo : the ability to mount samba drives is either already there by default in the Gentoo image, or installed when you emerge samba. don't know yet, but the same syntax for smbmount works fine.

Fedora :

apt-get install samba-client
mount -t smbfs -o username=foo,password=bar //host_name/dir /mnt
ls /mnt

N.B. : this is smbfs, not samba itself (not yet). you can also share coLinux directories and make them available under Windows, you would have to install samba to do that.

N.B. : you don't want to share your Windows drives to the world, do you ? using the appropriate security measures is necessary.

Another documentation for Samba / coLinux[]

It's trivial to access windows drives from colinux. <Franco>THIS DOES NOT WORK IN WINDOWS XP. It works in Vista, though.</Franco>

colinux: mkdir C
colinux: mount -t smbfs -o username=Win32UserName //your-win2000-machine/C$ C
colinux: ls C
<contents of your C drive>

To make this easier, simply add it to your /etc/fstab.

colinux: cat <<EOF >> /etc/fstab
> //your-win2000-machine/C$	/C	smbfs	noauto,username=Win32UserName

To mount this drive, simply type the following, which will prompt for your password.

colinux: mount /C

If you value convenience over security, simply embed your password in /etc/fstab as follows:

cat <<EOF >> /etc/fstab
> //your-win2000-machine/C$	/C	smbfs	noauto,username=Win32UserName,passwd=Win32Password

Alternatively, you can automatically mount the drive by removing the "noauto" option. In that case you will be prompted at system boot for the password if it is not supplied.

How to create another partition or actually, another colinux block_device ?[]

<Gniarf> this page is old.

<quaestor>...but still useful, particularly with an update ;-).

<Franco> this is unrelated </Franco>

Man, that's what I get for editing wiki before coffee. I didn't even notice that this was for using Cygwin :-(

XP Pro (may also apply to Home; I don't know) includes a number of new command line tools, among them fsutil:

fsutil file createnew kubuntu.ext3 2147483648

creates a 2 Gig file called kubuntu.ext3 in the current directory.

(In all honesty, I found out about fsutil from the FAQ)

To create a sparse file:

fsutil file createnew <file> 2147483648
fsutil sparse setflag <file>
fsutil sparse setrange <file> 0 2147483648

This creates a file on disk which initially takes up only 4,096 bytes and will grow to an upper limit of 2 G as it fills (perfect for disk images).

The file created above can be passed in to coLinux as usual, and formatted from within a running Linux instance using, for example, "mkfs.ext3 /dev/cobd2". Then you can mount and copy as described below.

<Gniarf> continues...

  • the first part is about creating so-called filesystems formatted in ext3fs, usually from Cygwin. most people will directly download such files from the given URL
  • the second part is short and oriented on how to use them, like moving data with cp -ax

(you can use it to expand your Debian 1Gb image file to a 2Gb image file just by copying everything from one partition to the other with cp -ax. you can also mount /usr, /home, /var on a separate partition since they will get BIG, especially on the Gentoo image)

first you may need to create more block devices like /dev/cobd3 , 4... and more with commands like

mknod /dev/cobd3 b 117 3
mknod /dev/cobd4 b 117 4

<mxhash> Sometimes a script is very useful:

 for i in 1 2 3 4 5 6 7 8 9
    mknod /dev/cobd$i b 117 $i

<Gniarf> You can shutdown coLinux, copy your root_fs to borg_root_fs, add a line to default.colinux.xml :

<block_device index="2" path="\DosDevices\c:\colinux\borg_root_fs" enabled="true"></block_device>

and a line to your /etc/fstab file :

/dev/cobd2 /mnt ext3 defaults 0 0

then go to /mnt and treat yourself with a rm -rf .

Now if you want a partition with a different size, you would have to download the e2fsprogs package from , compile it (Cygwin worked for me with ./configure --disable-nls), create a file image and format it :

create a 512 Mo file : $ dd if=/dev/zero of=borg_root_fs bs=1024k count=512

  • 512+0 records in
  • 512+0 records out

format it to ext2fs : $ mke2fs.exe borg_root_fs

  • mke2fs 1.35 (28-Feb-2004)
  • borg_root_fs is not a block special device.
  • Proceed anyway? (y,n) y
  • (lots of stuff...)
  • Writing inode tables: done
  • Writing superblocks and filesystem accounting information: done
  • This filesystem will be automatically checked every 24 mounts or
  • 180 days, whichever comes first. Use tune2fs -c or -i to override.

convert it to ext3fs : $ tune2fs.exe -j borg_root_fs

  • tune2fs 1.35 (28-Feb-2004)
  • Creating journal inode: done
  • This filesystem will be automatically checked every 24 mounts or
  • 180 days, whichever comes first. Use tune2fs -c or -i to override.

next, edit your default.colinux.xml and /etc/fstab as previously mentionned and everything should be ok.

<Gniarf> now, you can avoid all this pain and download some here :

preformatted images of various size, from 128 Mb to 4 Gb, all suitable with Windows running on FAT32 and NTFS. there is even a quite larger 10 Gb image for users under NTFS only.

<ArKay> Of course--if you are too lazy to fiddle with GCC in cygwin--you can also

  • use dd in cygwin as mentioned
  • add the new partition file to your default.colinux.xml
  • boot your linux system and use mke2fs and tune2fs on the created partiton file (for instance /dev/cobd2)
mke2fs -j /dev/cobd2
tune2fs -j /dev/cobd2
  • copy over the files from your old partition or mount the new one to your liking ;)

<Gniarf> do you confirm you can use mke2fs and tune2fs from within colinux to access external partition files ? I remember I tried and couldn't get it to work, which is why I created this page and some pre-made files.

<ArKay> It worked fine for me out of the box. All I really did was to create the new file with dd, add it to the default.colinux.xml, run mk2fs on the unmounted /dev/cobd followed by tune2fs. Afterwards I was able to mount the new partition and copy over all of the files.

<quaiky> mke2fs worked for me with the gentoo image, but mkreiserfs didn't work

<Gniarf> ok, how do I actually copy everything from one partition to the other with cp -ax ?

the idea is to mount your older linux image in /mnt and your new image in /mnt2, then cp -ax /mnt/* /mnt2

so first you have to get a destination image like the ones here. and since you will use your current linux image as the source image, you want another linux image to boot colinux and mount your source and destination images.

so, either use a spare linux image, or just duplicate it (copy the file under windows, with coLinux not running, of course).

oh, usually your /etc/fstab will not be set to use /mnt or /mnt2, so mount them with lines like :

mount /dev/cobd3 /mnt2

also, you will get a message about lost+found being skipped. you can discard it.

<ncryptor> A quick tip for doing all this:

  • Turn off colinux
  • Copy your root fs to a new file
  • In windows, use python to add a lot of space at the end of your new rootfs using win32file.SetFilePointer to move the pointer to way past the end of the file:
>>> f=win32file.~CreateFile("Debian-3.0r2.ext3-mit-backports.1gb",win32con.GENERIC_WRITE, 0,None,win32con.OPEN_EXISTING, 0,0)
>>> f
<PyHANDLE at 8587216 (1968)>
>>> win32file.~SetFilePointer(f, 1024*1024*1024*4,win32con.FILE_END)
>>> win32file.~SetEndOfFile(f)
>>> win32file.~CloseHandle(f)
>>> ^Z


  • Update xml so colinux gets also the new device
  • In colinux (debian) apt-get install ext2resize
  • Use ext2resize to resize the new root partition to the new size (this takes a while...try using verbose i didn't)
  • Update xml so colinux uses the new instead of the old as root fs

MassTranslated on 25 Dec 2004.

MassTranslated on Sun Apr 23 17:35:57 UTC 2006

ManuallyAdjusted on 20 July 2008