Partition (basics)

From eLinux.org
Jump to: navigation, search

Devices and Partitioning

When you buy a new computer, with the operating system already installed, you might not need to know about partitions. This explanation is given without considering any particular operating system. Some common elements are covered towards the end.

Storage devices come in a variety of types and sizes. When installed in a computer, the operating system must arrange those storage devices into a filesystem. A block of storage space, configured to hold data, is referred to as a partition. A partition cannot cross over more than one device, but a device can be split into more than one partition. A device would hold a partition table that would details of each partition on the device.

A simple library

This example uses a simple library; a building with rows of shelves containing paper books and magazines, and possibly music and video recordings. Inside the building is a single room and a short corridor. To get a book, you would enter the building into the corridor, go into the room, check the index on each row until you find your book, which you then borrow.

This would be the case with a single disc and a single partition. The operating system (you, in the library) would find the drive (building) and check the corridor (partition table) to find the partition (room). Each partition contains a directory / folder structure (the index) and locates the file (book).

Complications

Now imagine three extra things that make your library better.

  • Language - If you have books in more than one language (say English and German) you might want to keep those in two separate sections. Then if you want an English book, you don't have to look through all the German books as well. You may only be able to read one language.
  • Safety - If your books are valuable, you might worry that a fire might destroy all your books. Keeping them in smaller rooms would reduce the risk.
  • Expansion - If you can add any book you like, you might find that the library gets full of, say, fashion magazines. Then you wouldn't be able to add other books that you feel are more important without removing some of those magazines.

You would change your library by adding panels in the room to divide it up. New doors in the corridor now show which room is which. Language books are separated, you risk losing only one room in a small disaster, and when one room is full there is still space in the others.

This is like partitioning your drive. Although the panelled walls in the library can be moved, it is not easy. The extra rooms become extra partitions and equally, they can be resized, but not without some difficulty. You then have partitions with different file systems (languages), smaller partitions are easier to backup, and directories can only fill up the partition they are on.

A very large disc drive can be divided into several partitions, just as we divide the room above. We could also add another drive, which is like adding a new building. Depending on the layout of the buildings, you may not notice that you are in separate buildings, just like the operating system might "hide" the layout of the devices when you are looking for a file.

Filesystems

Each partition must be formatted with a filesystem to allow files to be saved on that partition. The filesystem used is usually dependent on the operating system of the computer on which the device is installed.

Windows filesystems

The Microsoft Windows operating system primarily uses proprietary Microsoft filesystems, FAT12, FAT16, FAT32, exFAT and NTFS. The partitions are labelled with a single capital letter. Older hardware used A: and B: (note the colon delimiter) for floppy disc drives, and C: for the main partition that holds the operating system. Drives D: onwards are used for other disc drives, CD/DVD drives and removable media. Reading other file systems will require third party utilities to provide that capability.

Apple Mac filesystems

Apple have used various filesystems for previous products; the OSX filesystem used on the Mac is based on the UNIX filesystem.

Linux filesystems

Linux filesystems are derived from UNIX, with ext4 being the one currently preferred. Many others can be used. Linux has a single directory structure, with "/" (called "root") being the highest level. Several directories at the next level have designated purposes, with more sub-levels of directory as required. The "/mnt" directory is where installed device partitions are mounted, and "/media" is where removable device partitions are mounted. With this structure, a system can have directories located on any suitable devices without the user needing to know how this has been set up.