{"id":353,"date":"2014-07-10T22:48:52","date_gmt":"2014-07-10T22:48:52","guid":{"rendered":"https:\/\/qbytes.cloud\/?p=353"},"modified":"2014-07-10T22:48:52","modified_gmt":"2014-07-10T22:48:52","slug":"add-a-new-drive-to-cpanel","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2014\/07\/10\/add-a-new-drive-to-cpanel\/","title":{"rendered":"Partitioning and Creating and Ext3 or Ext4 filesystem CentOS"},"content":{"rendered":"<p>We will install a new serial ATA hard drive into our system, and it\u2019s hooked to the second SATA port, thus making our drive \u201csdb.\u201d Enter the following as root:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># fdisk \/dev\/sdb\n\n<\/pre>\n<p>This brings up how many cylinders are on your hard disk, and of course opens up the fdisk program that will allow us to partition our new hard disk.<\/p>\n<p>The next step is to simply enter a \u201cp\u201d to show the partition table. This is useful to see what partitions are already setup on the disk.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">Command (m for help): p\n\nDisk \/dev\/sdb: 50.0 GB, 50019202560 bytes\n255 heads, 63 sectors\/track, 6081 cylinders\nUnits = cylinders of 16065 * 512 = 8225280 bytes\n\n   Device Boot    Start       End    Blocks   Id  System\n\nCommand (m for help):\n\n<\/pre>\n<p>There are no partitions on it. If any partitions are present we\u2019ll just go ahead and delete them by pressing \u201cd.\u201d<\/p>\n<p>Next we\u2019ll need to partition our drive. We\u2019ll keep it simple and mount this drive with a large, single primary partition, just like a backup drive. To do that enter \u201cn\u201d at the command line to create a new partition.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">Command (m for help): n\nCommand action\n   e   extended\n   p   primary partition (1-4)\np\nPartition number (1-4): 1\nFirst cylinder (1-6081, default 1): 1\nLast cylinder or +size or +sizeM or +sizeK (1-6081, default 6081): 6081\n\nCommand (m for help):\n\n<\/pre>\n<p>As you can see, I hit \u201cn\u201d and it asked if I\u2019d like to create a primary (P) or an extended partition (E) I hit P for a primary partition, entered \u201c1\u2033 for it being my first partition on the drive. Your first cylinder will be \u201c1\u2033 and the last one in our case will be \u201c6081.\u201d Most times you will be able to hit enter and use the default cylinder counts.<\/p>\n<p>Verify that we\u2019ve done everything correctly up until this point. At the command prompt enter \u201cp\u201d to check the partition table again:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">Command (m for help): p\n\nDisk \/dev\/sdb: 50.0 GB, 50019202560 bytes\n255 heads, 63 sectors\/track, 6081 cylinders\nUnits = cylinders of 16065 * 512 = 8225280 bytes\n\n   Device Boot    Start       End    Blocks   Id  System\n\/dev\/sdb1             1      6081  48845601   83  Linux\n\nCommand (m for help):\n\n<\/pre>\n<p>Now you can see that we\u2019ve added a partition to the drive, but we\u2019re not done yet. No changes have been written to the disk yet, everything is just in memory. If everything looks right, go ahead and enter the \u201cw\u201d command which will write the changes to the disk.<\/p>\n<p><strong>Creating an ext3 file system<\/strong><\/p>\n<p>Now that our disk is partitioned to sdb1 we\u2019ll need to format it. You can format your drive to any filesystem you want, but for our purposes here I\u2019m going to format it with ext3, the most common today. To format your drive:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">root@laxmi &#x5B;~]# mkfs -t ext3 \/dev\/sdb1\nmke2fs 1.41.12 (17-May-2010)\nDiscarding device blocks: done                            \nFilesystem label=\nOS type: Linux\nBlock size=4096 (log=2)\nFragment size=4096 (log=2)\nStride=0 blocks, Stripe width=0 blocks\n7331840 inodes, 29304560 blocks\n1465228 blocks (5.00%) reserved for the super user\nFirst data block=0\nMaximum filesystem blocks=4294967296\n895 block groups\n32768 blocks per group, 32768 fragments per group\n8192 inodes per group\nSuperblock backups stored on blocks: \n\t32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, \n\t4096000, 7962624, 11239424, 20480000, 23887872\n\nWriting inode tables: done                            \nCreating journal (32768 blocks): done\nWriting superblocks and filesystem accounting information: done\n\nThis filesystem will be automatically checked every 20 mounts or\n180 days, whichever comes first.  Use tune2fs -c or -i to override.\n\n\n<\/pre>\n<p>Using the mk2fs (make file system) command, we specified the type (using the -t) ext3 using the device and partition name (\/dev\/sdb1). You have successfully partitioned and formatted your new drive. We need to mount this partition to make it usable, and add an entry in the file \u201c\/etc\/fstab\u201d<\/p>\n<p>We\u2019re going to add this entry in the fstab file because on reboot, our drive that we just mounted will need to be remounted. By adding a simple entry in the fstab file our drive will be mounted every time on startup. To do this we\u2019re going to add the following code on the last line of the file \u201c\/etc\/fstab\u201d<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\/dev\/sdb1               \/backup                  ext3    defaults        1 2\n\n<\/pre>\n<p>Once you\u2019ve added that to the last line in the file, save it and issue this final command as root:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># mount \/dev\/sdb1\n\n<\/pre>\n<p>The mount command mounts the drive for immediate use, and the \/dev\/sdb1 is our drives partition name.<\/p>\n<p><strong>Creating an ext4 file system<\/strong><\/p>\n<p>The easiest way to create a file system on a partition is to use the mkfs.ext4 utility which takes as arguments the label and the partition device:<\/p>\n<p>YOU MAY GET THIS IS YOU DO NOT SPECIFY THE NUMBER&#8230;<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# mkfs.ext4 -L \/backup \/dev\/sdd\nmke2fs 1.41.12 (17-May-2010)\n\/dev\/sdd is entire device, not just one partition!\n\n<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># \/sbin\/mkfs.ext4 -L \/backup \/dev\/sdb1\nmke2fs 1.41.12 (17-May-2010)\nFilesystem label=\/backup\nOS type: Linux\nBlock size=4096 (log=2)\nFragment size=4096 (log=2)\nStride=0 blocks, Stripe width=0 blocks\n2097152 inodes, 8388352 blocks\n419417 blocks (5.00%) reserved for the super user\nFirst data block=0\nMaximum filesystem blocks=4294967296\n256 block groups\n32768 blocks per group, 32768 fragments per group\n8192 inodes per group\nSuperblock backups stored on blocks:\n        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,\n        4096000, 7962624\n\nWriting inode tables: done\nCreating journal (32768 blocks): done\nWriting superblocks and filesystem accounting information: done\n\nThis filesystem will be automatically checked every 36 mounts or\n180 days, whichever comes first.  Use tune2fs -c or -i to override.\n<\/pre>\n<p>Mounting a File System<\/p>\n<p>Now that we have created a new file system on the Linux partition of our new disk drive we need to mount it so that it is accessible. In order to do this we need to create a mount point. A mount point is simply a directory or folder into which the file system will be mounted. For the purposes of this example we will create a \/backup directory to match our file system label (although it is not necessary that these values match):<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># mkdir \/backup\n\n<\/pre>\n<p>The file system may then be manually mounted using the mount command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># mount \/dev\/sdb1 \/backup\n\n<\/pre>\n<p>Configuring CentOS 6 to Automatically Mount a Ext4 File System<\/p>\n<p>In order to set up the system so that the new file system is automatically mounted at boot time an entry needs to be added to the \/etc\/fstab file.<\/p>\n<p>For ext 4 find the UUIS:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# blkid \/dev\/sdd1\n\/dev\/sdb1: LABEL=&quot;\/backup&quot; UUID=&quot;6043e3e8-f0a3-405b-9905-9a6087fd02fe&quot; TYPE=&quot;ext4&quot;\n<\/pre>\n<p>Add to fstab<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nUUID=6043e3e8-f0a3-405b-9905-9a6087fd02fe \/backup     ext4    1       1\n<\/pre>\n<p>The following example shows an fstab file configured to automount our \/backup partition:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\/dev\/mapper\/vg_centos6-lv_root \/            ext4    defaults        1 1\nUUID=0d06ebad-ea73-48ad-a50a-1b3b8ef24491 \/boot  ext4    defaults        1 2\n\/dev\/mapper\/vg_centos6-lv_swap swap         swap    defaults        0 0\ntmpfs                   \/dev\/shm            tmpfs   defaults        0 0\ndevpts                  \/dev\/pts            devpts  gid=5,mode=620  0 0\nsysfs                   \/sys                sysfs   defaults        0 0\nproc                    \/proc               proc    defaults        0 0\nLABEL=\/backup \/backup      ext4    defaults        1 2\n\n<\/pre>\n<p>cPanel comes with a built in handy utility that will automatically detect, format, and partition your new drive with just a few clicks.<\/p>\n<p>To install your new hard drive through cPanel you\u2019ll need to login to WHM as root, and find the button on the left called \u201cFormat\/Mount a new hard drive\u201d under the drives tab about 3\/4 the way down. Click on that. The next page will show you the newly detected drives and have a button next to the drive to select it. Once you select your new drive follow the onscreen instructions, and hit enter.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We will install a new serial ATA hard drive into our system, and it\u2019s hooked to the second SATA port, thus making our drive \u201csdb.\u201d Enter the following as root: # fdisk \/dev\/sdb This brings up how many cylinders are on your hard disk, and of course opens up the fdisk program that will allow &#8230; <a title=\"Partitioning and Creating and Ext3 or Ext4 filesystem CentOS\" class=\"read-more\" href=\"https:\/\/www.qbytes.cloud\/index.php\/2014\/07\/10\/add-a-new-drive-to-cpanel\/\" aria-label=\"Read more about Partitioning and Creating and Ext3 or Ext4 filesystem CentOS\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"class_list":["post-353","post","type-post","status-publish","format-standard","hentry","category-cpanel"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/353","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=353"}],"version-history":[{"count":0,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/353\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=353"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=353"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=353"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}