Sign in with
Sign up | Sign in

Understanding Linux Partitions

Desktop Linux For The Windows Power User
By

As is the case when installing a new copy of Windows, partitioning is something that you will want to plan out before actually doing it. There are a few things that you must understand about Linux partitions before we proceed. A Linux installation will require a minimum of two partitions. One is for the operating system itself, which is represented as "/" and referred to as “root." The second is for virtual memory (or page files if you prefer) and is referred to as the “swap” area.

Which File System Do I Choose?

Like Windows, Linux has gone through several different file systems throughout the years. Ubuntu has read-and-write capabilities on Windows file systems but will not install onto them. FAT16, FAT32, and VFAT partitions can be read and written to right out of the box. NTFS file systems can only be read out of the box, but can easily be set to also write. Since Windows cannot read or write Linux file systems, you will need to transfer files to and from Windows within the Ubuntu operating system.

Other than the familiar Windows file systems, you will have the option of choosing several that you may not yet know. Among them is the ext3 file system. Ext3 is currently the most suited file system for a desktop and is the one with which we'll be concerned. The ext2 file system has, for the most part, been phased out. While ext4 is now available in Ubuntu 9.04, it is not yet stable enough to recommend. The ReiserFS, XFS, and JFS file systems have their specialized uses, but they are not relevant to a standard desktop setup. The swap area is for virtual memory use only, and unlike other file systems, it does not require a mount point.

What Are Mount Points?

Linux does not assign letters to each drive and partition like Windows and DOS do. Instead, you must specify a mount point for each drive and partition. Linux works on a hierarchical directory tree, where root ( / ) is the primary mount point, which by default contains all others. Think of / as the Linux equivalent of c:\, which is the default location for all Windows files and directories. Take /home/tomshardware, for example. You would get to the folder called “tomshardware” from the home directory ( /home ), which is located in the root ( / ) directory.

Mount points are sub-directories, kind of like how c:\Documents and Settings\tomshardware points to a folder named “tomshardware,” which is in My Documents on the C: Drive. Straightforward, right? Here is where Linux and Windows differ: because of its server roots, Linux does not care if one of the root's sub-directories is on a separate partition or drive. By specifying sub-directories as mount points for drives and partitions, Linux will detect that sub-directory and not duplicate it on your root drive or partition.

For example, /home is where all of your personal files reside. If you want those files on a separate partition or disk, you would install a second drive or create a separate partition and set the mount point to /home. This can be done for any other sub-directory. Ubuntu gives you the option to set the following mount points during installation: /boot (boot loader and kernel headers), /dev (devices and drivers), /home (user files), /opt (some additional software), /srv (system services) /tmp (temporary files), /usr (applications), /usr/local (data accessible to all users), and /var (server spools and logs).

For a typical desktop system, there is really no reason to give /dev, /opt, /srv, /tmp, /usr/local, and /var their own partitions. If you are planning on running more than two operating systems across multiple hard drives, it may be a good idea to make a partition for /boot. Creating a partition for /usr is worth doing, but should only be done if you already have a good idea of how much space applications will take up. Creating /home on a separate partition should be mandatory, while putting it on a separate hard drive is even better. You can choose to just create the minimum root and swap partitions, in which case /boot, /home,/usr, and all the rest will simply reside in root ( / ). By putting /home on a separate partition (or better yet, drive), you can essentially keep your documents, music, videos, pictures, saved games, etc. safe from catastrophe that may befall your system files on the root partition. Therefore, if you put all of the files you would typically backup into your home directory, you don't need to bother backing up for a re-installation, upgrade, or even a distribution switch.

Now that you understand Linux partitions and how the directory tree works, let's go ahead and partition the hard drive. For this desktop installation, we will use three partitions: root, home, and swap.

React To This Article