18-97-9-173.crawl.commoncrawl.org | ToothyWiki | LinuxBox | RecentChanges | Login
Warning: Religious war ahead!
1. Why partition?
(MoonShadow's opinion follows; MoonShadow is an amateur, and is always willing to be taught by those better informed than himself - take what follows with a pinch of salt!)
Yes, there's nothing to stop one just lumping everything together in one huge partition. But it may be helpful to not do that. In particular, it may be helpful to put at least /usr and /home into their own partitions.
(a) To allow for growth
Why? Because they are both liable to grow lots. /home is where your data is stored. /usr is where software tends to get installed. Temporary data gets written to /tmp and /var by software that is running, and in most cases if the partition that /tmp and /var are on fills up, bits of the OS will begin to quietly fail. Typically, not very much room is required for temporary data; but it's a nonzero amount.
(b) Ease of migration
Putting the pieces of your filesystem that are going to expand a lot on separate partitions makes it easier to migrate to bigger partitions later should you decide to do so.
- PeterTaylor isn't quite sure he agrees. Initially, he had all his stuff on the primary partition. When he finally worked out that the reason X had started breaking was that it had no space for /tmp, he spent most of a Saturday setting up the current structure. If you don't know how to use mount, learn _before_ you starting moving your partitions. (I started off trying to use symlinks... Fortunately, I had a Windows box which I could use to access the web and get help from a few people on the UserFriendly discussion board). If you do know how mount works, it's fairly straightforward to migrate everything.
(c) Flexibility of system recovery(?)
- OK, "expand a lot" isn't really the reason. One might want to stick /usr and /home on separate partitions rather than /tmp and /var because it's a lot easier to get the system into a state where it is not using the former so you can remount them without rebooting than in a state where it is not using the latter. - MoonShadow
(d) Sharing /home between different root filesystems
- Another reason is that if you want to install a different distro of Linux then you can easily mount the /home partition in the same place without any faff (though I think there's now a mount option to mount a subdirectory of a filesystem, so that may be less relevant). - Hawk
(e) Mitigating effects of full partition
As an additional reason to the ones listed above, it helps the novice user's system to not break in nonintuitive ways. Typically, if (e.g.) X is freaking out because you are out of space, there is no obvious indication that that is the reason - you have to examine the logs, and it might not necessarily be obvious even then. If you are copying a file and run out of space, you get told so and can go and fix it without burning time investigating the cause of the problem. While it is true that this is a problem with error reporting, the simplest way for the novice to deal with it is to partition such that the system is more likely to fail in an intuitive way than with intermittent glitching with no obvious cause. However, this is merely my opinion - YMMV. - MoonShadow
/var is something I've often been glad was in a partition to itself: occasionally something goes mad, or just gets used more than expected, and the resulting logs soon fill up whatever filesystem they happen to be in; and it's nice not to have home directories impacted by this. Rjk
(f) Different selections of mount attributes or filesystem types
Also, splitting the filesystem up into partitions allows you to set some of them nosuid, noexec, readonly and so on as appropriate, thus improving security. - MoonShadow
- noexec doesn't work properly and has zero security benefit. Rjk
- e.g. tmpfs for tmp, reiserfs for /home or whatever --Bobacus
(g) Reduce the effects of filesystem corruption
If /var's superblock is broken, at least you have /home (say). --Bobacus
(h) Ease/flexibility of imaging
More partitions means you can separate image files, to image a smaller portion. If the image files are smaller it is (obviously) less data to keep throwing around. This is probably not a concern for the average home user :-) --Bobacus
(i) Filesystem fragmentation or locality
There is a small benefit to having files close to each other on disk. (e.g. I read somewhere that someone had done an experiment, where a 20G partition on a 40G disk was marginally faster than a full 40G disk. But that was sacrificing space for speed...) --Bobacus
Fragments of individual files would be located close with a simple multiple partition setup. --Bobacus
2. Why not partition?
Why bother with separate partitions? I can understand having /boot separate on machines where big disks are a problem. Anything else just limits your flexibility IMNSHO - yes you might fill up the disk and the machine starts complaining a bit, but if you fill up the disk then you've got to start deleting stuff anyway. If you've got more than one user then enforcing /DiskQuotas? is better than limiting them by the size of /home. Novice users should certainly just stick to having one / and one /boot partition, because they don't know how the relative sizes of /usr /home and /var are going to work out. --Mjb67
Complicates Debian woody installation due to apt cache being located in /var (see below)
If you have a separate /tmp (I use tmpfs for this mostly since I don't care about the contents of /tmp surviving reboots, but you could just use disk), what (if any) is the argument for separating / and /usr? Rjk
- The most common argument I've seen is so that you can mount /usr read-only. Also, /usr/src tends to grow rapidly if you are rolling your own kernels. Admittedly, neither of those are very strong reasons. - MoonShadow
- How many distributions actually make it practical to mount /usr RO? I believe it's supposed to be an implication of Debian policy that it should work but I've no idea if it actually does, and bet that some package somewhere breaks it... Rjk
- dpkg :-) --Bobacus (otherwise I've had no problelm with a read-only /usr)
3. Discussion
Rjk would say that there are two primary considerations to balance:
- If you partition, then you'll run out of space on one of the other partitions before you would have done had you not partitioned.
- If you don't partition, then excess usage in one area of the filesystem affects other areas in a way that it wouldn't if you didn't.
The decision of whether and how to partition depends on how you balance these considerations, and that depends on what you're trying to achieve.
Logical volume management is glorious, where supported.
Bobacus says: don't forget inode requirements! I spent ages wondering why my Maildir-format IMAP server was giving "No space on disk" errors when df clearly showed there were free blocks (and not just for root), thinking it was some kind of bug in the IMAP server. It was only when I got the same error trying to create a small file in my home directory that the penny dropped... df -i people. (For some reason /home had escaped my reiserfs fervour and was still on ext3.)
(more religious wars go here)
4. What to partition?
MoonShadow's recommendations for partition sizes:
/ 300-400Mb
/usr 1.5Gb-4Gb, depending on how much software you want to install to play with
/home 100-200Mb (unless you are planning to store media in your home directory,
in which case whatever you can afford)
If you're installing Debian, it downloads packages into /var, so that needs to be big enough during installation for whatever will end up in /usr! :/ evil.. sorry, Kazuhiko-san, I had no clue! - MoonShadow
- *shrug* Don't worry about it. It's not a huge process to scrap it and start again. I think one of my main problems with what I've seen of Linux so far is a complete lack of helpful recovery functions. Shouldn't it either tell me/warn me that I should leave more room for the drive with /var in it or tell me a way around it when it fails? As it is, I was dropped back to a command prompt without even being told a way of re-running the installer... - Kazuhiko
Don't forget the swap partition. Swap+RAM should total 200+ megabytes for a heavily-used workstation. You can add more swap partitions later if you start running low on memory.
- PeterTaylor would say you want 256MB+ RAM and 256MB+ swap for any workstation on which you're running X. (Most certainly don't do what I did once and try running X with only 32MB physical mem).
- MoonShadow disagrees. X with fvwm2 or twm is perfectly happy with 32Mb physical memory, and /Debian and /RedHat? distributions both include a set of twm-and-xsession-and-nothing-else configuration options. 1024x768 32-bit colour X running Gnome or KDE desktops on top of Enlightenment might be rather unhappy, but that's another matter. MoonShadow's main desktop has 140Mb or so of RAM (110 or so until very recently), runs 4 800x600 X servers with two users typically logged in and running mozilla and a few xterms all the time, and uses about 80-90Mb of RAM total running all that. Swap file gets used when third user logs in, or when someone starts up gimp or xine.
- Ye gods and little fishies. I know linux (and especially X) are becoming bloated - but are you serious? I've seen it running on four meg 486s just peachy (some years ago) - so what on earth has gone wrong since then? --Vitenka
- To be fair, we *are* talking about packaged distributions here - the ones you can get going just using gui/menu tools, without touching a text editor, that contain lots of multimedia fluff. OTOH, you can get a two-floppy distribution that includes an X server and runs on a 386DX with 4Mb RAM out of the box... - MoonShadow
- PeterTaylor was running a single 800 x 600 Gnome desktop and sitting for about 5 minutes opening an xterm while the HD churned. This was on a fairly standard RH7.2 install. I'm guessing 24 bit colour.
- Like I said above, blame Gnome, not X (difference being the one is somewhat easier to run X applications without than the other) - MoonShadow
- My apologies. I would note, however, that with RH, and possibly other distros as well, if you want to install X you have to have Gnome or KDE, and if you run xdm you will get a desktop.
- Incorrect. Like I said above, both RH and Debian include an option on the xdm login screen to run xsession with twm - just click on the "sessions" tab. - MoonShadow
- There is no tab. Just two text fields for username and password.
- Lately KDE's been making people use 'kdm' not 'xdm', which doesn't have quite so obvious session options (although it is still possible to coerce a 'failsafe' session out of it if you poke it right).
If you have a fast and a slow hard drive, put /tmp, /var and the swap partitions on the fast one; /usr too if it'll fit. If you're tight for space, you can have some swap partitions on each drive and give them priorities.
5. Show and tell.
PeterTaylor's RH7.2 install gives this response to "df -m":
Filesystem 1M-blocks Used Available Use% Mounted on
/dev/hda1 1511 138 1297 10% /
/dev/hda2 1010 112 846 12% /home
/dev/hda3 1511 1307 128 92% /usr
- For comparison, my laptop has (in the Debian/stable install):
Filesystem 1M-blocks Used Available Use% Mounted on
/dev/hda5 957 873 36 97% /
/dev/hda7 357 1 338 1% /tmp
/dev/hda8 1922 1678 146 92% /mnt/aleph
/dev/hda9 1104 573 475 55% /mnt/bet
- Where /mnt/aleph currently has most of usr and home, and /mnt/bet has those bits of usr with CivCTP in. home uses up about 1/3 of /mnt/aleph. -- Senji
Emperor's computer looks much like this:
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/hdb1 3844584 163892 3485396 5% /
/dev/hda1 1035660 50256 932796 6% /spare
/dev/hda3 57551060 57533780 17280 100% /mirror
/dev/hdb9 7088976 4073756 2655116 61% /home
/dev/hdb8 3844584 2643936 1005352 73% /extra
/dev/hdb7 3844584 564788 3084500 16% /var
/dev/hdb6 3844584 2743716 905572 76% /sound
/dev/hdb5 3844584 2791372 857916 77% /usr
...and yes, that mirror does need fixing :( OTOH, the routing table (minus all the secnet gumpf) is quite scary too:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
172.16.22.200 172.16.22.65 255.255.255.252 UG 0 0 0 eth0
62.3.108.16 0.0.0.0 255.255.255.248 U 0 0 0 eth2
172.16.22.224 0.0.0.0 255.255.255.240 U 0 0 0 eth0
172.16.22.240 0.0.0.0 255.255.255.240 U 0 0 0 eth1
172.16.22.0 0.0.0.0 255.255.255.128 U 0 0 0 eth0
0.0.0.0 62.3.108.22 0.0.0.0 UG 0 0 0 eth2
I opted for sound files to be somewhere else; mostly so I can avoid backing them up :) There's a swap partition on hda (500MB, and I have 448MB RAM); I think 5GB for /usr as you suggested above is over-doing it a bit - I'm only using 2.8GB here, and I Have quite a lot of crufty software and data in /usr these days...
Oooh, since we're all doing it:
[mjb67@mjb67 mjb67]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hdb2 54G 31G 21G 59% /
/dev/hdb1 45M 17M 26M 40% /boot
/dev/hda1 9.5G 6.9G 2.6G 73% /mnt/cdrive
none 252M 0 251M 0% /dev/shm
So you see, I've just gone for one big partition, really. 28G of that 31G is anime in /home. /usr is 2.4G. Heh, on the windows side /mnt/cdrive is called hda1 in Explorer :-)
My anime folder on my laptop comes to 6Gb already and I have some stuff on my home machine which is not on my laptop ^^;; - Kazuhiko
Filesystem 1M-blocks Used Available Use% Mounted on
/dev/hdb8 2950 2702 98 97% /
/dev/hdb9 5907 351 5257 7% /home
none 378 0 378 0% /dev/shm
/dev/hdb6 2032 6 2026 1% /mnt/shared1
/dev/hde1 38162 37133 1030 98% /mnt/ntfs/6
/dev/hda5 10237 6256 3982 62% /mnt/ntfs/1
/dev/hda6 12928 11681 1248 91% /mnt/ntfs/2
/dev/hdb5 2040 914 1126 45% /mnt/ntfs/3
/dev/hdb7 5115 3086 2030 61% /mnt/ntfs/4
It now looks like this, after mounting all my NTFS patitions ^_^
- Read-only, I trust ^^; - MoonShadow
I will be changing hde1 so that it is mounted in ntfs/5 rather than 6, so there isn't a gap.
Filesystem Size Used Avail Use% Mounted on
/dev/hda2 25G 6.9G 17G 30% /
/dev/hda1 19G 3.4G 16G 18% /win98
/dev/hda4 30G 6.1G 23G 22% /lfs
I had just one Linux partition for a while. Then I got bored one day and installed /LinuxFromScratch?, in another partition. However, now I've been a Linux user for a while I think if I was starting again I would make a number of smaller partitions.
Filesystem Size Used Avail Use% Mounted on
/dev/hda 201932.8 72M 26M 73% /
/dev/hdd 4G 18M 4G 1% /msdos
But the hard drive is failing (has failed) irrecoverably.
Seriously - I understand the arguments for having a separate main partition - but why have a separate home and usr?
- (PeterTaylor) In my case, it was in part a hangover from my Windows system experience, where it makes a lot of sense to have separate partitions for OS, apps and data (because virus writers might forget to trash every filesystem). Since Linux has fewer virii and one root, this is less relevant, but I didn't spend ages thinking about reasons for and against partitioning when I installed RH.
- Fair enough - but all the problems of separate partitions for windows still apply, surely - that it is annoying to have two partitions with not quite enough space left for your game, between them it would be fine, but you can't quite fit it in... Symlinks help, but kinda annoying. I understand state of the art allows you to munge a whole bunch of different drives onto a single mount point and not have to worry about what goes where - how easy is this to set up in practice? --Vitenka
- (PeterTaylor) I only use about 30% of each partition on the Windows box, so I'm not worried about leftovers. I have no experience in munging drives into a single mount.
Not following my own advice; /usr isn't on a separate partition, although /usr/src ended up being..
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/hdb1 2029904 1467080 459708 77% /
/dev/hdc7 109084512 17466820 86076476 17% /home
/dev/hda1 2084324 1679320 405004 81% /mnt/c
/dev/hda6 4818072 3876900 941172 81% /mnt/e
/dev/hdc1 988212 295628 642384 32% /usr/src
/dev/hdc6 7882560 645544 6836600 9% /usr/share
/dev/hda3 790588 642380 108048 86% /mnt/oldhome
lyonesse$ df -m -xnfs
Filesystem 1M-blocks Used Available Use% Mounted on
/dev/hda3 1867 1503 267 85% /
/dev/hda1 2047 1747 300 86% /dos
/dev/hdc1 7985 1487 6499 19% /dos2
/dev/hdc3 4032 1750 2077 46% /export
/dev/hdc5 1008 719 238 76% /var
/dev/hdc6 11569 2309 8672 22% /space
tmpfs 256 1 255 1% /dev/shm
sfere$ df -m
Filesystem 1M-blocks Used Available Use% Mounted on
/dev/hda3 4806 1718 2844 38% /
/dev/hda1 29 5 23 17% /boot
/dev/hda5 277 218 44 84% /var
/dev/hda6 185 141 34 81% /var/spool/news
/dev/hda7 462 406 32 93% /var/spool/squid
/dev/hda8 3845 3366 283 93% /export
/dev/hda9 16061 9904 5342 65% /space
/dev/hda10 2065 1896 65 97% /export/mp3
tmpfs 256 1 255 1% /dev/shm
rollercoaster$ df -m -xnfs
Filesystem 1M-blocks Used Available Use% Mounted on
/dev/hda3 5768 5124 351 94% /
/dev/hda1 61 7 51 11% /boot
/dev/hda5 5768 1307 4168 24% /space
Keep it simple I always say. I'd be in trouble if I hadn't.
[colin@gateway] colin $ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda3 5.9G 5.3G 282M 96% /
/dev/hda1 28M 8.5M 18M 33% /boot
//ping/mp3 83G 9.0G 74G 11% /mnt/mp3
CategoryComputing