guide to disks and disk partitions in linux

Upload: dbsmanian

Post on 14-Apr-2018

227 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/27/2019 Guide to Disks and Disk Partitions in Linux

    1/10

    Guide to disks and disk partitions in Linux

    Recommended Reading, Tutorials/Tips | September 18, 2011 12:22 am

    This article is an attempt to provide basic information about disk naming and partitionnumbering conventions, in non-technical terms, to those new to Linux. I believe a basic

    understanding of all the aspects concerning how a disk is referenced and partitioned will put you

    in a better position to troubleshoot installation and disk-related problems.

    Basic information about partition tables and the difference between primary and logical

    partitions will be covered.

    Hard Drive Naming Convention: The first thing you need to know is there is no C drive orE drive in Linux. There are equivalents, but when you come across a reference to a hard drive

    in a modern Linux system, you will typically see something like /dev/sda, /dev/sdb, /dev/sdc, etc. The dev is short for device, and in this case, a block storage device. The sd is short for

    SCSI mass-storage driver. (SCSI stands for Small Computer System Interface.) For the rest ofthis article, the /dev/ will be dropped, so all references to hard drives and partitions will start

    with the last part only.

    The first hard drive detected by a Linux system carries the sda label. In numerical terms, it is

    hard drive 0 (zero; counting begins from 0, not 1). The second hard drive is sdb, the third drive,

    sdc, and so on. In the screenshot below, there are two hard drives sda and sdb, detected by the

  • 7/27/2019 Guide to Disks and Disk Partitions in Linux

    2/10

    installer.

  • 7/27/2019 Guide to Disks and Disk Partitions in Linux

    3/10

    This screenshot comes from an i

    system.

    Partition Tables: A partition tdevice. And there are two standa

    Record) and GPT (GUID Partiti

    the first standard. GPT came muit comes with two major limitati

    1. It does not allow the concalled primary partitions.

    2. Disk partitions may not eThe first limitation will be discusecond in this article.

    Partitions and Partition Numb

    first be subdivided into distinct sMBR partitioning scheme, whic

    different types of partitions Pri

    will be discussed further down.

    stallation process where three hard drives were

    able describes the partitions of a hard drive or ards for the layout of the partition table MBR (

    n Table). MBR, also know as ms-dos, is what

    h later. While MBR is still the most widely usns which led to the development of GPT. They

    iguration of more than four main partitions. Th

    xceed 2TB

    sed in the next section. Nothing more will be w

    ering: To install an operating system on a har

    torage units. Those storage units are called partiis the default on virtually all Linux distributio

    mary, Extended, and Logical. Extended, and Lo

    attached to the

    ny storageMaster Boot

    ou might call

    d partition table,are:

    se partitions are

    ritten about the

    d drive, it must

    tions. Under thes, there are three

    gical partitions

  • 7/27/2019 Guide to Disks and Disk Partitions in Linux

    4/10

    With MBR, any partition that is

    primary partition. And, as statedscreenshot below was taken fro

    created. If you observe closely,

    sda4. Unlike hard drives, partiti

    the primary partitions, is shownAnd that is because as far as the

    So if you attempt to create anothtype of error message shown in t

    space, even when you know tha

    free space is. It will be unusable.

    ot explicitly created as an extended or logical

    earlier, there can be no more than four primaryan installation process where four primary par

    ou will see that the first primary partition is sd

    n numbers start from 1, not 0 (zero). Any space

    s Free. But while it may be free, it is, howevsystem is concerned, that free space does not ex

    er partition using the free space, the installer wihis image. The error message will always say,

    t there is space available. And it does not matte

    artition, is a

    partitions. Theitions were

    1 and the last

    not allocated to

    r, unusable.ist.

    ll throw up thenot enough free

    how much that

  • 7/27/2019 Guide to Disks and Disk Partitions in Linux

    5/10

    To get around the four primary p

    involved came up with the conceextended partition, it is then pos

    Those partitions are called logic

    logical partitions that you can cr

    single hard drive.

    What the concept of extended pa

    You can see that there are three

    is an extended partition, which

    sda6 and sda7). Under an extendusable. So you do not have to all

    extended partition.

    Being able to create logical parti

    operating systems like Windowsother operating systems has usedtaken while setting up a system t

    Fedora 15 and Windows 7), thre

    That meant there was just one prfree space as an extended partiti

    artitions limit of the MBR partition table, the s

    pt of an extended partition. By tagging a partitiible to create many more partitions under the e

    l partitions, and theoretically, there is no limit t

    ate. Note: Only one extended partition may be

    rtition brings to the table is illustrated in the scr

    rimary partitions (sda1, sda2 and sda3). And th

    akes it possible to create more partitions (in thi

    ed partition, you can have free space, and that focate all the available free space to the logical p

    ions comes in handy when you have to dual-bo

    , PC-BSD or even another Linux distribution, eup three primary partitions. In the image beloo dual-boot Windows 7 and Fedora 15 (see ho

    Windows 7 partitions already exist on the targ

    imary partition to play with. Only by setting upn, was it possible to install the system. What th

    art guys

    n as antended partition.

    o the number of

    onfigured on a

    enshot below.

    e fourth partition

    s example, sda5,

    ee space is stillartitions of an

    ot with other

    pecially if that, which wasto dual-boot

    t hard drive.

    the availableis also shows is

  • 7/27/2019 Guide to Disks and Disk Partitions in Linux

    6/10

    that Linux can boot from a logic

    In the last two screenshots, the e

    does not have to be. In this screepartition (sda2), and first logical

    partition is the last primary parti

    l partition.

    tended partitions were the last primary partitio

    nshot, for example, the extended partition is thepartition number is still 5 (sda5). So whether a

    ion or not, the logical partition number always

    s (sda4). But it

    second primaryextended

    tarts with the

  • 7/27/2019 Guide to Disks and Disk Partitions in Linux

    7/10

    number 5.

    Not all installation programs bro

    what to look for, you can tell if o

    partition numbers go from 1, the

    the most obvious tell-tale sign o

    adcast the presence of an extended partition. Bu

    ne exists. In the image below, for example, you

    n 5, 6 and 7. The presence of partition number

    an extended partition. This image, by the way,

    t if you know

    can see the

    and above, is

    was taken while

  • 7/27/2019 Guide to Disks and Disk Partitions in Linux

    8/10

    installing Ubuntu.

    GPT: As stated earlier, GPT,scheme maximum of four prim

    below, for example, you can see

    The most important point to note

    r GUID Partition Table, overcomes two limitatary partitions, and the 2TB limit to partition siz

    that there are eight partitions, with about 45GB

    here is that all eight partitions are primary part

    ons of the MBRes. In the image

    still available.

    tions, as the

  • 7/27/2019 Guide to Disks and Disk Partitions in Linux

    9/10

    concept of extended and logical

    With GPT, there can always be

    case with an MBR scheme that h

    create new or additional partitiohas been reached. In the image b

    artitions, is foreign to GPT.

    nallocated space at the end of existing partition

    as no extended partition, that unallocated spa

    s, unless the maximum number of partitions poelow, for example, there are six partitions and a

    s. And unlike the

    e can be used to

    ssible with GPTsmall

  • 7/27/2019 Guide to Disks and Disk Partitions in Linux

    10/10

    unallocated space remaining. Th

    Currently, Chakra is the only Limay read GPT disk partitioning

    slated for release in early Nove

    release show that GPT will be thwill be used if there is an existin

    disk. You may read feature previ

    alpha screenshots for a few scree

    installer.

    unallocated space may be used to create a ne

    ux distribution that is configured to use GPT buide for Chakra to see the steps involved. Fedo

    ber 2011, will support GPT. Test installations

    e default on standalone installations. In dual-booperating system installed on MBR partitions

    ew of Fedora 16 installer and Fedora 16 KDE a

    nshots of GPT partitions in Anaconda, the Fed

    partition.

    default. Youra 16, which is

    f the first beta

    t setups, MBRon the target

    nd GNOME

    ra system