Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Should I create a /boot partition every time I install a Linux distro?

Is a difference between having a /boot partition and making the / partition bootable?

share|improve this question
    
I think it's safer to keep /boot partition separate to avoid overwriting the bootloader by mistake. If I'm not mistaken the boot loader should be in the first cylinders of the disk to make sure the boot process will work properly as BIOS always load the first Bytes from the disk assuming there is a code that could handle further control and is able to load the operating system. –  mnmnc Dec 22 '12 at 12:18
1  
It certainly is not a necessity, but as said in the comment above it is a good practice. –  Hamed Momeni Dec 22 '12 at 12:42
add comment

3 Answers

up vote 9 down vote accepted

To answer the outright question: no, a separate partition for /boot is certainly not necessary in every case.

However, even if you do not split anything else, it is generally recommended to have separate partitions for /, /boot and swap. I would also strongly suggest putting /home on a separate partition as well, even if you do not split the file system hierarchy any further.

The reason for putting /boot on a partition separate from the regular root file system is that you can reduce on-disk file system complexity, which reduces the demands on the boot loader to bootstrap the kernel and initial RAM disk. This becomes particularly interesting if you are running a non-trivial setup - maybe you are running RAID, or an unusual file system such as ZFS on the root partition, or an encrypted root partition. The partition for /boot can then be formatted using e.g. plain ext2fs. Since the partition only needs to be small (a few hundred megabytes is plenty; /boot on my current system is 100 MB, and I do not feel any constraints from that), the downsides of a non-journaled file system such as ext2 need not be that great because checks are so fast anyway, and the relative simplicity of the file system as well as it being largely static might make undetected corruption less likely. That the boot loader doesn't need to natively understand an exotic file system or disk setup is another possible advantage.

The reason for putting /home on a separate partition is that, even if something goes rogue and starts filling it up (or if you do so yourself), you never risk it causing problems for non-user processes (which rarely run out of /home) or the boot process itself. Also, it becomes much easier to reinstall the OS, or switch distributions, if you can simply tell the installer to leave /home as it is and reformat / to fill it with its own files. As a last-ditch recovery effort if something truly goes wrong software-wise, this can make a major difference.

Running a swap file is not a recommended setup on Linux, and I'm not even sure most common distributions' stock kernels support (or allow) file-based swap. There are multiple reasons for this, one large reason being performance (largely due to the risk for fragmentation). Swap is already hideously slow compared to RAM (it's more of a stopgap measure than a fix), so there is little reason to make it even slower by risking fragmentation. And a swap partition can safely be shared between Linux distributions in a multi-boot environment; perhaps not a consideration in the general case, but certainly a consideration for some. A swap partition can also be placed on a separate physical disk with different characteristics; maybe a SSD these days, or a 10krpm drive running off a separate controller channel (that last is less a consideration nowadays when every SATA disk is on a separate channel, but could make a difference back in the PATA days).

Personally these days, I separate /, /boot, and swap, with / on my current system being 100 GB (I'm nowhere near using all of that; curent usage is 8.9 GB, and that gives me everything I need in terms of software and then some). The rest of the primary disk is made up of a single file system, which by personal convention I mount at /da (disk a). A second disk would be /db, then /dc and so on. (I doubt the FHS really approves of this scheme, but it works well for me in practice.) I then bind-mount /home into /da, meaning I can move the physical directory around without having to worry about updating every single path referencing it or repartitioning just because I realized that I am running a bit short of disk space for /home.

share|improve this answer
1  
In addition, separate /boot is only required if root partition is encrypted (and boot is obviously in clear) –  djechelon Dec 22 '12 at 20:36
    
@djechelon I think that falls under "a non-trivial setup", but I'll edit your particular example in. –  Michael Kjörling Dec 22 '12 at 22:31
add comment

The difference is filesystem optimization. Generally each partition have it's own tables for files, descriptors etc. You can install Linux on a single '/' partition without '/boot', '/swap', /usr' etc, but this single partition internal tables will soon grow huge and some operations will become a bit slow. So different partitions are used to provide separated, optimized containers for different kind of tasks.

share|improve this answer
    
The full set of inode tables is rarely used outside of file system checks. Most often, only the tables for a particular directory are referenced. Those are no (or little) different in size based on partition size. –  Michael Kjörling Dec 22 '12 at 22:37
    
Size is based on partition usage, not size. inode's is a list, so more inodes = slightly more time for file lookup, add etc. Where is not a huge differentce between empty partition and partition with million files, but for operations like boot or swap any difference matters. –  Eye of Hell Dec 23 '12 at 6:28
    
I don't see how your comment contradicts mine. And a swap partition has no concept of inodes, because it doesn't deal with files. There is a big difference between /swap and swap. –  Michael Kjörling Dec 23 '12 at 13:33
add comment

I don't think it is mandatory anymore. In the past, it was necessary because of some limitations with the BIOS. It was impossible to have a bootable partition after 8 or 64 Go (I don't remember exactly). Then, if you wanted to have a dual boot, you could put a first small partition (/boot), and the bootable windows partition, and after, the other Linux partitions. There is a long time, there was no /boot directory at all. Kernel was directly on /.

share|improve this answer
1  
The kernel sometimes was stored directly in the root (some distributions might still do this), but you could still need other things such as the initrd, System.map, bootloader configuration etc etc, which preferred a hierarchy of their own. –  Michael Kjörling Dec 22 '12 at 14:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.