HowtoCreateSwapFile
Here you will find various ways of manually creating a dummy file to be used as acoLinux swap partition.
For details how to add a swap partition to coLinux, see theAddSwapPartition page.
mkswap /dev/cobd1
Using (copy) an already existing file[]
If you already have such a file with the desired size in your Windows system, you can simply copy that one into thecoLinux directory, and name it as you want, eg. swap-file.
Using Windows-builtin tool fsutil (XP and later Only)[]
Go to Start->Programs->Accessories->Command Prompt
fsutil file createnew c:\colinux\swap_file 1000000000
Instead of 1000000000, you could use the following sizes:
- 64M: 67108864
- 128M: 134217728
- 256M: 268435456
- 512M: 536870912
- 1024M: 1073741824
It creates sparse files, so the creation is very quick.
boots: as a W2K user, I had never heard of this tool before. Looks interesting. Here is XP Doc page forFsutil, straight from the horse's mouth.
Additional info:http://www.winnetmag.com/Article/ArticleID/40935/40935.html.
Using Contig[]
One of the features ofSysinternals Contig is the creation of files. It then attempts to defragment the file:
contig -v -n swap-file 536870912
will create a 512Mb file.
Using Cygwin[]
It is possible withCygwin by using a Unix command like dd :
dd if=/dev/zero of=swap-file bs=1024k count=512
will create a 512*1024*1024 bytes aka 512Mb file.
Using notepad[]
Very stupid way how to create any file, preferable 2^N size:
- Open notepad, create a new text file containing only the letter "a" and save it as "swap.txt"
- Go into the directory containing "swap.txt" and check that it is only one byte using dir.
- Double the size of the file as required by using "type swap.txt >> swap.txt".
- Each time you call the previous line, it will double the size of the file. Executing it 10 times will give a one kilobyte file. 20 times will give a one megabyte file.
Times executed=Resulting filesize(mb)
20=1mb21=2mb22=4mb23=8mb24=16mb25=32mb26=64mb27=128mb28=256mb29=512mb30=1024(1gb)
Or you could type on COMMAND(DOS) window:
>copy con myfile12345678^F6>type myfile>>myfile>...... repeat,repeat,repeat,....
Using Bochs Windows port[]
It's easy to create a file of a given size on Windows using theBochs Windows port. You need their tool called 'bximage' to do the job.
a.) Go to the Bochs Download Page:
and download bochs-2.1.1.win32-bin.zip.
b.) Extract from this archive the file 'bximage.exe' which is a stand-alone binary and put it in a suitable directory.
c.) Open up a Windows Command Prompt, cd to thecoLinux installation directory, and run bximage.
d.) Create a hd image, flat image.
e.) Specify the size of the swap file you want in MB (I created a big 1024MB swap file).
f.) Choose the file name you want (e.g., swap-file).
g.) Ignore the bochsrc info statement and hit enter. You're done creating an empty file to use as a swap file!
There is a native WIN32 dd port athttp://gnuwin32.sourceforge.net/packages.html (search for GNU fileutils).
There's another very nice Win32 dd port athttp://uranus.it.swin.edu.au/~jn/linux/rawwrite/dd.htm.
MassTranslated on Sun Apr 23 17:36:18 UTC 2006