[Gllug] To partition or not to partition

Philip Hands phil at hands.com
Mon Oct 11 12:03:46 UTC 2010


On Mon, 11 Oct 2010 11:00:18 +0100, Alain Williams <addw at phcomp.co.uk> wrote:
...
> A radical simplification of my above partitioning could be to just split data and programs,
> so 2 partitions:
> * /home (symlinks into here for: /tmp & /var)
> * / (everything else, ie : also /usr & /boot)

I'd suggest mounting /tmp /var/locks and /var/run as tmpfs these days
(and probably /var/tmp, but that would change behaviour as that normally
survives reboots).  Not just for the simplified scenario, either, it's
just that's where you mentioned dealing with /tmp, so that's what I'm
replying to.

To that end, on recent Debian (and so I presume Ubuntu and other
derivatives) there are actually settings for the /var mounts, in
/etc/defaults/rcS:

  RAMRUN=yes
  RAMLOCK=yes

You also get to tune the sizes in the same file with (e.g.):

  TMPFS_SIZE=4096m
  RUN_SIZE=10m
  LOCK_SIZE=10m

The TMPFS_SIZE sets a default limit for such file systems.  In this
example I'm then turning that down to a smaller limit for the lock and
run dirs, as I didn't want to allow an unprivileged user eat 12GB of
virtual memory on the machine.

In order to mount the tmpfs file system on /tmp you'll want something
like this in /etc/fstab:

  tmpfs   /tmp    tmpfs   size=4096m,mode=1777        0   0

(seems I've explicitly set that to 4GB here too, oh well)

Of course, you'll want to ensure that you've got enough swap to back
the allocation of space, but you just freed up the filesystem that was
previously used for /tmp, so that's OK, and if you don't use the room
for /tmp, you're now free to use it as swap, and most writes to /tmp
will never make it to disk at all.

Add ramzswap to the mix to make it even less likely to touch the disk.

Cheers, Phil.
-- 
|)|  Philip Hands [+44 (0)20 8530 9560]    http://www.hands.com/
|-|  HANDS.COM Ltd.                    http://www.uk.debian.org/
|(|  10 Onslow Gardens, South Woodford, London  E18 1NE  ENGLAND
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 851 bytes
Desc: not available
URL: <http://mailman.lug.org.uk/pipermail/gllug/attachments/20101011/9ac7a169/attachment.pgp>
-------------- next part --------------
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug


More information about the GLLUG mailing list