Template:Article summary start Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary end
Partitioning a hard drive allows one to logically divide the available space into sections that can be accessed independently of one another. Partition information is stored within a hard drive's Master Boot Record.
An entire hard drive may be allocated to a single partition, or one may divide the available storage space amongst multiple partitions. A number of scenarios require creation multiple partitions: dual- or multi-booting, for example, or maintaining a swap partition. In other cases, partitioning is used as a means of logically separating data, such as creating separate partitions for audio and video files. Common partitioning schemes are discussed in detail below.
Users may create up to four primary partitions per hard drive. If additional partitions are required, a single extended partition can be created instead (that is, up to three primary partitions and one extended partition). An extended partition can be further divided into an unlimited number of logical partitions.
From Wikipedia:File system:
- A file system (or filesystem) is a means to organize data expected to be retained after a program terminates by providing procedures to store, retrieve and update data, as well as manage the available space on the device(s) which contain it. A file system organizes data in an efficient manner and is tuned to the specific characteristics of the device.
Some common file systems are:
- ext2/ext3/ext4 - File system used for GNU/Unix partitions
- FAT32 - File system used to store files, used by most USB or removable Devices. Mountable with
mountor other utilities (e.g Thunar#Thunar Volume Manager)
- NTFS - File system used by windows. Mountable with many utilities (e.g. NTFS-3G)
See also File Systems.
Partitioning a hard disk drive defines specific memory storage areas. These are called partitions. Each partition behaves as a separate disk and is formatted with a specific filesystem type (see below).
There are 3 types of disk partitions:
Primary partitions can be bootable and are limited to four partitions per disk or RAID volume. If a partitioning scheme requires more than four partitions, an extended partition containing logical partitions is used. Extended partitions can be thought of as containers for logical partitions. A hard disk can contain no more than one extended partition. The extended partition is also counted as a primary partition so if the disk has an extended partition, only three additional primary partitions are possible (i.e. three primary partitions and one extended partition). The number of logical partitions residing in an extended partition is unlimited. A system that dual boots with Windows will require that Windows reside in a primary partition.
The customary numbering scheme is to create primary partitions
sda3 followed by an extended partition
sda4. The logical partitions on
sda4 are numbered
To control the actual partition scheme type:
# fdisk -l
- fdisk — Terminal partitioning tools included in Linux.
- cfdisk — A terminal partitioning tool written with ncurse libraries.
- GNU Parted — It allows to resize or to copy a partition (fdisk and cfdisk don't have this feature)
- Partitionmanager — Graphical tool written in QT.
- QtParted — Similar to Partitionmanager, available in AUR.
- GParted — Graphical tool written in GTK.
Partitions in a GNU/Unix system
The recommended partitions are / (root), /boot, /home and swap, but you can also add /usr and /var:
/ partition or root partition is necessary and it is the most important. The other partitions can be replaced by it, even though having different partitions is recommended.
/boot directory contains the kernel and ramdisk images as well as the bootloader configuration file and bootloader stages. It also stores data that is used before the kernel begins executing user-space programs.
/boot is not required for normal system operation, but only during boot and kernel upgrades (when regenerating the initial ramdisk).
If kept on a separate partition,
/boot does not require a journaled file system. A separate
/boot partition is needed if installing a software RAID0 (stripe) system.
/home directory stores personal files in different folders. Keeping it in a separate partition can be very useful for backup: it often requires the most disk space (for desktop users) and may need to be expanded at a later date.
/home partition can also be shared with other Linux systems installed in multi boot, although this is not recommended becuase of possible incompatibilities between user configuration files.
The swap partition provides memory that can be used as virtual RAM. It is recommended for PCs with 1GB or less of physical RAM.
Historically, the general rule for swap partition size was to allocate twice the amount of physical RAM. As computers have gained ever larger memory capacities, this rule has become deprecated. On machines with up to 512MB RAM, the 2x rule is usually adequate. If a sufficient amount of RAM (more than 1024MB) is available, it may be possible to have a smaller swap partition or even eliminate it. With more than 2 GB of physical RAM, one can generally expect good performance without a swap partition. There is always an option to create a swap file after the system is setup.
/usr directory stores file that are shared by all users. A
/usr partition can be useful because it can be shared with others Linux OS.
In order to have a separate /usr partition, a mkinitcpio hook is required, as /usr is expected to be available at boot: see Mkinitcpio#/usr as a separate partition.
/var directory stores cache and log files. It is used for example for caching and logging, and hence frequently read or written. Keeping it in a separate partition avoids running out of disk space due to flunky logs, etc.