Como instalar um HD no CentOS

Nosso cenário é um servidor rodando CentOS.

Após adicionar o disco físico ou virtual na máquina, é necessário efetuar algumas configurações para que o sistema operacional possa reconhecê-lo.

Primeiro passo é descobrir esse hd em seu servidor, para isso digite o comando:

fdisk –l

O resultado será mais ou menos assim;

  1. Disk /dev/sda: 1000.2 GB, 1000171331584 bytes

  2. 255 heads, 63 sectors/track, 121597 cylinders

  3. Units = cilindros of 16065 * 512 = 8225280 bytes

  4. Sector size (logical/physical): 512 bytes / 512 bytes

  5. I/O size (minimum/optimal): 512 bytes / 512 bytes

  6. Disk identifier: 0x000dceb6

  7. Dispositivo Boot Start End Blocks Id System

  8. /dev/sda1 * 1 32 256000 83 Linux

  9. Partition 1 does not end on cylinder boundary.

  10. /dev/sda2 32 121598 976472064 8e Linux LVM

  11. <span style=”color: #ff0000;”><em>Disk /dev/sdb</em>: 994.7 GB, 994721136640 bytes

  12. 255 heads, 63 sectors/track, 120934 cylinders

  13. Disk /dev/sdb doesn’t contain a valid partition table</span>

  14. Disk /dev/mapper/vg-swap: 4093 MB, 4093640704 bytes

  15. 255 heads, 63 sectors/track, 497 cylinders

  16. Units = cilindros of 16065 * 512 = 8225280 bytes

  17. Sector size (logical/physical): 512 bytes / 512 bytes

  18. I/O size (minimum/optimal): 512 bytes / 512 bytes

  19. Disk identifier: 0x00000000

  20. Disk /dev/mapper/vg-tmp: 1073 MB, 1073741824 bytes

  21. 255 heads, 63 sectors/track, 130 cylinders

  22. Units = cilindros of 16065 * 512 = 8225280 bytes

  23. Sector size (logical/physical): 512 bytes / 512 bytes

  24. I/O size (minimum/optimal): 512 bytes / 512 bytes

  25. Disk identifier: 0x00000000

Em nosso caso o HD novo está marcado com a linha em vermelho, e não foi particionado. Vamos prosseguir.

Execute o seguinte comando para iniciar o processo:

fdisk /dev/sdb

Digite a letra “n” para criar um novo particionamento.

  1. Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

  2. Building a new DOS disklabel. Changes will remain in memory only,

  3. until you decide to write them. After that, of course, the previous

  4. content won’t be recoverable.

  5. The number of cylinders for this disk is set to 16709.

  6. There is nothing wrong with that, but this is larger than 1024,

  7. and could in certain setups cause problems with:

  8. 1) software that runs at boot time (e.g., old versions of LILO)

  9. 2) booting and partitioning software from other OSs

  10. (e.g., DOS FDISK, OS/2 FDISK)

  11. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

  12. Command (m for help):<span style=”color: #ff0000;”> n</span>

Escolha o tipo, em nosso caso vamos criar a “Primary”

  1. Command action

  2. e extended

  3. p primary partition (1-4)

  4. <span style=”color: #ff0000;”>p</span>

Marque opção 1 e depois sempre “default”

  1. Partition number (1-4): 1

  2. First cylinder (1-16709, default 1): 1

  3. Last cylinder or +size or +sizeM or +sizeK (1-16709, default 16709): 16709

Para finalizar o processo e salvar as alterações, digite “w”

  1. Command (m for help): w

  2. The partition table has been altered!

  3. Calling ioctl() to re-read partition table.

  4. Syncing disks.

Para formatar a unidade digite o comando:

 

mkfs.ext3 /dev/sdb

Aguarde o sistema finalizar o processo:

 

  1. mke2fs 1.39 (29-May-2006)

  2. Filesystem label=

  3. OS type: Linux

  4. Block size=4096 (log=2)

  5. Fragment size=4096 (log=2)

  6. 16777216 inodes, 33553752 blocks

  7. 1677687 blocks (5.00%) reserved for the super user

  8. First data block=0

  9. Maximum filesystem blocks=4294967296

  10. 1024 block groups

  11. 32768 blocks per group, 32768 fragments per group

  12. 16384 inodes per group

  13. Superblock backups stored on blocks:

  14. 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,

  15. 4096000, 7962624, 11239424, 20480000, 23887872

  16. Writing inode tables: done

  17. Creating journal (32768 blocks): done

  18. Writing superblocks and filesystem accounting information: done

  19. This filesystem will be automatically checked every 25 mounts or

  20. 180 days, whichever comes first. Use tune2fs -c or -i to override.

Crie uma pasta no sistema para seu novo HD:

 

mkdir /hdnovo

Monte a pasta no HD novo:

 

mount -t ext3 /dev/sdb /hdnovo

Vamos configurar para montagem automática ao reiniciar:

 

nano /etc/fstab

Edite o arquivo na última linha:

 

/dev/sdb /hdnovo ext3 defaults 1 2

 

 

Pronto! Agora seu, clique em CTRL + X para salvar, e assim o seu hd já pode ser utilizado.