You are not logged in.

#1 2006-07-17 23:33:20

n00body
Member
Registered: 2006-06-18
Posts: 29

Partition optimizations for install

I'm still new to the open *nix world as a whole, and I'm trying to wrap my head around the multiple mounted partitions approach (/, /var, /tmp, etc). I was wondering if someone could give me a brief rundown of why this is beneficial, and suggest a good layout for a 50 GB laptop hdd.

Thanks in advance. wink


Arch = Debian + Gentoo + Bleeding edge software - annoyances. wink

Offline

#2 2006-07-18 01:58:22

elasticdog
Member
From: Washington, USA
Registered: 2005-05-02
Posts: 995
Website

Re: Partition optimizations for install

A quick search of the forums should yield quite a few helpful threads about partitioning, but I can go over the basics.  The advantage to spliting up mount points on different partitions is basically protection and/or file system optimization.  What I mean by that is certain directories in the filesystem are special depending on what you're doing with your machine.  For instance, the <code>/var</code> directory contains files that change while the system is running.  That includes log files, mail is stored here if you have that running, etc.  So if you're running your machine for a long time and get spammed with mail, you may happen to fill up your harddrive...that will cause major issues and you might not be able to log in or do any real work to fix it.

If you separate the <code>/var</code> directory and put it on another partition, it's almost like putting it on another hard drive all together, so if you fill it up, it won't effect all the other areas and you'll still be able to log on and fix the problem.  Likewise, if you ever want to completely reinstall the operating system or switch distributions, you can protect all of your personal data if you put your <code>/home</code> directory on another partition as well.

Aside from protection in that sense, some file systems are better at dealing with large files, and some are better at dealing with small files; some are journaling, and others are not.  Due to these variances, you can use different file systems for different mount points depending on what kind of files it will contain.

So it basically all comes down to how you want to use your machine.  If this is just your personal desktop, I would suggest splitting up the space something like this:

Size    Mount   Filesystem
100MB   /boot   ext2   (ext2 is not journaled, but the boot partition doesn't need to be since it rarely changes)
1GB     swap    swap   (the size should be 2-3 times the amount of RAM you have)
3GB     /var    ext3
15GB    /       ext3
~32GB   /home   ext3

That is a simple setup that should be great for your needs.  <code>ext3</code> is well-established as the norm, and if this is your first *nix system, I'd put off messing with more extravagent file systems until later (xfs, jfs, reiserfs, reiser4, etc.).

The exact amounts are hard to tell since everyone uses their machine in different ways.  The best way to tell what's best for you is to set a machine up and use it for a while and see what you've used.  If you're curious, my machine has been set up the same way for a little over a year, and this is what it looks like:

$ df -Th
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/hda7 reiserfs     23G  9.0G   14G  40% /
/dev/hda1     ext2     92M   18M   70M  21% /boot
/dev/hda6 reiserfs    3.9G  805M  3.1G  21% /var
/dev/hda8 reiserfs     46G  1.7G   45G   4% /home

Good luck matey!  big_smile

Offline

#3 2006-07-18 02:24:20

n00body
Member
Registered: 2006-06-18
Posts: 29

Re: Partition optimizations for install

What about mount options, like noexec, & nosuid?


Arch = Debian + Gentoo + Bleeding edge software - annoyances. wink

Offline

#4 2006-07-18 03:05:40

elasticdog
Member
From: Washington, USA
Registered: 2005-05-02
Posts: 995
Website

Re: Partition optimizations for install

Well, my <code>/etc/fstab</code> file looks like this:

# 
# /etc/fstab: static file system information
#
# <file>    <dir>          <type>       <options>              <dump>  <fsck>
none        /dev/pts       devpts       defaults               0       0
none        /dev/shm       tmpfs        defaults               0       0
none        /tmp           tmpfs        defaults               0       0

/dev/cdrom  /mnt/cdrom     iso9660,udf  ro,user,noauto,unhide  0       0
/dev/sda1   /mnt/pendrive  vfat         rw,user,noauto,async   0       0

/dev/hda1   /boot          ext2         noatime                0       1
/dev/hda5   none           swap         sw                     0       0
/dev/hda6   /var           reiserfs     noatime,notail         0       0
/dev/hda7   /              reiserfs     noatime,notail         0       0
/dev/hda8   /home          reiserfs     noatime,notail         0       0

...although the <code>notail</code> option is specific to reiserfs and wouldn't apply to ext3.  Note that I use tmpfs for my <code>/tmp</code> directory, which I would recommend only if you have more than 1GB of RAM...otherwise leave it as it is by default (tmpfs just sets aside part of your RAM to use as storage, thus it's faster since temporary files don't have to stick around between reboots).  Also, you should have the <code>fsck</code> column set to <code>1</code> for the <code>/boot</code> partition, and set to <code>2</code> for all the other ext3 partitions.  The reason I don't is because reiserfs runs a file systems check (fsck) automatically each time it gets mounted.

If you take a look at the <code>mount</code> man page (type <code>man mount</code> on the command line) it tells what each of those options mean and when they should be used.  It's a bit of reading, but nice to know when you want to customize things.  Also googling for "fstab" returns a lot of helpful tutorials on the subject.

Offline

#5 2006-07-18 15:26:24

jaboua
Member
Registered: 2005-11-05
Posts: 634

Re: Partition optimizations for install

And in addition it's the subject of fragmentation - isolating the parts of the harddrive that change often will prevent fragmenting the whole root partition. That again makes the overall performance better.

Also, if there isn't a clean unmount, there is a greater risc of partition corruption on a partition being written to if the power suddenly goes down. On my smaller sisters' computer, I've put /home and /var on their seperate partitions and symlinked /tmp to /var/tmp because of that - since there is less writing to the / partition, there is less chance of the / partition being corrupted when they from time to time turn off the computer with the power button...

In freebsd I've used to split everything up, but in linux on my desktop I usually create /, /home and a swap partition. I use reiserfs for both / and /home, and use notail,noatime as mount options - they both increase performance, at the cost of diskspace (reiserfs tailpacking) and saving inode access times (I don't really need this).

Offline

#6 2006-07-21 03:23:12

n00body
Member
Registered: 2006-06-18
Posts: 29

Re: Partition optimizations for install

So is it more efficient to have both /var and /tmp on the same isolated partition?


Arch = Debian + Gentoo + Bleeding edge software - annoyances. wink

Offline

#7 2006-07-21 14:55:44

jaboua
Member
Registered: 2005-11-05
Posts: 634

Re: Partition optimizations for install

n00body wrote:

So is it more efficient to have both /var and /tmp on the same isolated partition?

You can put them together, AFAIK it doesn't really matter if you isolate /tmp from /var.

If you make /var it's own partition, just run "ln -s /var/tmp /tmp" and voila (remove /tmp before symlinking)

Offline

Board footer

Powered by FluxBB