{"id":844,"date":"2014-11-04T11:37:16","date_gmt":"2014-11-04T14:37:16","guid":{"rendered":"http:\/\/blog.abratel.com.br\/?p=844"},"modified":"2018-04-28T19:48:50","modified_gmt":"2018-04-28T22:48:50","slug":"instalando-novo-hd-sata-no-centos","status":"publish","type":"post","link":"https:\/\/blog.abratel.com.br\/?p=844","title":{"rendered":"Instalando novo HD SATA no CentOS Slave"},"content":{"rendered":"<p>Nesse artigo ser\u00e1 abordado como instalar um novo HD SATA no CentOS 5.6 e 6. O processo segue os seguintes passos: reconhecimento do HD, cria\u00e7\u00e3o e formata\u00e7\u00e3o da parti\u00e7\u00e3o, cria\u00e7\u00e3o do ponto de montagem, montagem da parti\u00e7\u00e3o e para finalizar montagem autom\u00e1tica da parti\u00e7\u00e3o.<\/p>\n<p>Antes de prosseguir, \u00e9 interessante ler o seguinte artigo: <\/p>\n<p>Nosso objetivo est\u00e1 contextualizado da seguinte forma:<\/p>\n<p>O primeiro passo \u00e9 verificar se o CentOS reconheceu os novos HDs.<\/p>\n<p>Utilize o fdisk para isso:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n[root@ ~]# fdisk -l\r\n \r\nDisk \/dev\/sda: 107.3 GB, 107374182400 bytes\r\n255 heads, 63 sectors\/track, 13054 cylinders\r\nUnits = cylinders of 16065 * 512 = 8225280 bytes\r\n \r\n   Device Boot      Start         End      Blocks   Id  System\r\n\/dev\/sda1   *           1          13      104391   83  Linux\r\n\/dev\/sda2              14       13054   104751832+  8e  Linux LVM\r\n \r\nDisk \/dev\/sdb: 137.4 GB, 137438953472 bytes\r\n255 heads, 63 sectors\/track, 16709 cylinders\r\nUnits = cylinders of 16065 * 512 = 8225280 bytes\r\n \r\nDisk \/dev\/sdb doesn't contain a valid partition table\r\n \r\nDisk \/dev\/sdc: 137.4 GB, 137438953472 bytes\r\n255 heads, 63 sectors\/track, 16709 cylinders\r\nUnits = cylinders of 16065 * 512 = 8225280 bytes\r\n \r\nDisk \/dev\/sdc doesn't contain a valid partition table\r\n<\/pre>\n<p>Analisando o resultado, podemos ver que os 2 HDs foram reconhecidos com sucesso. O hd1 foi reconhecido como \/dev\/sdb e o hd2 como \/dev\/sdc. Outra informa\u00e7\u00e3o que pode ser vista \u00e9 que ainda n\u00e3o foram particionados.<br \/>\nCriando a parti\u00e7\u00e3o<\/p>\n<p>A cria\u00e7\u00e3o da parti\u00e7\u00e3o tamb\u00e9m \u00e9 feita pelo fdisk, repare que o fdisk \u00e9 uma ferramenta interativa, dentro dele ser\u00e1 utilizado os comando n e w.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n[root@ ~]# fdisk \/dev\/sdb \r\nDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel\r\nBuilding a new DOS disklabel. Changes will remain in memory only,\r\nuntil you decide to write them. After that, of course, the previous\r\ncontent won't be recoverable.\r\n \r\nPara remover uma parti\u00e7\u00e3o use o comando d:\r\nCommand (m for help): d\r\n\r\nThe number of cylinders for this disk is set to 16709.\r\nThere is nothing wrong with that, but this is larger than 1024,\r\nand could in certain setups cause problems with:\r\n1) software that runs at boot time (e.g., old versions of LILO)\r\n2) booting and partitioning software from other OSs\r\n   (e.g., DOS FDISK, OS\/2 FDISK)\r\nWarning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)\r\n \r\nCommand (m for help): n\r\nCommand action\r\n   e   extended\r\n   p   primary partition (1-4)\r\n \r\np\r\n\r\nPartition number (1-4): 1\r\nFirst cylinder (1-16709, default 1): 1\r\nLast cylinder or +size or +sizeM or +sizeK (1-16709, default 16709): 16709\r\n \r\nCommand (m for help): w\r\nThe partition table has been altered!\r\n \r\nCalling ioctl() to re-read partition table.\r\nSyncing disks.\r\n<\/pre>\n<p>Para verificar se realmente a parti\u00e7\u00e3o foi criada: <\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n[root@ ~]# fdisk -l\r\n \r\nDisk \/dev\/sda: 107.3 GB, 107374182400 bytes\r\n255 heads, 63 sectors\/track, 13054 cylinders\r\nUnits = cylinders of 16065 * 512 = 8225280 bytes\r\n \r\n   Device Boot      Start         End      Blocks   Id  System\r\n\/dev\/sda1   *           1          13      104391   83  Linux\r\n\/dev\/sda2              14       13054   104751832+  8e  Linux LVM\r\n \r\nDisk \/dev\/sdb: 137.4 GB, 137438953472 bytes\r\n255 heads, 63 sectors\/track, 16709 cylinders\r\nUnits = cylinders of 16065 * 512 = 8225280 bytes\r\n \r\n   Device Boot      Start         End      Blocks   Id  System\r\n\/dev\/sdb1               1       16709   134215011   83  Linux\r\n \r\nDisk \/dev\/sdc: 137.4 GB, 137438953472 bytes\r\n255 heads, 63 sectors\/track, 16709 cylinders\r\nUnits = cylinders of 16065 * 512 = 8225280 bytes\r\n \r\nDisk \/dev\/sdc doesn't contain a valid partition table\r\n<\/pre>\n<p>Formatando a parti\u00e7\u00e3o em ext4<\/p>\n<p>Com a parti\u00e7\u00e3o criada, \u00e9 hora de formatar.<\/p>\n<p>Para formatar utilize o mkfs.ext4:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n\r\n[root@~]# mkfs.ext4 \/dev\/sdb1 \r\nmke2fs 1.39 (29-May-2006)\r\nFilesystem label=\r\nOS type: Linux\r\nBlock size=4096 (log=2)\r\nFragment size=4096 (log=2)\r\n16777216 inodes, 33553752 blocks\r\n1677687 blocks (5.00%) reserved for the super user\r\nFirst data block=0\r\nMaximum filesystem blocks=4294967296\r\n1024 block groups\r\n32768 blocks per group, 32768 fragments per group\r\n16384 inodes per group\r\nSuperblock backups stored on blocks: \r\n        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, \r\n        4096000, 7962624, 11239424, 20480000, 23887872\r\n \r\nWriting inode tables: done                            \r\nCreating journal (32768 blocks): done\r\nWriting superblocks and filesystem accounting information: done\r\n \r\nThis filesystem will be automatically checked every 25 mounts or\r\n180 days, whichever comes first.  Use tune2fs -c or -i to override.\r\n<\/pre>\n<p>Criando o ponto de montagem<\/p>\n<p>Para criar o ponto de montagem:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n[root@ ~]# mkdir \/hd-novo\r\n<\/pre>\n<p>Montando a parti\u00e7\u00e3o<\/p>\n<p>Para montar a parti\u00e7\u00e3o:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n[root@~]# mount -t ext4 \/dev\/sdb \/hd-novo\r\n\r\nSe nao der certo tente:\r\n\r\n[root@~]# mount  \/dev\/sdb1 \/hd-novo\r\n<\/pre>\n<p>Verificando se a parti\u00e7\u00e3o foi montada com sucesso:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n[root@ ~]# df -h\r\nFilesystem            Size  Used Avail Use% Mounted on\r\n\/dev\/mapper\/VolGroup00-LogVol00\r\n                       92G   14G   73G  17% \/\r\n\/dev\/sda1              99M   26M   68M  28% \/boot\r\ntmpfs                 2.0G  640M  1.4G  33% \/dev\/shm\r\nD_DRIVE               800G  618G  183G  78% \/media\/sf_D_DRIVE\r\n\/dev\/hdc               43M   43M     0 100% \/media\/VBOXADDITIONS_4.1.6_74713\r\n\/dev\/sdb1             126G  188M  120G   1% \/hd1\r\n<\/pre>\n<p>Veja nossa nova parti\u00e7\u00e3o \/dev\/sdb montada em \/hd-novo.<br \/>\nConfigurando a montagem autom\u00e1tica<\/p>\n<p>Agora vamos automatizar a montagem, n\u00e3o queremos montar essa parti\u00e7\u00e3o toda vez que iniciarmos o CentOS. Para isso temos que editar o \/etc\/fstab: <\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n[root@~]# vi \/etc\/fstab\r\n<\/pre>\n<p>Adicione a seguinte linha: <\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n\/dev\/sdb1    \/hd-hdnovo   ext4   defaults   0   0\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Nesse artigo ser\u00e1 abordado como instalar um novo HD SATA no CentOS 5.6 e 6. O processo segue os seguintes passos: reconhecimento do HD, cria\u00e7\u00e3o e formata\u00e7\u00e3o da parti\u00e7\u00e3o, cria\u00e7\u00e3o do ponto de montagem, montagem da parti\u00e7\u00e3o e para finalizar montagem autom\u00e1tica da parti\u00e7\u00e3o. Antes&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=\/wp\/v2\/posts\/844"}],"collection":[{"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=844"}],"version-history":[{"count":4,"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=\/wp\/v2\/posts\/844\/revisions"}],"predecessor-version":[{"id":1073,"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=\/wp\/v2\/posts\/844\/revisions\/1073"}],"wp:attachment":[{"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=844"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=844"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.abratel.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=844"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}