swapless in Toronto

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Mon Feb 7 18:33:43 UTC 2005


On Mon, Feb 07, 2005 at 01:11:15PM -0500, David J Patrick wrote:
> Lennart Sorensen wrote:
> 
> >
> >dd if=/dev/zero of=/swapfile bs=1M count=512
> > 
> >
> djp at otter:~ $ sudo dd if=/dev/zero of=/swapfile bs=1M count=512
> Password:
> 512+0 records in
> 512+0 records out
> 536870912 bytes transferred in 35.092725 seconds (15298638 bytes/sec)

512MB of zeros were written to a file named /swapfile.  dd read 512
counts of 1M chunks from the device that generates zeros.

> can you tell me what happened here ? (I trust you, Lennart, so I just 
> went and did it) but I'd like to know.
> (and how come it took you a whole seven minutes to come up with this ? 
> were you in the can ?)

I wasn't looking at that terminal at the time :)

> I'll do it as soon as I understand step A

mkswap formats the file as a swapfile.  Just like mkswap /dev/hda1 would
format partition 1 on the hda as a swap partition.

man mkswap will tell you all about it.

> /swapfile   /swapfile   swap   defaults   0   0            ?

That would do it yes.

At the end you can 'swapon -a' to enable all swaps in fstab.

> As long as I can avoid the memory trainwreck, I can wait a few extra 
> nanoseconds.

Yeah generally swapping isn't needed with todays quantities of ram, so
when it is needed once in a while, having to use a swapfile isn't too
big a deal, and a whole lot less effort than repartitioning.  And if you
stop needing it later, you can just remove the fstab entry and delete
the swapfile.

Lennart Sorensen
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list