Tuesday, 26 February 2008

AddSwapPartition in colinux

  • First, we need a file of predetermined size which will be used as our swap partition.

The size of this file will determine the size of the swap partition. You can create the file manually, or you can download and unzip one of the premade swap files of various sizes provided by <Gniarf> (the filename indicates the size of the unzipped swap file in megabytes).


  • You must declare the file as a virtual partition in your coLinux configuration file (see, for example, the file example.conf included with coLinux).

For example:


cobd1=c:\coLinux\swap-file

(If you are using a version of coLinux older than 0.7.1, then the configuration file is called default.colinux.xml and the format is completely different;
see ConfigurationXMLFormat for details.
The example above, for a coLinux older than 0.7.1, becomes <block_device index="1" path="\DosDevices\c:\coLinux\swap-file" enabled="true" />.)


  • Boot up coLinux, or reboot if it is already running.

Among the messages the kernel produces, there should be some mention of cobd1,
giving the size of your new (virtual) partition in megabytes.


  • Run ls /dev/cobd1 /dev/cobd/1 to determine which device name your system uses to refer to the swap file.

We will assume in the coming steps that your swap device is /dev/cobd1.


  • You must add an entry to the file /etc/fstab

in your Linux (guest) distribution to declare the swap partition and mount it at each bootup:


/dev/cobd1    swap    swap    defaults    0    0

(Change the name of the device as necessary.)

(Note: Using the Gentoo image, you can install vim
in your running system using the command emerge vim.
But you might want to wait until you have added swap space first;
if so, you can just use the pre-installed editor nano instead.)


  • Initialize the swap partition by running mkswap /dev/cobd1.

(If your swap partition was one of those prepared by <Gniarf>,
this step is probably unnecessary.)


  • Finally, to make use of your swap partition immediately without

rebooting, run swapon -a. You should see a message about
the swap space being added.

No comments:

My photo
London, United Kingdom
twitter.com/zhengxin

Facebook & Twitter