Re: Where do you put your swap partition?
On Wed, Jan 23, 2008 at 02:21:28AM -0500, Rick Thomas wrote:
> On Jan 23, 2008, at 1:40 AM, Ron Johnson wrote:
> >Rick wrote
> >>On my own systems, I make swap huge (10 GB or more for 1 GB RAM --
> >>Disk
> >>is cheap!) so I can mount /tmp on a tmpfs filesystem.
> >
> >Is this for apps that say "if malloc() fails, I create a tmp file"?
> > IOW, you pretty much ensure that malloc() will never fail?
> If you have /tmp on physical disk (e.g. an ext3 filesystem) the
> process of opening a file for writing, writing it, closing it, re-
> opening it for reading, reading it back in, closing it and deleting
> it, hits the disk several times, even with a large buffer cache. But
> if that file is in a tmpfs filesystem and you've got enough ram, the
> disk never gets involved. If it's in a tmpfs filesystem but you
> don't have enough ram, you have to swap, but you're no worse off than
> you were with the disk-based filesystem.
>
> Given that logic, and the fact that tmpfs is limited by the size of
> swap plus the size of ram, and the observation that disk is cheap and
> getting cheaper, why not make swap as big as you're ever likely to want?
It also makes having an encrypted /tmp easy to set up. Since /tmp gets
cleared on boot, it may as well start out empty. Set up encrypted swap
and put /tmp on tmpfs. Now they're both encrypted.
Doug.
Reply to: