|Note: The method described here has largely become redundant and is now superseded by using cofs.|
quick and easy data transfer without network Edit
If you want/need to get data into colinux before you have networking setup, you can use an archive file as a cobd and extract it inside colinux. Unfortunately the cobd device works in blocks of 512 bytes and any part of your file after the last block of 512 bytes will be cut off.
- tar files are built in 512 byte blocks anyway so it is not an issue with these.
- tar.gz and tar.bz2 files should be decompressed (to .tar) on the windows side. Suitable tools are available from http://unxutils.sourceforge.net (look for bzip2.exe, bunzip2.exe, gzip.exe, gunzip.exe, and tar.exe).
- zip files can have padding prepended at the start so that their size is a multiple of 512 bytes. (They were designed this way to allow for self extracts). Plugwash has a tool to do the proper padding available at http://www.p10link.net/plugwash/smallutilities/. To use it, specify the input and output files on the command line in that order and you will get a file suitable to use as a cobd device and unzip inside linux.
<Gniarf> ok, lets clarify things a little (reformulation) :
- to import and export data (files, mostly) from and to coLinux, you can use the network (ftp, wget, rcp, rsync...), the coserial extension (currently being developped) and raw devices, which are the subject of this page
- since we need the network to download new software via apt-get, yum or emerge, and to run PuTTY and X servers or VNC, using the network to transfer data this is rather natural
- unfortunately, sometimes the network can be quite hard or even impossible to setup on some Windows configurations, and sometimes the Linux image you are using doesn't support the network either (busybox rescue disks)
- /dev/cobd2 as an example is a typical coLinux block device, it usually points to a file as defined in your coLinux .xml configuration file. it can also point to a whole partition, a ISO file, or a CD-ROM (either physical or emulated via DAEMON Tools), but thats not the subject here.
- you can use those to transfert data from and to coLinux.
To transfer data TO coLinux (usually what you need until network works)Edit
- I use the dd command to do that:
dd if=/dev/cobd2 of=/foobar bs=1M
- you don't need the count option BUT...
- ...there is a rather boring technical limitation: if the file size is not a multiple of 512 bytes, the transfer will stop at the last full block device no matter what you do, the remaining data will be LOST, and the resulting file (/foobar) will be truncated.
- (we think its a limitation of Linux itself, or maybe its by design, rather than it is a coLinux bug (to be checked and corrected if necessary))
- so you can use the small program mentionned earlier or use tar (Cygwin or win32 port). I describe this "tar trick" here.
- also you will be confused at first : the name of the file (or archive) you want to inject into coLinux is NOT the one used in your coLinux .xml configuration file. and that name can not change while coLinux is running (the name, not the content).
- so name a entry in your coLinux .xml configuration file like this :
<block_device index="2" path="\DosDevices\c:\colinux\data_transfer.tar" enabled="true"></block_device>
- pack the files you want to inject into coLinux like this :
tar -cf data_transfer.tar yourfiles*
- once this is done, copy them to coLinux :
dd if=/dev/cobd2 of=/tmp/foobar.tar bs=1M
- and extract them with
cd /tmp tar -xf foobar.tar
- you can check the data transfer was ok with the md5sum utility on both .tar files.
To transfer data FROM coLinuxEdit
- ok, its almost as easy. think of the previous data_transfer.tar file on the Windows side as a floppy disk :
- it must be present
- it must be big enough to welcome all the data you will send.
- so you can use the dd command from Cygwin to create this empty file :
dd if=/dev/zero of=data_transfer.tar bs=1M count=(size wanted and a little more)
or just copy any other file that is big enough and rename it as data_transfer.tar - it can be much bigger, no big deal.
- now pack the files you have in coLinux like this :
cd /tmp tar -cf foobar.tar yourfiles*
- once this is done, copy them to Windows : type from coLinux :
dd if=/tmp/foobar.tar of=/dev/cobd2 bs=1M
- and extract them in the Windows world with any Winzip clone or
tar -xf data_transfer.tar
you can expect speed like 10, 15 or even as high as 25 Mb/s, depending of Windows file cache.
<Gniarf> it seems that (dd option) conv=notrunc will prevent dd from truncating the last block and will not force you to use this tar trick.
MassTranslated on 25 Dec 2004. max: shouldn't all this now be easier with the newer versions of colinux that support cofs? As long as you're using the standard version of colinux like 0.61 then you don't have cofs anyways. So Keep on reading. Otherwise, could someone please explain here what cofs is, why it is better than the method here and put a link to a some documentation?
MassTranslated on Sun Apr 23 17:35:31 UTC 2006
- If you add a line like "cofs0=d:\" to your config file, you will get a new device. Then you can place a folder on your desktop named "D" and go "mount -t cofs cofs0 ~/Desktop/D" on the commandline and you have instant access to all your archives and documents. 22.214.171.124 06:42, 9 December 2007 (UTC)