Walt Mankowski on 19 Dec 2007 12:15:57 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Pros and cons of swap in a partition vs. in a file in the file system


On Wed, Dec 19, 2007 at 02:53:04PM -0500, Jeff McAdams wrote:
> We've done this where I work, on occasion.  We have some commercial apps
> (aren't they always the problem children?) that insist on having x
> amount of swap space available on the system, regardless of whether
> there's ever any real chance of even touching it.  So we use dd to
> create a big file of the size needed, mkswap it, and swapon it at a
> priority level that it'll never get used.  Badly behaved commercial apps
> are happy, and the only thing we're out is some disk space that'll never
> get touched.  Shoot...if you can swing a way to create the file as a
> sparse file, there's a pretty good chance that most of that disk space
> will never actually get allocated anyway!

Using a sparse file as a swap file sounds like a really dangerous
idea, and I'm not even sure it's supported.  The manpage for mkswap(8)
says:

  Note that a swap file must not contain any holes

which would seem to rule out sparse files.

I always thought the main advantage of swap partitions over swap files
was speed.  All the bytes in a partition are continuous, so access
time is slightly higher than for a file created with dd, which can be
scattered over the disk.

Walt

Attachment: signature.asc
Description: Digital signature

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug