From: Drew Eckhardt (drew@kinglear.cs.colorado.edu)
Date: 05/28/92


From: drew@kinglear.cs.colorado.edu (Drew Eckhardt)
Subject: Re: making a swap file
Date: Thu, 28 May 1992 11:33:18 GMT

In article <13549@umd5.umd.edu> colbert@astro.umd.edu (Edward J.M. Colbert) writes:
>A short question: can I create a swap file on an existing linux
>partition without destroying the data that's already on it?
>
>Ed

Yes. First, you need to make a file - there are a number of ways of
doing this, but the simplest will be to use dd.

dd of=<swapfile> bs=1024 count=<size>

where swapfile is the name of the swapfile to create, and count
the size in K.

Now, you need a data source for dd - something you pipe into it.
Some people have suggested using the raw disk device, but if
dd encounters read errors, it will stop, which is BAD.

So, you want to do something like

yes REALLY_REALLY_LONG_STRING | dd of=<swapfile> bs=1024 count=<size>

Then do a mkswap on that file.