[PLUG] Position of swap partition

Robert Munro ramunro at speakeasy.net
Thu Oct 28 06:57:27 UTC 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/27/2010 Rich Shepard <rshepard at appl-ecosys.com> wrote:

> Does it matter what partition is formatted as swap on a drive? On my new
> hard drive I've made 3 partitions, and think I should redo it because I made
> /dev/sda1 the swap, /dev/sda2 will be /, and /dev/sda3 will be /tmp. I'm
> thinking I should repartition so the sequence is /, swap, /tmp.

Overall, why do you want just one partition for everything?  There are
good reasons to partition separate logical drives for different roles.

I agree that you shouldn't need to use a swap partition.  I have a few
on various disks but seldom see them in use.  I put other disks first.

However, I might offer some further comments on partitioning, if I may.

First, unless you're running a web and/or database server that makes a
lot of use of /tmp for static files, relational query results sets, or
whatever, you shouldn't need a physical /tmp partition at all.  Use an
entry in /etc/fstab instead to create an in-memory /tmp at every boot:

none /tmp tmpfs defaults 0 0

I happen to have a physical /tmp partition on this desktop system just
because it has got a ridiculous amount of hard disk space for my needs
and, with an Apache instance and Mysql plus a load of ordinary desktop
applications, it's just 79MB in size, a snip if you've got GBs of RAM.

Sure, something could run amok filling up your in-core /tmp partition,
locking up your system, but I do not recall that ever happening to me.

Second, why don't you want to have a separate /home partition?  That's a
good idea for backups, scrubbing deleted files, and carrying forward
your user configuration over software upgrades.  Having your own /home
partition keeps a lot of disk activity separate from your system files
in the root partition and applications software which resides in /usr.

Speaking of which, having a separate /usr partition seems like a great
idea to me, too.  The stuff in the root "/" partition doesn't change a
lot with distro updates, but /usr gets a lot of activity over time, if
you accept the software upgrades the better distros put out regularly.

A /usr partition is a good idea, too.  The hint is in the above advice
regarding the relative levels of activity between software partitions.

You can force things like Adobe Reader and Google Earth to install on
/usr with the link command (assuming there's nothing already in /opt):

ln -sf /usr/local /opt

It's also a good idea, I think, to have a separate /var partition, as
that gets a lot of activity, too.  I also have a /boot partition just to
be able mark it read-only if I get paranoid, but that's a bit much.

Here's what I've got at the moment:

Filesystem            Size  Used Avail Use% Mounted on
/dev/sda6             433M  211M  200M  52% /
/dev/sda14             21G  6.3G   13G  33% /data
/dev/sda5              61M   28M   30M  49% /boot
/dev/sda7             1.5G  929M  577M  62% /home
/dev/sda11            4.0G   79M  3.7G   3% /tmp
/dev/sda10            5.0G  3.6G  1.2G  76% /usr
/dev/sda9             2.5G  167M  2.2G   7% /var
/dev/sda12             20G  194M   19G   2% /var/lib/mysql
/dev/sda13             20G  216M   19G   2% /var/www

Yes, I use all logical drives, defined in a secondary partition table.

However, do whatever seems right to you, of course.  And, best wishes.

HTTH,
Robert

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkzJHtcACgkQ+qYMIUkNJCzm0gCgxSJb028XCLQ47pBry06bPPtF
ok4AoICFp4ywnNkjFA3sWJ04SiqeUIFR
=2Srv
-----END PGP SIGNATURE-----



More information about the PLUG mailing list