The cofs device is used to directly access files and directories of a Windows host system from a coLinux guest system.
Please note: The cofs device is new in coLinux 0.6.2. It's still in the experimental phase and is very buggy! So don't blame us if it breaks your disk ;)... YES it is, it crashed my server when I tried to rename a file from within coLinux This and other crashes are fixed in coLinux 0.6.3. Please see Cofs in 0.6.3 for a description how to use it there.
If you only need to transfer data to coLinux once, you can use an ISO image. You can use Windows software such as burnatonce (http://www.burnatonce.com) (it's free for non-commercial use) to create an ISO file (pretend you are going to burn your files onto CD, then just check the 'Image File' box on the Data CD Mastering dialog), then specify the resulting ISO file in your coLinux configuration file (block_device index="2" path="\DosDevices\c:\coLinux\myfiles.iso" enabled="true"), and then mount it from within coLinux (mount /dev/cobd2 /mnt -t iso9660). Obviously, this is one way Windows-to-Linux and is a real pain to do frequently, but it does let you transfer files without networking and without cofs.
I could not find a documentation on the cofs device in this wiki, so I will relate what I found with Google:
To get direct access to parts of the Windows host's file system, you may put
<cofs_device index="0" path="\DosDevices\c:\" type="flat" enabled="true" />
in your colinux.xml.
Now you can mount this virtual device with
mount cofs0 /mnt/MYMOUNTPOINT -t cofs -o ro
In the coLinux directory, there is a file named cofs.txt that describes cofs devices in much more detail.
From cofs.txt the correct command is :
mount -t cofs (cofs)XX(:path) (-o options) /mnt/point
To grant read and write rights which enable access for all users, as well as to enable all users to mount the file system, place in /etc/fstab:
cofs0:/ /mnt/cofs0 cofs user,noexec,dmask=0777,fmask=0666 0 0
colinux-daemon kernel=vmlinux hda1=root_fs cofs0=c:\temp
colinux-daemon kernel=vmlinux cobd0=Debian-3.0r2.ext3-mit-backports.1gb cofs0=c:\temp root=/dev/cobd0 eth0=slirp
This maps cofs0 to c:\temp.
Now, to mount c:\temp to be accessable in coLinux...run the following linux command
mount -t cofs cofs0 /mnt/tempdir
This is assuming that you have created a directory in /mnt/ called tempdir
pfalcon: Specifying cofs in XML work for me neither in 0.6.2 nor in 0.6.3pre13. Using
daemon: exit code 88010001 daemon: error - CO_RC_ERROR_ERROR, line 64, file colinux/user/config.o (64)
Apparently, wrong tag. Using
<cofs> allows loading, but you cannot mount cofs device afterwards.
I could get it working only with command-line params.
mavoke: The code in the sample xml is wrong. It states mode=flat but it should be type="flat". Change it to the latter and it will work.
srusek: Since the coLinux service is running as System, that means that when someone ssh's in they have access to the entire harddisk.
D0odman: I'm a bit new to this, but after MUCH mucking around, and getting MANY MANY tags wrong, I was able to get cofs to mount a couple directories within the Gentoo-colinux-x86-2004.3 image from the site:
<?xml version="1.0" encoding="UTF-8"?> <colinux> <!-- This line needs to point to your root file system. For example change "root_fs" to the name of the Debian image. Inside coLinux it will be /dev/cobd0 Block Device Aliasing: You can now handle most dual-boot issues by adding an alias="devname" to block_device. i.e. alias="hda", alias="hda1" You can do this for SCSI as well as IDE. You need to be aware that if you add an alias, you need to change your bootparams root="devname" appropriately (you may need to use devfs naming in some situations). --> <block_device index="0" path="\DosDevices\c:\progra~1\coLinux\root_fs" enabled="true" /> <!-- This line can specify a swap file if you wish, or an additional image file, it will /dev/cobd1. Additional block_devices can be specified in the same manner by increasing the index --> <block_device index="1" path="\DosDevices\c:\progra~1\coLinux\swap_512Mb" enabled="true" /> <block_device index="2" path="\Device\Cdrom0" enabled="true" /> <cofs_device index="0" path="\DosDevices\c:\progra~1\coLinux\files" type="flat" enabled="true" /> <cofs_device index="1" path="\DosDevices\d:\" type="flat" enabled="true" /> <!-- bootparams allows you to pass kernel boot parameters --> <bootparams>root=/dev/cobd/0</bootparams> <!-- Initial RamDISK (initrd) support --> <initrd path="initrd.gz" /> <!-- image allows you to specify the kernel to boot --> <image path="vmlinux" /> <!-- this line allows you to specify the amount of memory available to coLinux --> <memory size="64" /> <!-- This allows you to modify networking parameters, see the README or website or wiki for more information --> <network index="0" type="tap" name="TAP" /> </colinux>
Both SEEM to mount fine, plus, I did some file moving, by copying files to the "files" directory within coLinux, and then seeing if I could delete them from within coLinux. Again, SEEMED to work fine. Another thing is that you're not able to access directories mounted within coLinux from windows. Hope this helps someone (I know it would've helped me four days ago :))
MassTranslated on Sun Apr 23 17:35:42 UTC 2006