What is Partitioning

Analogy Time

Simply broken down, a new hard disk is similar to the foundations of a house - it needs some structure and walls before you can start putting things (like furniture) into it. The partition is the first level of foundation on the disk. Once the disk is logically carved up into partitions, it can be thought of as a house with rooms. Each partition (room) is of a specific size which could potentially be resized again after you move it, but would cause some disruption as objects get moved to make room. Once a partition (room) is created it can then be formatted using the filesystem of your choice. Once the filesystem has been laid down, it's possible to start populating the partition with data in the form of files and folders (furniture).

So, a partition is a logical chunk of space allocated out of the entire disk. Depending on how a system is configured at installation time, there maybe one or more partitions on a disk. In some instances, it is also possible to modify the layout, number and size of partitions, but this is often considered an expert's function.

Many Microsoft Windows users will have just one large partition - often known as "C: drive", however it is also common for Microsoft Windows users to have multiple partitions which are labelled with successive alphabetic characters (D:, E: and so on).

Similarly, with Ubuntu it's possible to install the system in exactly one partition on the disk, or spread data and applications over multiple partitions.

Two partitions

Disk

Figure 11.1: Partitioning

There are valid arguments for both scenarios. Having one single partition with all applications, libraries and data will result in a simple to manage system. It also provides flexibility as installing applications or adding data will use space from a common "pool".

If you accept all the defaults when installing Ubuntu, you will end up with a system comprising two logical partitions on the disk you install to. One contains all files, the other is known as swap which can simply be thought of as an extension to the memory in your computer.

Alternatively, it is possible to create multiple partitions of differing sizes into which different types of applications, libraries and data can be placed. This is often used in a multi-user or server environment where user data is kept separate from system programmes, log files and configuration files. A significant benefit to this can be seen when there is a problem on the system and log files start to grow. The log files (in one partition) will not consume all available disk space in this scenario because they will be confined to their own (small) partition of the physical disk.

Which ever partitioning scheme has been chosen, this is not set in stone. It is possible to use a partition editing utility to resize partitions (subject to sufficient spare space either inside or either side of partitions), however this is quite an advanced topic.

Whilst it is possible to change the disk partitioning layout after the system has been installed, it is important to make backups before making any changes to the partitions.

About filesystems

Partitioning a disk is only the beginning. Once the disk has been logically divided up, those partitions need to be formatted so that the operating system can place files on the disk in a structured manner. There are many different filesystem types, each with their own advantages. With Microsoft Windows the two main filesystems are FAT (File Allocation Table) and NTFS (New Technology File System). With Ubuntu there are many options including ext2, ext3, reiserfs, xfs and many others. The Ubuntu installer chooses ext3 by default, but of course it is possible to override this.

Nice to Know:

ext3 is a great general purpose journalling filesystem. It is well suited to most tasks, however some users have chosen xfs instead on their media-centre systems as xfs performs better than ext3 when handling very large files - such as music and video files.

Mount points

A mount point is a place in the directory hierarchy where a filesystem could be presented. There is no real Microsoft Windows equivalent to this. With Microsoft Windows the partitions C:, D: and so on, are seen as entirely separate entities so the operating system, applications and data is often referred to by a user as being "on the C: drive" or "in a folder on the D: drive".

Nice to Know:

"Mount" is the term used when referring to a filesystem being made available for access. CD and DVDs are usually automatically mounted when they are inserted. The same goes for USB connected devices such as memory sticks and hard disks

On Ubuntu, files and folders reside within a partition as they do with Microsoft Windows. However the partition is not normally referenced directly by the user. The user would normally say that files are "in my home directory" (when referring to /home/< username>), or "in the root directory" (when referring to / ) without specifying which partition on the disk those directories reside in.

Under most standard installations of Ubuntu there will be only one partition where all files and folders reside. However if a user plugs in an external USB-connected memory stick or USB hard disk, Ubuntu will mount the partition(s) on that device under mount point(s) within the directory tree. For example a USB attached memory stick or hard disk will usually appear under /media/disk (unless the device has partitions which are labelled, in which case they will appear under /media/<labelname> )

Further considerations

As previously mentioned, resizing partitions is not a trivial task. Under most circumstances it requires that all filesystems involved are unmounted, this means they must not be in use. Typically then to resize partitions the system should be booted to an unused filesystem - such as a bootable Live CD. Considerable thought should therefor be given before partitioning a disk with regards to the number and sizes of partitions to be created to prevent later unnecessary resizing.

Caution:

You may run out of hard drive space in your home partition due to the sub-division of the drive into fixed-size partitions. This may occur even if the other partitions have plenty of usable space. Good and logical partitioning requires you to predict how much space each partition needs.

For new users, home users and other single-user set-ups, a single root (/) partition with a swap partition would be the easiest and the most convenient to create and use. However, for multi-user systems or computers with lots of disk space, it is best to have the /home, /tmp, /usr and /var directories as individual partitions separate from the root (/) partition.

Before partitioning your hard drive, you should consider the following:

• root: Also called the slash directory, it is the highest directory of the directory tree. When creating the root partition, you need to ensure that the root should contain the /etc, /bin, /sbin, /lib and /dev directories; else, you will not be able to boot-up the system. You also need to ensure that the root partition is allocated at least 150-250 MB of disk space.

• /home: This directory contains all user-specific files and data. On a multi-user system, every user will store personal data in a subdirectory of this directory. The size of this directory would depend on the number of users using the system and the files they store in this directory. Ideally, you should plan the disk space for this partition based on your planned usage. In general, about 100-MB disk space can be allocated for each user. However, you may need to reserve a lot more space if you are planning to save a lot of multi-media files in your home directory.

Nice to Know:

It is good practice to have /home on a separate partition because it allows for a smoother transition from one distribution to another.

• /var: This directory contains variable data, such as news chapters, e-mails, Web sites, databases and the packaging system cache. The size of this directory also depends on system usage. Most probably, the size of this directory would be dictated by your usage of the Ubuntu package management utilities. If you plan to install all the packages that Ubuntu offers, you need to allocate 2 to 3 GB of space for the /var directory. However, if you want to save hard disk space and do not plan any major software updates, you can get by with as little as 30- or 40-MB disk space for the /var directory.

• /tmp: This directory contains temporary data created by programmes. Some applications, including archive manipulators, CD/DVD authoring tools and multi-media software also use this directory to temporarily store image files. You need to plan space allocation for this directory based on your usage of these applications. for this directory.

• /usr: This directory contains all user programmes (binaries), their documentation and supporting libraries. This directory tends to use the maximum space on the hard disk. Therefore, you should provide at least 500-MB disk space for this directory. But, you need to increase this space depending on the number and types of software packages you plan to install. Based on your planned usage and the available disk space, you may allocate 1.5 to 6 GB of disk space for this directory.

Nice to Know:

The /usr partition is sometimes referred to as User System Resources and not user as was originally intended.

Was this article helpful?

0 0

Post a comment