Vous êtes sur la page 1sur 14

26/04/2016

Abeginner'sguidetodisksanddiskpartitionsinLinux|LinuxBSDos.com
Find me on:

Home

Advertise Here

Sponsored Content

Contact

Subscribe

LinuxBSDos.com
Operating systems, software & hardware

DEBIAN

FEDORA

KALI LINUX

MINT

UBUNTU

REVIEWS

NEWS

TUTORIALS/TIPS

DOCKER
on AWSBREAKING
or Google
NEWS
Cloud with Kali Linux, Metasploitable and WebGoat

2 months ago How to build a Kali Rolling ISO of doom

3 months ago

TUTORIALS/TIPS

A beginners guide to disks and disk


partitions in Linux
on November 8, 2014

A beginners guide to disks and disk partitions in Linux is an updated version of Guide to disks and
disk partitions in Linux. It is intended to be an absolute beginners guide to understanding
how Linux handles disks and partitions.
If you are migrating from Windows to Linux and are attempting to install any Linux
distribution alongside Windows 7/8 on your computer, this article should come in handy.
Youll read about hard drive naming convention in Linux, how they are partitioned, partition
tables, le systems and mount points.
By the time you are through reading this, you should have a pretty good idea of what you are
doing when installing your next Linux distribution on your laptop or desktop computer. An
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. Most of the
highly technical terms associated with this subject have been omitted, so this should be an
easy read.
1. Hard Drive Naming Convention: The rst thing you need to know is this: Theres no C or D
drive in Linux. There are equivalents, but when you come across a reference to a hard drive in
Linux, youll 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 massstorage driver. (SCSI stands for Small Computer System Interface.) For the rest of this article,
the /dev/ part will be dropped, so all references to hard drives (and partitions) will start
with the last part only.
http://linuxbsdos.com/2014/11/08/abeginnersguidetodisksanddiskpartitionsinlinux/

1/14

26/04/2016

Abeginner'sguidetodisksanddiskpartitionsinLinux|LinuxBSDos.com

Lets begin by taking a look at how hard drives are represented in Windows. Figure 1 was
taken from a Windows 8 installation on a computer with two hard drives attached Disk 0
and Disk 1.

Figure 1: Disks and disks partitions as seen from the Windows 8 disk management
tool

Figure 2 shows how those hard drives would be represented in Linux. Where Windows sees
Disk 0 and Disk 1, Linux take a dierent approach. The rst 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, etc. In the screenshot below, there
are two hard drives detected by the installer sda and sdb.

Figure 2: Hard drive naming convention in Linux

Figure 3 comes from a Linux system with three hard drives attached. So thats how hard
drives are referenced in Linux sda, sdb, sdc, sdd, sde, , sdz

http://linuxbsdos.com/2014/11/08/abeginnersguidetodisksanddiskpartitionsinlinux/

2/14

26/04/2016

Abeginner'sguidetodisksanddiskpartitionsinLinux|LinuxBSDos.com

Figure 3: A Linux installer showing 3 detected hard drives

2. Partition Tables: In simple terms, a partition table describes the layout of partitions of a
hard drive. There are two partition table standards MBR (Master Boot Record) and GPT
(GUID Partition Table). MBR, also know as ms-dos, is what you might call the rst standard.
GPT came much later. If youre interested in the historical and technical details about both
standards, see these Wikipedia articles GUID Partition Table and Master Boot Record.
The MBR partitioning scheme is what youll nd on older computers. Newer computers
support both schemes, so its still possible to use an MBR partitioning scheme on those
computers. MBRs major limitations led to the development of GPT. Those limitations are:
1. It does not allow the conguration of more than four main partitions. Those partitions are
called primary partitions.
2. Disk partitions are limited to 2TB
Newer computers come with a replacement rmware for the old BIOS system called UEFI
(Unied Extensible Firmware interface), and GPT is a part of the UEFI standard. If you bought
a Windows 8 computer, its most certainly installed on a GPT partitioning scheme. If youre
already running a Linux distribution or attempting to install one on a recent Windows 7/8
computer, the easiest method of nding out what partitioning standard is used is to launch a
shell terminal and type sudofdiskl (leave out the sudo if the distribution does not use it).
Figure 4 shows the output of sudo fdisk -l from a Ubuntu Linux installation. The Disklabel
type: gpt line conrms that GPT is in use.

http://linuxbsdos.com/2014/11/08/abeginnersguidetodisksanddiskpartitionsinlinux/

3/14

26/04/2016

Abeginner'sguidetodisksanddiskpartitionsinLinux|LinuxBSDos.com

Figure 4: This output of fdisk -l shows GPT in use

Figure 5 was taken from a Fedora Linux installation. As in Figure 4, the Disklabel type: dos
line conrms what partitioning scheme is in use. In this case, it is MBR.

Figure 5: This output of fdisk -l shows MBR in use

You can also tell whether GPT or MBR is in use by accessing the UEFI setup utility. Under the
Boot menu, look for PCI ROM Priority. You should see two options EFI Compatible ROM and
Legacy ROM. The latter indicates MBR.
3. Partitions and Partition Numbering: To install an operating system on a hard drive, it must
rst be subdivided into distinct storage units. Those storage units are called partitions. Under
the MBR partitioning scheme, there are three dierent types of partitions Primary,
Extended, and Logical. Extended, and Logical partitions will be discussed further down.
With MBR, any partition that is not explicitly created as an extended or logical partition, is a
primary partition. And, as stated earlier, there can be no more than four primary partitions.
Figure 6 was taken from a Linux installation with four primary partitions. If you observe
closely, you will see that the rst primary partition is sda1 and the last sda4. Unlike hard
drives, partition numbers start from 1, not 0 (zero). Any disk space thats not allocated to the
primary partitions is listed as Free or free space. But while it may be free, it is, however,
unusable. And that is because as far as the system is concerned, that free space does not exist.

http://linuxbsdos.com/2014/11/08/abeginnersguidetodisksanddiskpartitionsinlinux/

4/14

26/04/2016

Abeginner'sguidetodisksanddiskpartitionsinLinux|LinuxBSDos.com

Figure 6: MBR partition numbering in Linux

So if you attempt to create another partition using the free space, the installer will throw up
the type of error message shown in Figure 7. The error message will always say, not enough
free space, even when you know that there is space available. And it does not matter whether
that free space is 1 MB or 1 GB. It will be unusable.

Figure 7: Not enough free space on disk error

To get around the four primary partition limitation of MBR, the smart guys involved came up
with the concept of an extended partition. By tagging a partition as an extended partition, it is
then possible to create many more partitions under it. Those partitions are called logical
partitions. Theoretically, there is no limit to the number of logical partitions that you can
create. Note: Only one extended partition may be congured on a single hard drive.
What the concept of extended partition brings to the table is illustrated in Figure 8. You can
see that there are three primary partitions sda1, sda2 and sda3. The fourth partition is an
extended partition, which makes it possible to create more (logical) partitions sda5, sda6
and sda7. Under an extended partition, you can have free space, and that free space will still
be usable. So you do not have to allocate all the available free space to the logical partitions of
an extended partition.

More in Tutorials/Tips:

http://linuxbsdos.com/2014/11/08/abeginnersguidetodisksanddiskpartitionsinlinux/

5/14

26/04/2016

Abeginner'sguidetodisksanddiskpartitionsinLinux|LinuxBSDos.com

The Benets of
Microcaching with
NGINX
December 28, 2015

Trying to prevent
browser ngerprinting?
The odds are against
you

Figure 8: Primary, Extended and Logical partitions in Linux

December 18, 2015

Share this with your friends:

Pages: 1 2
Is your browser safe
against tracking? Use
Panopticlick to nd out
December 17, 2015

We Recommend These Vendors and Free Oers


Launch an SSD VPS in Europe, USA, Asia & Australia on Vultr's KVM-based Cloud platform starting at
$5:00/month (15 GB SSD, 768 MB of RAM).
Deploy an SSD Cloud server in 55 seconds on DigitalOcean. Built for developers and starting at $5:00/month
(20 GB SSD, 512 MB of RAM).
Want to become an expert ethical hacker and penetration tester? Request your free video training course of
Online Penetration Testing and Ethical Hacking
Whether you're new to Linux or are a Linux guru, you can learn a lot more about the Linux kernel by
requesting your free ebook of Linux Kernel In A Nutshell.

http://linuxbsdos.com/2014/11/08/abeginnersguidetodisksanddiskpartitionsinlinux/

6/14

26/04/2016

Abeginner'sguidetodisksanddiskpartitionsinLinux|LinuxBSDos.com

4 Comments
Utsal
February 23, 2016 at 11:40 am Reply

I installed Kali Linux(dual with windows) on a 200GB extended partition and I am regretting it, since I cannot access that drive unless Im on
linux. Why can I not view the extended partition in windows? How to make it accessible? Any other suggestions for me?

connor
January 25, 2016 at 3:03 pm Reply

On my version of ubuntu fdiskl does not list the partition type. The man page species that it can not interpret gpt tables. GNU parted
can.
sudopartedl

shivkumar
August 22, 2015 at 3:48 am Reply

It is not clear that how can we create extended partition ?

nid
August 22, 2015 at 8:22 am Reply

An extended partition is created automatically in the background when you create a logical partition. And that is, if youre using the
installers of Ubuntu and its derivatives and any distribution using the new Calamares installer.
That, of course, only applies if youre creating the partitions under an MBR partitioning table.
See Guide to disks and disk partitions in Linux for more on this.

Leave a Comment
Your email address will not be published. Required elds are marked *
Message

http://linuxbsdos.com/2014/11/08/abeginnersguidetodisksanddiskpartitionsinlinux/

7/14

26/04/2016

Abeginner'sguidetodisksanddiskpartitionsinLinux|LinuxBSDos.com

Notify me of followup comments via e-mail


Name
*
Email Address
*
Website

Sign me up for the newsletter!

Post Comment

http://linuxbsdos.com/2014/11/08/abeginnersguidetodisksanddiskpartitionsinlinux/

8/14

26/04/2016

Abeginner'sguidetodisksanddiskpartitionsinLinux|LinuxBSDos.com

http://linuxbsdos.com/2014/11/08/abeginnersguidetodisksanddiskpartitionsinlinux/

9/14

26/04/2016

Abeginner'sguidetodisksanddiskpartitionsinLinux|LinuxBSDos.com

http://linuxbsdos.com/2014/11/08/abeginnersguidetodisksanddiskpartitionsinlinux/

10/14

26/04/2016

Abeginner'sguidetodisksanddiskpartitionsinLinux|LinuxBSDos.com

http://linuxbsdos.com/2014/11/08/abeginnersguidetodisksanddiskpartitionsinlinux/

11/14

26/04/2016

Abeginner'sguidetodisksanddiskpartitionsinLinux|LinuxBSDos.com

http://linuxbsdos.com/2014/11/08/abeginnersguidetodisksanddiskpartitionsinlinux/

12/14

26/04/2016

Abeginner'sguidetodisksanddiskpartitionsinLinux|LinuxBSDos.com

http://linuxbsdos.com/2014/11/08/abeginnersguidetodisksanddiskpartitionsinlinux/

13/14

26/04/2016

Search
Search...

Search

Abeginner'sguidetodisksanddiskpartitionsinLinux|LinuxBSDos.com

Recent Comments

Recent Posts

nid on How to dual-boot

How to build a containerized


app on Mirantis OpenStack with
native Docker tools

Friend me on Facebook

Antergos: The rst Linux


distribution with ZFS support
during installation

Subscribe via RSS

Kali Linux 1.0.9 and


Windows 7/8 on a PC with
UEFI rmware

Categories
Select Category

Archives
Select Month

Khakin on How to dual-boot


Kali Linux 1.0.9 and

Follow & Socialize

Follow Me

Follow on Google+

Windows 7/8 on a PC with


UEFI rmware
nid on Android on a Stick,
or how to install Android-

How to install WebGoat on


Ubuntu 14.04, 15.04 and 15.10
Set up, run a pentest lab on
AWS or Google Cloud with Kali
Linux, Metasploitable and
WebGoat

x86 on a USB stick


Lee Angel on Android on a
Stick, or how to install
Android-x86 on a USB stick
Steen on How to reduce
PHP-FPM (php5-fpm) RAM

Subscribe to RSS
Feed by Email
Enter your email
Subscribe

How to build a Kali Rolling ISO


of doom

usage by about 50%

LinuxBSDos.com
Home

About

Contact

Advertise Here

Sponsored Content

Copyright 2016 LinuxBSDos.com. High School Diploma Online. Designed by WPZOOM

http://linuxbsdos.com/2014/11/08/abeginnersguidetodisksanddiskpartitionsinlinux/

14/14