[FAQ] Partitions and Filesystems

Why do we have to have so many different partitions and filesystems on a Linux system?

A hard disk is divided into partitions – separate sections that each act as though they were a disk. Each partition then uses a filesystem to store data on that partition.

Why does Linux use more than one? Windows doesn’t!

Keeping different types of data separate can improve performance and security.
Keeping swap data on a dedicated filesystem is more efficient than keeping it inside a file inside a directory on the filesystem of your root partition. A rogue process can mess up swap, but it won’t touch anything else.

So swap and a root partition, like Ubuntu uses, is sufficient?

Sufficient, yes, but not optimal. At the very least, a desktop system (and that includes laptops) should use a separate partition for the home directory. That keeps your personal settings and data separate from the operating system files.

Why would I want to do that?

At some time, you will want to try a different distro, or install a later version of your existing distro. If everything is in the root partition, it will all be wiped by the installation and you would have to back up all your settings and files to an external drive before you could install. With a separate home partition, a well-behaved installer will leave your data intact. After the installation, you can boot the machine and start using it just as you did with the old setup.

Are there any other partitions I should have?

For a server, a separate filesystem for /var is definitely a good idea. It is also useful for desktops as a runway process filling up the system logfiles, kept in /var/log, won’t use up all the disk space used by the operating system files.

There are so many types of filesystem – why do we need ext2, ext3, reiserfs, XFS, jfs and the rest?

Each filesystem has its own strengths and weaknesses. Ext2 is the original Linux filesystem and is very fast but doesn’t handle sudden shutdowns very well.
Ext3 is a journaled filesystem, as are the others, which means that recovery in the event of a crash or power failure is faster and more reliable, at the expense of a small performance hit. Reiserfs is particularly good with small files, both in efficient use of space and speed. XFS is particularly fast with large files but it handles power failures poorly so is best on something with battery backup. Ext4 combines many of the advantages of other filesystems, and Btrfs is new hut promises much more.

Which is best?

That’s like asking whether Vi is better than Emacs or KDE better than Gnome, so I’ll pass on that one.

Source: LXF151

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.