Pages

Tuesday, April 12, 2011

Understanding partitions and mount points.

Partitions and mount points are fairly easy to understand under Linux once you know how it handles them.

Unlike Windows, which uses drive letters, Linux using a partition numbering scheme and mount points to represent the file system.

ATA IDE drives, whether hard drives or cd/dvd drives, are shown as hd*, where * is a letter, starting at a. Thus, the primary IDE hard drive on a Linux machine would be labeled as hda. A second IDE device on that channel, such as a cd-rom or dvd drive would be hdb.

SCSI and SATA hard drives are labeled in a similar manner, but with an s rather than an h. Therefore, a primary SATA or SCSI drive would be sda, and similarly the first partition of that drive would be sda1 and so forth.

Primary and extended partitions are numbered 1-4, and numbers can be skipped, so it is possible to have hda1/sda1 and hda3/sda3 without having hda2/sda2. Logical partitions start at 5, and numbers are never skipped, so if hda7/sda7 exist hda5/sda5 and hda6/sda6 must exist as well.

Mount points are directories/directory structures which are mapped to the hard disk partitions Linux is installed on. For a simple install, generally the root file system, denoted by a simple forward slash (/), is the mount point under which all other directories in the file system are installed. On an install where only one partition is used for the whole system, that whole partition is used as the root filesystem, so that the partition used also becomes the primary mount point for the whole directory structure. This is generally what is done with many simple automatic installers, which will also create a partition for swap space(essentially virtual memory).

Some examples:

1. A computer already installed with Windows on a SATA drive has some unallocated space and the user decides to install Ubuntu Linux, while preserving Windows. The installer will see the Windows partition as sda1 and would leave it alone, instead creating sda3 for Ubuntu itself and sda4 or sda5 for a swap partition. The boot loader would install in such a way that one operating system or the other could be chosen at boot time, creating a dual boot system.

2. The user decides to add a second drive, just for Ubuntu Linux, but still keep Windows, as before. In this case, the installer can be told to use the second drive. Thus it will ignore the first drive, create sdb1 for Linux and likely sdb2 for swap, and then install the boot loader as above, creating a dual boot system with each OS on its own drive.

These examples do perhaps oversimplify things somewhat, since most Linux installers have multiple options and ways of doing things, but I hope it gives you an idea how Linux works in this area, and an understanding of the terminology behind it.

0 comments:

Post a Comment