{"id":214,"date":"2008-11-11T19:16:00","date_gmt":"2008-11-11T19:16:00","guid":{"rendered":"http:\/\/blog.trungson.com\/?p=214"},"modified":"2008-11-11T19:16:00","modified_gmt":"2008-11-11T19:16:00","slug":"adding-a-second-hard-drive-under-linuxcentos","status":"publish","type":"post","link":"http:\/\/blog.trungson.com\/?p=214","title":{"rendered":"Adding a second hard drive under Linux\/CentOS"},"content":{"rendered":"<h4>Check out the new new drive<\/h4>\n<p>In this example, you will see I have 2x500GB drives, sda and sdb. sda already in used and sdb is new.<\/p>\n<pre>\n[root@s3 mathie]# fdisk -l\n\nDisk \/dev\/sda: 500.1 GB, 500107862016 bytes\n255 heads, 63 sectors\/track, 60801 cylinders\nUnits = cylinders of 16065 * 512 = 8225280 bytes\n\n   Device Boot      Start         End      Blocks   Id  System\n\/dev\/sda1   *           1          13      104391   83  Linux\n\/dev\/sda2              14       60801   488279610   8e  Linux LVM\n\nDisk \/dev\/sdb: 500.1 GB, 500107862016 bytes\n255 heads, 63 sectors\/track, 60801 cylinders\nUnits = cylinders of 16065 * 512 = 8225280 bytes\n\n   Device Boot      Start         End      Blocks   Id  System\n<\/pre>\n<h4>Partition the new drive<\/h4>\n<p>For my purpose, I want the whole sdb to be \/home, your partitioning scheme might be different, but fdisk should be very easy to use.<\/p>\n<pre>\n[root@s3 mathie]# fdisk \/dev\/sdb\n\nThe number of cylinders for this disk is set to 60801.\nThere is nothing wrong with that, but this is larger than 1024,\nand could in certain setups cause problems with:\n1) software that runs at boot time (e.g., old versions of LILO)\n2) booting and partitioning software from other OSs\n   (e.g., DOS FDISK, OS\/2 FDISK)\n\nCommand (m for help): m\nCommand action\n   a   toggle a bootable flag\n   b   edit bsd disklabel\n   c   toggle the dos compatibility flag\n   d   delete a partition\n   l   list known partition types\n   m   print this menu\n   n   add a new partition\n   o   create a new empty DOS partition table\n   p   print the partition table\n   q   quit without saving changes\n   s   create a new empty Sun disklabel\n   t   change a partition's system id\n   u   change display\/entry units\n   v   verify the partition table\n   w   write table to disk and exit\n   x   extra functionality (experts only)\n<\/pre>\n<h5>Create a new partition<\/h5>\n<pre>\nCommand (m for help): n\nCommand action\n   e   extended\n   p   primary partition (1-4)\np\nPartition number (1-4): 1\nFirst cylinder (1-60801, default 1):\nUsing default value 1\nLast cylinder or +size or +sizeM or +sizeK (1-60801, default 60801):\nUsing default value 60801\n<\/pre>\n<h5>Check the new drive<\/h5>\n<pre>\nCommand (m for help): p\n\nDisk \/dev\/sdb: 500.1 GB, 500107862016 bytes\n255 heads, 63 sectors\/track, 60801 cylinders\nUnits = cylinders of 16065 * 512 = 8225280 bytes\n\n   Device Boot      Start         End      Blocks   Id  System\n\/dev\/sdb1               1       60801   488384001   83  Linux\n<\/pre>\n<h5>Write and save<\/h5>\n<pre>\nCommand (m for help): w\nThe partition table has been altered!\n\nCalling ioctl() to re-read partition table.\nSyncing disks.\n<\/pre>\n<h4>Format the new partition(s)<\/h4>\n<pre>\n[root@s3 mathie]# \/sbin\/mkfs -t ext3 \/dev\/sdb1\nmke2fs 1.39 (29-May-2006)\nFilesystem label=\nOS type: Linux\nBlock size=4096 (log=2)\nFragment size=4096 (log=2)\n61063168 inodes, 122096000 blocks\n6104800 blocks (5.00%) reserved for the super user\nFirst data block=0\nMaximum filesystem blocks=4294967296\n3727 block groups\n32768 blocks per group, 32768 fragments per group\n16384 inodes per group\nSuperblock backups stored on blocks:\n        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,\n        4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,\n        102400000\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 26 mounts or\n180 days, whichever comes first.  Use tune2fs -c or -i to override.\n<\/pre>\n<h4>Mount the new drive<\/h4>\n<pre>\nmkdir \/home\nmount \/dev\/sdb1 \/home\n\n#add this into \/etc\/fstab for auto-mount on booting up\n\/dev\/sdb1               \/home                   ext3    defaults        0 0\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Check out the new new drive In this example, you will see I have 2x500GB drives, sda and sdb. sda already in used and sdb is new. [root@s3 mathie]# fdisk -l Disk \/dev\/sda: 500.1 GB, 500107862016 bytes 255 heads, 63 sectors\/track, 60801 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"_links":{"self":[{"href":"http:\/\/blog.trungson.com\/index.php?rest_route=\/wp\/v2\/posts\/214"}],"collection":[{"href":"http:\/\/blog.trungson.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.trungson.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=214"}],"version-history":[{"count":0,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=\/wp\/v2\/posts\/214\/revisions"}],"wp:attachment":[{"href":"http:\/\/blog.trungson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=214"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=214"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=214"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}