The concept of disk partitioning is simple: the closer the blocks of data are to each other, the quicker they can be accessed. The potential distance apart is dependant on the number of blocks the disk can store, and thus its storage capacity. Given two hard disks with the same access time, the drive with the largest storage will give the slowest performance, on average. The principle is similar to that encountered when shopping in a small or large supermarket. It takes longer to walk around the larger shop than the smaller one to fetch the same goods.
Linux has the option of partitioning large hard disks so the system sees them as a set of smaller disks. This greatly reduces the amount of searching required and considerably improves overall access times. Each partition (or slice, as it sometimes called) is created by allocating a consecutive number of blocks to it. The partition is treated exactly as if it is a separate mass storage device and can be formatted, have a file system installed and mounted, if required. The partitions can be arranged so they either overlap or are totally separate. In both cases, an installed file system cannot exceed the partition size (i.e. the number of blocks allocated to it) and the lower boundaries of the file system and partition are the same. With non-overlapped partitions, the file system cannot be changed so it overlaps and destroys the data of an adjacent partition. With an overlapped arrangement, this is possible. Chang-ing partition dimensions requires, at best, the reinstallation of the operating system or other software and, at worst, may need them to be completely rebuilt. Fortunately, this only usually concerns the system administrator who looks after the system. Users do not need to worry about these potential problems.
The Motorola System V/68 implementation uses such tech-niques as shown. The standard hard disk has 77,519 physical 512 byte blocks, which are allocated to 8 overlapping partitions. The whole disk can be accessed using partition 7, the lower 192 blocks of which are reserved for the boot software, which starts UNIX when the system is powered on. Partition 0 has root, the main file system, installed in blocks 192 to 13,991. Blocks 13,992 to 18,791 are used as a swap area for the virtual memory implementation and do not have a file system as such. Partition 1 is used to implement a User file system as far as block 46,823. This could not have been implemented using partitions 2, 3 or 4 without creating a gap — and effectively losing storage space. A third file system, Source, is implemented in partition 5 to use the remaining blocks for data storage.
Partitioning provides several other advantages. It allows partitions to be used exclusively by Linux or another operating system, such as MS-DOS, and it reduces the amount of data backup needed to maintain a system’s integrity. Most Linux implementations running on an IBM PC allocate partitions to either MS-DOS or Linux and the sizes of these partitions are usually decided when the Linux software is first installed. Some implementations use the same idea, but create large MS-DOS files, which are used as UNIX partitions. In both cases, partitioning effectively divides the single physical hard disk into several smaller logical ones and allows the relatively easy transfer from Linux to MS-DOS, and vice versa. The same principles are also used if Linux is running on an Apple PowerMAC as well.
Most tape backup systems access hard disks directly and not through the file system, so whole disks can be quickly backed up onto tape. In practice, it is common for only parts of the file system to require backing up, such as user files and data, and this is more efficient if the backup process is restricted to these specific parts of the file system. This is easily done using partitions which are used by different parts of the file system. To back up specific parts, the special /dev file for that partition is used. With the file structure shown below, copying partition 2 to tape would back up all the files and subdirectories in the /root/bin directory. Copying partition 1 would copy everything excluding the /root/bin direc-tory.