{"id":131,"date":"2004-08-14T14:21:00","date_gmt":"2004-08-14T21:21:00","guid":{"rendered":"https:\/\/kb.terabyteunlimited.com\/kb-articles\/overview-of-working-with-partitions-in-linux\/"},"modified":"2021-09-10T14:14:10","modified_gmt":"2021-09-10T21:14:10","slug":"overview-of-working-with-partitions-in-linux","status":"publish","type":"lsvr_kba","link":"https:\/\/www.terabyteunlimited.com\/kb\/kb-articles\/overview-of-working-with-partitions-in-linux\/","title":{"rendered":"Overview of working with partitions in Linux"},"content":{"rendered":"<font size=\"4\"><span style=\"COLOR: rgb(0,0,255)\">How drives and partitions are designated in Linux<\/span><\/font><br style=\"FONT-WEIGHT: bold\" \/><br \/><font size=\"1\"><font size=\"2\">* All ATA (IDE) type drive\/partition designations start with the letters 'hd'<br \/><br \/>* To that, add the letter representing the entire drive (a, b, c, d, ....)<br \/><\/font><\/font>\r\n  <div style=\"MARGIN-LEFT: 40px\"><font size=\"1\"><font size=\"2\">a = primary\/master drive<\/font><\/font><br \/><font size=\"1\"><font size=\"2\">b = primary\/slave drive<\/font><\/font><br \/><font size=\"1\"><font size=\"2\">c = secondary\/master drive<\/font><\/font><br \/><font size=\"1\"><font size=\"2\">d = secondary\/slave drive<br \/><br \/><\/font><\/font><\/div><font size=\"1\"><font size=\"2\">* To that, add the number representing the individual partition (1, 2, 3, 4, 5, ...)<br \/><\/font><\/font>\r\n  <div style=\"MARGIN-LEFT: 40px\"><font size=\"1\"><font size=\"2\">1 through 4 are for primary partitions, based on their partition table position<\/font><\/font><br \/><font size=\"1\"><font size=\"2\">5 and up are for volumes in the extended partition (always start at 5)<\/font><\/font><br \/><\/div><font size=\"1\"><font size=\"2\"><br \/>* Examples:<br \/><\/font><\/font>\r\n  <div style=\"MARGIN-LEFT: 40px\"><font size=\"1\"><font size=\"2\">The entire primary\/master drive is designated as simply hda<\/font><\/font><br \/><font size=\"1\"><font size=\"2\">The first primary partition on the primary\/master drive is hda1<\/font><\/font><br \/><font size=\"1\"><font size=\"2\">The first volume in the extended partition on the primary\/master drive is hda5<\/font><\/font><br \/><font size=\"1\"><font size=\"2\">The third volume in the extended partition on the secondary\/slave drive is hdd7<\/font><\/font><br \/><\/div><font size=\"1\"><font size=\"2\"><br \/>* Additional Notes:<br \/><\/font><\/font>\r\n  <div style=\"MARGIN-LEFT: 40px\"><font size=\"1\"><font size=\"2\">You will normally see all drive and partition designations prefixed with \/dev. So the entire<\/font><\/font><font size=\"1\"><font size=\"2\"> primary\/master drive will be \/dev\/hda, it's first partition will be \/dev\/hda1, and so on.<\/font><\/font><br \/><br \/><font size=\"1\"><font size=\"2\">Primary partition numbers are always based strictly on partition table position. If only<\/font><\/font><font size=\"1\"><font size=\"2\"> the first partition table position (or slot) is occupied, it will be numbered as 1 (as in hda1). But<\/font><\/font><font size=\"1\"><font size=\"2\"> if that partition is in the 2nd position with the first position empty, it will be numbered as 2 <\/font><\/font><font size=\"1\"><font size=\"2\">(as in hda2). There will be no hda1 in this case.<\/font><\/font><br \/><font size=\"1\"><font size=\"2\"><br \/>Volumes in the extended partition will always start at 5, regardless of how many primary<\/font><\/font><font size=\"1\"><font size=\"2\"> partitions exist on the drive.<\/font><\/font><br \/><br \/><font size=\"1\"><font size=\"2\">SCSI disks and partitions follow the same scheme, except that the drive designations<\/font><\/font><font size=\"1\"><font size=\"2\"> start with 'sd' instead of 'hd'. For example, \/dev\/sda1<\/font><\/font><br \/><\/div><font size=\"1\"><br \/><font style=\"COLOR: rgb(0,0,255)\" size=\"4\">How to see a list of your partitions<\/font><br \/><br \/>\r\n    <table style=\"WIDTH: 591px; HEIGHT: 124px\" border=\"1\">\r\n      <tbody>\r\n        <tr>\r\n          <td><font size=\"1\"><font size=\"2\"><span style=\"COLOR: rgb(255,0,0)\">fdisk -l<\/span><\/font><\/font><\/td>\r\n          <td style=\"TEXT-ALIGN: justify\"><font size=\"1\"><font size=\"2\">will list all partitions on all drives (l is lower case L)<\/font><\/font><\/td>\r\n        <\/tr>\r\n        <tr>\r\n          <td><font size=\"1\"><font size=\"2\"><span style=\"COLOR: rgb(255,0,0)\">fdisk -l &gt; filename<\/span><\/font><\/font><\/td>\r\n          <td style=\"TEXT-ALIGN: justify\"><font size=\"1\"><font size=\"2\">will save the output to a text file<\/font><\/font><\/td>\r\n        <\/tr>\r\n        <tr>\r\n          <td><font size=\"1\"><font size=\"2\"><span style=\"COLOR: rgb(255,0,0)\">fdisk -l | more <\/span><\/font><\/font><\/td>\r\n          <td style=\"TEXT-ALIGN: justify\"><font size=\"1\"><font size=\"2\">will make the output viewable one screen at a time <br \/><\/font><\/font><\/td>\r\n        <\/tr>\r\n        <tr>\r\n          <td><font size=\"1\"><font size=\"2\"><span style=\"COLOR: rgb(255,0,0)\">fdisk -l \/dev\/hda<\/span><\/font><\/font><\/td>\r\n          <td style=\"TEXT-ALIGN: justify\"><font size=\"1\"><font size=\"2\">will list all partitions on just \/dev\/hda (primary\/master)<\/font><\/font><\/td>\r\n        <\/tr>\r\n      <\/tbody>\r\n    <\/table><\/font><font size=\"1\"><br \/><font size=\"2\"><span style=\"COLOR: rgb(255,0,0)\">&nbsp;<\/span>Note: The fdisk command has to be run as root<\/font><br \/><br \/><font style=\"COLOR: rgb(0,0,255)\" size=\"4\">How to see which partitions are mounted (accessible)<\/font><br \/><br \/>\r\n    <table style=\"WIDTH: 593px; HEIGHT: 118px\" border=\"1\">\r\n      <tbody>\r\n        <tr>\r\n          <td><font size=\"1\"><font size=\"2\"><span style=\"COLOR: rgb(255,0,0)\">df <\/span><\/font><\/font><\/td>\r\n          <td><font size=\"1\"><font size=\"2\">is the basic command to list mounted partitions<\/font><\/font><\/td>\r\n        <\/tr>\r\n        <tr>\r\n          <td><font size=\"1\"><font size=\"2\"><span style=\"COLOR: rgb(255,0,0)\">df -Th<\/span><\/font><\/font><\/td>\r\n          <td><font size=\"1\"><font size=\"2\">will also display file system type, and the size in human readable format<\/font><\/font><\/td>\r\n        <\/tr>\r\n        <tr>\r\n          <td><font size=\"1\"><font size=\"2\"><span style=\"COLOR: rgb(255,0,0)\">mount<\/span><\/font><\/font><\/td>\r\n          <td><font size=\"1\"><font size=\"2\">will show similar information, but no sizes<\/font><\/font><\/td>\r\n        <\/tr>\r\n      <\/tbody>\r\n    <\/table><br \/><font size=\"2\"><span style=\"COLOR: rgb(255,0,0)\">&nbsp;<\/span><\/font><font style=\"COLOR: rgb(0,0,255)\" size=\"4\">How to determine what your root partition is<\/font><br \/><br \/><font size=\"2\">When observing the output of the <span style=\"COLOR: rgb(255,0,0)\">'df'<\/span> command shown above, the partition mounted on \/ is the root partition.<\/font><br \/><br \/><font style=\"COLOR: rgb(0,0,255)\" size=\"2\"><font size=\"4\">How to mount a partition<\/font><br \/><\/font><br \/><font size=\"2\"><span style=\"COLOR: rgb(255,0,0)\">mount \/dev\/hdxx \/mountpoint <\/span><br \/><br \/>Mountpoint above is the path to where you want to mount the partition. As an example, if you wanted to mount the partition \/dev\/hda4 in the directory \/home\/firstuser\/driveD, you would use this command:<br \/><br \/><span style=\"COLOR: rgb(255,0,0)\">mount \/dev\/hda4 \/home\/firstuser\/driveD<\/span><br \/><br \/>Sometimes, depending on kernel\/module configuration, the file system of the partition also has to be specified. For example, to mount a FAT32 partition at \/home\/firstuser\/driveD, you would use this command:<br \/><br \/><span style=\"COLOR: rgb(255,0,0)\">mount -t vfat \/dev\/hda4 \/home\/firstuser\/driveD<\/span><\/font><br \/><br \/><font style=\"COLOR: rgb(0,0,255)\" size=\"4\">How to have partitions mounted automatically when you boot<\/font><br \/><br \/><font size=\"2\">The file \/etc\/fstab contains a list of partitions to be mounted at boot. A line needs to be added for each additional partition that you want to mount automatically. As an example, the following shows a line that could be added to automatically mount a FAT32 partition located on \/dev\/hda4 in the directory \/home\/firstuser\/driveD:<br \/><br \/><\/font><\/font><font size=\"1\"><font size=\"2\">\r\n      <table style=\"WIDTH: 600px; HEIGHT: 72px\" border=\"1\">\r\n        <tbody>\r\n          <tr style=\"border: 1px solid black;\">\r\n            <td style=\"TEXT-ALIGN: center\">&lt;file system&gt;<\/td>\r\n            <td style=\"TEXT-ALIGN: center\">&lt;mount point&gt;<br \/><\/td>\r\n            <td style=\"TEXT-ALIGN: center\">&lt;type&gt;<br \/><\/td>\r\n            <td style=\"TEXT-ALIGN: center\">&lt;options&gt;<br \/><\/td>\r\n            <td style=\"TEXT-ALIGN: center\">&lt;dump&gt;<br \/><\/td>\r\n            <td style=\"TEXT-ALIGN: center\">&lt;pass&gt;<br \/><\/td>\r\n          <\/tr>\r\n          <tr>\r\n            <td style=\"TEXT-ALIGN: center\">\/dev\/hda4<br \/><\/td>\r\n            <td style=\"TEXT-ALIGN: center\">\/home\/firstuser\/driveD<br \/><\/td>\r\n            <td style=\"TEXT-ALIGN: center\">vfat<br \/><\/td>\r\n            <td style=\"TEXT-ALIGN: center\">defaults<br \/><\/td>\r\n            <td style=\"TEXT-ALIGN: center\">0<br \/><\/td>\r\n            <td style=\"TEXT-ALIGN: center\">0<br \/><\/td>\r\n          <\/tr>\r\n        <\/tbody>\r\n      <\/table><\/font><\/font><font size=\"1\"><font size=\"2\"><br \/><\/font><\/font><font size=\"1\"><font size=\"2\">Note that there are many options that can be specified under &lt;options&gt;, and these can also be used on the mount command line. Refer to the man pages for mount and fstab for more information. Also note that modern Linux desktop environments, such as Gnome and KDE, have made many administrative tasks such as these easier by providing GUI configuration programs for them.<br \/><\/font><\/font><br \/>","protected":false},"excerpt":{"rendered":"<p>How drives and partitions are designated in Linux* All ATA (IDE) type drive\/partition designations start with the letters &#8216;hd&#8217;* To that, add the letter representing the entire drive (a, b, c, d, &#8230;.) a = primary\/master driveb = primary\/slave drivec = secondary\/master drived = secondary\/slave drive* To that, add the number representing the individual partition [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"lsvr_kba_cat":[1783],"lsvr_kba_tag":[2128],"class_list":["post-131","lsvr_kba","type-lsvr_kba","status-publish","hentry","lsvr_kba_cat-linux","lsvr_kba_tag-linux"],"_links":{"self":[{"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/lsvr_kba\/131","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/lsvr_kba"}],"about":[{"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/types\/lsvr_kba"}],"author":[{"embeddable":true,"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/comments?post=131"}],"version-history":[{"count":2,"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/lsvr_kba\/131\/revisions"}],"predecessor-version":[{"id":6633,"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/lsvr_kba\/131\/revisions\/6633"}],"wp:attachment":[{"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/media?parent=131"}],"wp:term":[{"taxonomy":"lsvr_kba_cat","embeddable":true,"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/lsvr_kba_cat?post=131"},{"taxonomy":"lsvr_kba_tag","embeddable":true,"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/lsvr_kba_tag?post=131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}