Partitioning

From ArchWiki
Revision as of 04:56, 23 July 2012 by Arm-the-Homeless (Talk | contribs) (Swap)

Jump to: navigation, search
Summary help replacing me
An overview of disk partitioning tools, best practices, and additional considerations.
Related
fstab
LVM
Swap

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.

File system

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 mount or other utilities (e.g Thunar#Thunar Volume Manager)
  • NTFS - File system used by windows. Mountable with many utilities (e.g. NTFS-3G)

See also Beginners' Guide#Creating filesystems: General information.

Partitioning tools

To control the actual partition scheme type:

# fdisk -l
  • fdisk — Terminal partitioning tools included in Linux.
https://www.kernel.org/ || util-linux
  • cfdisk — A terminal partitioning tool written with ncurse libraries.
https://www.kernel.org/ || util-linux
  • GNU Parted — It allows to resize or to copy a partition (fdisk and cfdisk don't have this feature)
http://www.gnu.org/software/parted/parted.html || parted
  • Partitionmanager — Graphical tool written in QT.
http://sourceforge.net/projects/partitionman/ || partitionmanagerAUR
  • QtParted — Similar to Partitionmanager, available in AUR.
http://qtparted.sourceforge.net/ || qtpartedAUR
  • GParted — Graphical tool written in GTK.
http://gparted.sourceforge.net/ || gparted

Partitions in a GNU/Unix system

The recommended partitions are / (root), /boot, /home and swap, but you can also add /usr and /var:

/ (root)

The / partition or root partition is necessary and it is the most important. The other partitions can be replaced by it, even thought have different partitions is recommended.

/boot

The /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

The /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.

A /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.

Swap

The swap partition provides memory that can be used as virtual RAM. It is recommended for PCs with 1GB or less of physical RAM.

/usr

The /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

The /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.

See also