Fandom

coLinux

HowtoCreateSwapFile

237pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Here you will find various ways of manually creating a dummy file to be used as a coLinux swap partition.

Note: The content of the swap file doesn't matter, you'll only need a file with the appropriate size.

For details how to add a swap partition to coLinux, see the AddSwapPartition page.

Note: After replacing the swap file, if you have the message "Unable to find swap space signature", you may need to do the following:
mkswap /dev/cobd1

Using (copy) an already existing file Edit

If you already have such a file with the desired size in your Windows system, you can simply copy that one into the coLinux directory, and name it as you want, eg. swap-file.

Using Windows-builtin tool fsutil (XP and later Only) Edit

Note: You must have administrator privileges to call fsutil.

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 for Fsutil, straight from the horse's mouth.

Additional info: http://www.winnetmag.com/Article/ArticleID/40935/40935.html.

Using Contig Edit

One of the features of Sysinternals 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 Edit

It is possible with Cygwin 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 Edit

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=1mb 21=2mb 22=4mb 23=8mb 24=16mb 25=32mb 26=64mb 27=128mb 28=256mb 29=512mb 30=1024(1gb)

Or you could type on COMMAND(DOS) window:

>copy con myfile
12345678^F6
>type myfile>>myfile
>...... repeat,repeat,repeat,....

Using Bochs Windows port Edit

It's easy to create a file of a given size on Windows using the Bochs Windows port. You need their tool called 'bximage' to do the job.

a.) Go to the Bochs Download Page:

http://bochs.sourceforge.net/cgi-bin/topper.pl?name=See+All+Releases&url=http://sourceforge.net/project/showfiles.phpqmrkgroup_ideq12580

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 the coLinux 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 at http://gnuwin32.sourceforge.net/packages.html (search for GNU fileutils).

There's another very nice Win32 dd port at http://uranus.it.swin.edu.au/~jn/linux/rawwrite/dd.htm.


MassTranslated on Sun Apr 23 17:36:18 UTC 2006

Also on Fandom

Random Wiki