guide to disks and disk partitions in linux _ linuxbsdos.com

Upload: fanakiri-asa

Post on 04-Jun-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/13/2019 Guide to Disks and Disk Partitions in Linux _ LinuxBSDos.com

    1/13

    LinuxBSDos.com

    * Home * About * Contact * Sitemap

    Subscribe

    Guide to disks and disk partitions in Linux

    in Recommended Reading,Tutorials/Tips / onSeptember 18, 2011 at 12:22 am /

    This article is an attempt to provide basic information about disknaming and partition numbering conventions, in non-technical terms, tothose new to Linux. So, it's a Linux disk partition guide. I believe abasic understanding of all the aspects concerning how a disk isreferenced and partitioned will put you in a better position to

    troubleshoot installation and disk-related problems.

    Basic information about partition tables and the difference betweenprimary and logical partitions will be covered.

    *Hard Drive Naming Convention:* The first thing you need to know isthere is no C drive or E drive in Linux. There are equivalents, butwhen you come across a reference to a hard drive in a modern Linuxsystem, you will typically see something like /dev/sda, /dev/sdb,/dev/sdc, etc. The dev is short for device, and in this case, ablock storage device. The sd is short for SCSI mass-storage driver.(SCSI stands for Small Computer System Interface.) For the rest of thisarticle, 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 beginsfrom 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 installer.Partitions in Linux guide

    This screenshot comes from an installation process where three harddrives were attached to the system.3 Partitions in Linux

    *Partition Tables:* A partition table describes the partitions of ahard drive or any storage device. And there are two standards for thelayout of the partition table MBR (Master Boot Record) and GPT (GUIDPartition Table). MBR, also know as ms-dos, is what you might call thefirst standard. GPT came much later. While MBR is still the most widelyused partition table, it comes with two major limitations which led tothe development of GPT. They are:

    1. It does not allow the configuration of more than four main partitions. Those partitions are called primary partitions.

  • 8/13/2019 Guide to Disks and Disk Partitions in Linux _ LinuxBSDos.com

    2/13

    2. Disk partitions may not exceed 2TB

    The first limitation will be discussed in the next section. Nothing morewill be written about the second in this article.

    *Partitions and Partition Numbering:* To install an operating systemon a hard drive, it must first be subdivided into distinct storageunits. Those storage units are called partitions. Under the MBRpartitioning scheme, which is the default on virtually all Linuxdistributions, there are three different types of partitions Primary,Extended, and Logical. Extended, and Logical partitions will bediscussed further down.

    With MBR, any partition that is not explicitly created as an extended orlogical partition, is a primary partition. And, as stated earlier, therecan be no more than four primary partitions. The screenshot below wastaken from an installation process where four primary partitions werecreated. If you observe closely, you will see that the first primarypartition is /sda/*1* and the last /sda/*4*. Unlike hard drives,partition numbers start from 1, not 0 (zero). Any space not allocated tothe primary partitions, is shown as Free. But while it may be free, itis, however, unusable. And that is because as far as the system isconcerned, that free space does not exist.Guide to Linux disk partitioning Debian

    So if you attempt to create another partition using the free space, theinstaller will throw up the type of error message shown in this image.The error message will always say, not enough free space, even whenyou know that there is space available. And it does not matter how muchthat free space is. It will be unusable.Linux Disk partition guide Error

    To get around the four primary partitions limit of the MBR partitiontable, the smart guys involved came up with the concept of an extendedpartition. By tagging a partition as an extended partition, it is thenpossible to create many more partitions under the extended partition.Those partitions are called logical partitions, and theoretically, there

    is no limit to the number of logical partitions that you can create.Note: Only one extended partition may be configured on a single hard drive.

    What the concept of extended partition brings to the table isillustrated in the screenshot below. You can see that there are threeprimary partitions (sda1, sda2 and sda3). And the fourth partition is anextended partition, which makes it possible to create more partitions(in this example, sda5, sda6 and sda7). Under an extended partition, youcan have free space, and that free space is still usable. So you do nothave to allocate all the available free space to the logical partitionsof an extended partition.Extended and Logical Partitions

    Being able to create logical partitions comes in handy when you have todual-boot with other operating systems like Windows, PC-BSD or evenanother Linux distribution, especially if that other operating systemshas used up three primary partitions. In the image below, which wastaken while setting up a system to dual-boot Windows 7 and Fedora 15(see how to dual-boot Fedora 15 and Windows 7),three Windows 7 partitions already exist on the target hard drive. That

  • 8/13/2019 Guide to Disks and Disk Partitions in Linux _ LinuxBSDos.com

    3/13

    meant there was just one primary partition to play with. Only by settingup the available free space as an extended partition, was it possible toinstall the system. What this also shows is that Linux can boot from alogical partition.Primary, logical partitions

    In the last two screenshots, the extended partitions were the lastprimary partitions (*/sda4/*). But it does not have to be. In thisscreenshot, for example, the extended partition is the second primarypartition (*/sda2/*), and first logical partition number is still 5(*/sda5/*). So whether an extended partition is the last primarypartition or not, the logical partition number always starts with thenumber *5*.Linux disk partitioning guide

    Not all installation programs broadcast the presence of an extendedpartition. But if you know what to look for, you can tell if one exists.In the image below, for example, you can see the partition numbers gofrom 1, then 5, 6 and 7. The presence of partition number 5 and above,is the most obvious tell-tale sign of an extended partition. This image,by the way, was taken while installing Ubuntu.Linux disk partition guide Fedora

    *GPT:* As stated earlier, GPT, or GUID Partition Table, overcomes twolimitations of the MBR scheme maximum of four primary partitions, andthe 2TB limit to partition sizes. In the image below, for example, youcan see that there are eight partitions, with about 45GB stillavailable. The most important point to note here is that all eightpartitions are primary partitions, as the concept of extended andlogical partitions, is foreign to GPT.Linux disk partition guide Ubuntu

    With GPT, there can always be unallocated space at the end of existingpartitions. And unlike the case with an MBR scheme that has no extendedpartition, that unallocated space can be used to create new oradditional partitions, unless the maximum number of partitions possible

    with GPT has been reached. In the image below, for example, there aresix partitions and a small unallocated space remaining. The unallocatedspace may be used to create a new partition.Linux disk partition guide Mint

    Currently, Chakra is the only Linux distribution that is configured touse GPT by default. You may read GPT disk partitioning guide for Chakrato see the steps involved. Fedora 16, which is slated forrelease in early November 2011, will support GPT. Test installations ofthe first beta release show that GPT will be the default on standalone

    installations. In dual-boot setups, MBR will be used if there is anexisting operating system installed on MBR partitions on the targetdisk. You may read feature preview of Fedora 16 installerand Fedora 16 KDE and GNOME alpha screenshotsfor a few screenshots of GPT partitions in Anaconda, the Fedora systeminstaller.

  • 8/13/2019 Guide to Disks and Disk Partitions in Linux _ LinuxBSDos.com

    4/13

    17savesSave To have articles like this delivered automatically to your Feed Readeror Inbox, subscribe via *RSS * or*email*.Tags: disk partition ,gpt

    Related articles:

    * Installation and disk partitioning guide for Ubuntu 13.10 Installation and disk partitioning guide for Ubuntu 13.10 * Triple-boot Windows 7, Ubuntu 12.10 and Fedora 18 on one HDD Triple-boot Windows 7, Ubuntu 12.10 and Fedora 18 on one HDD * Windows 7 disk partitioning annoyance Windows 7 disk partitioning annoyance * Semi-manual LVM disk partitioning guide for Fedora 18 Semi-manual LVM disk partitioning guide for Fedora 18

    * No, availability is not security! No, availability is not security! * Usability, user-friendliness and the Linux desktop Usability, user-friendliness and the Linux desktop * How to dual-boot Fedora 18 and Windows 8 on 1 HDD, with GRUB in a PBR How to dual-boot Fedora 18 and Windows 8 on 1 HDD, with GRUB in a PBR * Multiboot Linux distributions from one USB key Multiboot Linux distributions from one USB key

  • 8/13/2019 Guide to Disks and Disk Partitions in Linux _ LinuxBSDos.com

    5/13

    Digital Ocean SSD VPS Cloud Server droplets

    Digital Ocean is a VPS/Cloud hosting provider. For just $5 per month,you can get yourself a Cloud server with 512 MB of RAM, 20 GB super-fastSSD, free snapshots, plus backups for a minimal fee. All via a simplegraphical interface.

    And by signing up with this referral link, you can helpsupport this website.

    If you are reading this, your ad could also be occupying this space.Contact us to make it happen.

    17 Comments

    1. Kalin Mandaliev says: September 18, 2013 at 1:40 pm

    Great Tutorial! Congrats :) Is's very very useful.

    Reply

    2. Abdulla says: May 17, 2013 at 10:45 am

    extremely well written and very very helpful post!!!! i had a serious confusion with the linux tree because i have been using windows all my life and couldn't convert my brain from C: to sda.__thanks a lot for this post..:D

    Reply

    3. shirisha says:

    November 22, 2012 at 9:44 pm

    Thank you for the excellent explanation of hard disk partitions.

    Reply

  • 8/13/2019 Guide to Disks and Disk Partitions in Linux _ LinuxBSDos.com

    6/13

    4. Donald says: October 18, 2012 at 3:22 pm

    You're simply the best. You should think of writing a book on Linux. What ever subject, no meter how complicated, it seems you have the ability to get the message to the others

    Reply

    5. JORGE says: August 17, 2012 at 8:32 pm

    Me gusto mucho el artculo sobre las particiones y su desarrollo, es algo ms que aprend. Gracias !

    Reply

    6. Mark says: August 13, 2012 at 3:11 pm

    Yup, this really is a fantastic article. It's so clear and concise. And the information covered is very useful. I wish there were more articles like this one. Thanks!

    Reply

    7. Bertrand says: September 30, 2011 at 9:54 am

    Perfect, exactly what I search Thanks!

    Reply

  • 8/13/2019 Guide to Disks and Disk Partitions in Linux _ LinuxBSDos.com

    7/13

    8. Paul says: September 19, 2011 at 3:45 pm

    Can you add information about UUID and disk labels please? Distributions are going the UUID route but you can get around ugly UUIDs by labeling your disks. Much appreciated. Thanks.

    Reply

    9. alex_from_somewhere says: September 18, 2011 at 10:16 am

    In the 5th picture (counting the error message picture), you point to the free space and say its Free (and usable) space. But that's

    only true IF you made the extended partition bigger? Isn't it? Cause it's outside the extended partition

    Reply

    * finid says: September 18, 2011 at 3:16 pm

    The free space in that image is under the extended partition. It might not be apparent, but it is.

    Reply

    o alex_from_somewhere says: September 19, 2011 at 4:16 am

    Hmm, ok, thanks!!

    I agree with Tom. Clear, short, easy tutorials like this are awesome!

    Reply

  • 8/13/2019 Guide to Disks and Disk Partitions in Linux _ LinuxBSDos.com

    8/13

    10. tom says: September 18, 2011 at 9:17 am

    This is the Best Article I have ever read on Partitions!! and I'm gonna spread it and use it to tech my friends!

    Thank You!!! This has helped me learn the key concepts in partitions, even though I have been using linux for past 4 years!

    Reply

    * Gavin says: August 14, 2012 at 5:37 am

    Yes, I agree totally, a brilliant explanation of partitioning drives, including starting out with the acronyms, and explanations of the words relating to those acronyms which are mostly omitted in other tutorials, and often leaves those new to a subject scratching their heads before they have completed the first paragraph.

    Reply

    Leave a Comment

    Click here to cancel reply.

    Name (required)

    Email (will not be published) (required)

    Website

    Notify me of followup comments via e-mail

    Ad

    Subscribe by Email

    Sign up to automatically receive the latest articles and tutorials inyour Inbox.

  • 8/13/2019 Guide to Disks and Disk Partitions in Linux _ LinuxBSDos.com

    9/13

  • 8/13/2019 Guide to Disks and Disk Partitions in Linux _ LinuxBSDos.com

    10/13

  • 8/13/2019 Guide to Disks and Disk Partitions in Linux _ LinuxBSDos.com

    11/13

    BSD Distros

    * DesktopBSD * FreeBSD * MirOS BSD * NetBSD * OpenBSD * PC-BSD * TrueBSD

    Firewall & Router

    * Astaro Security Gateway * BackTrack

    * ClearOS * Devil-Linux * Endian Firewall Community * EnGarde Secure Linux * Gibraltar * IPCop * IPFire * NuFW.Live

    * pfSense * SmoothWall Express

    * Untangle Network Gateway

    * Vyatta * XORP * Zentyal

    * Zeroshell

    Recent Posts

    * Ready for a digital world where the OS is the browser?

    * How is the NSA breaking SSL?

  • 8/13/2019 Guide to Disks and Disk Partitions in Linux _ LinuxBSDos.com

    12/13

    * Logging in by facial recognition on Linux Deepin 2013 Logging in by facial recognition on Linux Deepin 2013

    * Deepin Terminal features split screens, search and ssh connections Deepin Terminal features split screens, search and ssh connections

    * Amazon's Prime Air drone delivery sounds great, but it's DoA Amazon's Prime Air drone delivery sounds great, but it's DoA

    * Linux Deepin needs your help with the Deepin Localization Project Linux Deepin needs your help with the Deepin Localization Project

    * How to replace Ufw with FirewallD on Linux Deepin 2013 How to replace Ufw with FirewallD on Linux Deepin 2013

    * OpenMandriva Lx 2013.0 review

    OpenMandriva Lx 2013.0 review

    Popular Since Forever

    * How to dual-boot Ubuntu 12.04 and Windows 7 538 comments * How to dual-boot Linux Mint 13 Cinnamon/MATE and Windows 7

    315 comments * How to dual-boot Windows 7 and Ubuntu 11.04 136 comments * Dual-boot Windows 8 and Ubuntu 12.10 on UEFI hardware

  • 8/13/2019 Guide to Disks and Disk Partitions in Linux _ LinuxBSDos.com

    13/13

    134 comments * Dual-boot Ubuntu 12.04 and Windows 7 on a computer with 2 hard drives 126 comments * Should the root account be disabled in Fedora 18? 101 comments * PCLinuxOS 2010 review 84 comments * Install Ubuntu 11.04 on external hard disk 84 comments * Dual-boot Linux Mint 11 and Windows 7 82 comments

    Menu

    * Home * About * Contact * Sitemap

    Search

    Categories