Skip to main content
Engineering LibreTexts

04-A.6.1: Partitions and Labels continued

  • Page ID
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)


    Extended Partitions

    While in most circumstances four partitions are enough, there are circumstances in which you might need to create more than four partitions. This is the reason for an Extended partition.

    An Extended partition is a special type of partition that contains "Free Space" in which more than the four Primary partitions can be created. Partitions created within the Extended partition are called Logical partitions, and any number of Logical partitions can be created within an Extended partition. The following conventions apply to Extended partitions:

    1. When you create an Extended partition, it occupies one of the four Primary partition spots. When an Extended partition exists on a hard drive, only three Primary partitions may co-exist with it. If there are four Primary partitions already on a hard drive and you wish to create an Extended partition in which to create more, one of the Primary partitions must be deleted in order to create it.
    2. Only one extended partition may be created on a hard drive (though you can have one extended partition on each of the hard drives connected to your system). The partition editor will not allow it, and it would serve no purpose at any rate. If you need the extra Extended partition space, you only need expand the one you have.


    3. An Extended partition cannot be formatted with a filesystem, such as ext4, FAT, or NTFS, nor can it directly hold data. That is the function of the Logical Drives which are created within it.
    The partitioning editor show the various partitions on the drive being partitioned. The editor shows: what file system type each partition is; the mount point for each partition, the partition label,  how large each partition is, how much of the partition is currently in use, and how much unused space is on a partition.
    Figure \(\PageIndex{1}\): The partitioning editor, showing primary, extended and logical drives("Gparted_screen_showing_partition.png" by PbmacsodakWikimedia Commons is licensed under CC BY-SA 4.0)

    Logical Partitions

    A partition created within an Extended partition is called a Logical partition. Any number of Logical partitions may be created within an Extended partition, and they may be formatted with any filesystem.

    All Operating Systems that I am aware of are able to access any Logical partition that is formatted to a compatible filesystem. For instance, while Windows will not recognize a Linux ext2 partition without a third-party driver, it will be able to access any partition formatted with FAT or NTFS, depending on the version of Windows. Linux, of course, will access all of these.

    The image on the left shows the partitioning on my Linux system using the gparted editor. The / (root) and /usr partitions are the primary partitions. Then notice that /dev/sda3 is an extended partition. Within this extended partition then are the other three partitions on this system: /var, /home and the swap partition.

    File System Labels

    File system labels are assigned to file systems for easy identification. The labels may be up to 16 characters long and can be displayed or changed using the e2label command for ext3 or ext4 file systems. You MUST be logged in as root or use the sudo capability to execute the e2label command. You enter the /dev/designation for the partition and the name you want to use for that partition. For the above image, the command that was used to set the /dev/sda6 to be /home is:

    # e2label /dev/sda6 home

    Swap Space

    The primary function of swap space is to substitute disk space for RAM memory when real RAM fills up and more space is needed.

    For example, assume you have a computer system with 8GB of RAM. If you start up programs that don’t fill that RAM, everything is fine and no swapping is required. But suppose the spreadsheet you are working on grows when you add more rows, and that, plus everything else that's running, now fills all of RAM. Without swap space available, you would have to stop working on the spreadsheet until you could free up some of your limited RAM by shutting down some other programs.

    The kernel uses a memory management program that detects blocks (pages) of memory in which the contents have not been used recently. The memory management program swaps enough of these relatively infrequently used pages of memory out to a special partition on the hard drive specifically designated for “paging,” or swapping. This frees up RAM and makes room for more data to be entered into your spreadsheet. Those pages of memory swapped out to the hard drive are tracked by the kernel’s memory management code and can be paged back into RAM if they are needed.

    The total amount of memory in a Linux computer is the RAM plus swap space and is referred to as virtual memory. Usually, the swap space equals twice the RAM capacity.

    Adapted from:
    "How to Partition / Partitioning Basics" by Ben64, Community Help Wiki is licensed under CC BY-SA 4.0
    "An introduction to swap space on Linux systems" by David Both, is licensed under CC BY-SA 4.0

    04-A.6.1: Partitions and Labels continued is shared under a CC BY-SA 4.0 license and was authored, remixed, and/or curated by LibreTexts.

    • Was this article helpful?