Creating Swap Areas

Janina Sajka janina at rednote.net
Tue Oct 5 21:35:45 UTC 2004


I've been using swap files, rather than swap partitions, without any
problems whatsoever. Frankly, I think there's every reason to just
create a swap file. However, whether you create a file, or repurpose
some existing partition, you still have to do certain things for it to
be a swap partition. You don't just rename it and label it "swap."
There's more to it. It's its own file type (82), for instance.

If you look at the mkswap man page you'll see that you need to do
something like:


              # dd if=/dev/zero of=swapfile bs=1024 count=65536



before using the mkswap command. Thereafter, though, you can turn it on
by hand with swap on, or just put it in fstab.

John J. Boyer writes:
> Tim,
> 
> Thanks. This should do the trick. One additional question: I have a 
> partition called CP/M / CTOS. ?What is that for? Can I change it to a 
> swap partition? It's about 3 GB.
> 
> Thanks,
> John
> 
> 
> 
> On Tue, 5 Oct 2004, Tim Chase wrote:
> 
> > Mr. Boyer,
> > 
> > (I CC'd you in, as I've had trouble getting my account to
> > successfully post to the blinux list and this may not go
> > through...if it doesn't show up there, and you think it would be
> > helpful, you're welcome to repost it to the list)
> > 
> > There's a good tutorial on swap partitions and swap files found
> > on RedHat's site at:
> > 
> > http://www.redhat.com/docs/manuals/linux/RHL-8.0-Manual/custom-guide/s1-swap-adding.html
> > 
> > It's supposedly for RH 8.0 which is a bit old, but the same
> > method should work in other distros as well.  It's got two
> > sections...one entitled "To add a swap partition", and a second
> > entitled "To add a swap file".
> > 
> > A swap partition is always the better (read "faster") option if
> > you have the opportunity, as it doesn't require going through a
> > file-system.  However, if you just want to create one on the fly,
> > make use of it for some intensive task, and then remove it, using
> > a simple swap file is easy way to go.  Partitions, on the other
> > hand, require you to plan ahead sufficiently to have such a
> > partition available (or risk monkeying with
> > partition-editing/resizing tools).
> > 
> > And just to cover my own tail, beware of editing/resizing
> > partition tables...you can hose your whole box with very little
> > effort (grins).  Take care and hope it gets you put on the right
> > path to swapping nirvana.
> > 
> > -tim
> > 
> > 
> > 
> > 
> > 
> > 
> 
> -- 
> John J. Boyer; Executive Director, Chief Software Developer
> Computers to Help People, Inc.
> http://www.chpi.org
> 825 East Johnson; Madison, WI 53703
> 
> 
> _______________________________________________
> Blinux-list mailing list
> Blinux-list at redhat.com
> https://www.redhat.com/mailman/listinfo/blinux-list

-- 
	
				Janina Sajka, Chair
				Accessibility Workgroup
				Free Standards Group (FSG)

janina at freestandards.org	Phone: +1 202.494.7040




More information about the Blinux-list mailing list