Caros amigos, boa noite,
Durante o decorrer do dia, realizei o procedimento para formatar
um novo disco, esta não é uma atividade de DBA, mas, uma vez o outra precisamos
realizar e achei interessante publicar, pode ser que seja útil para vocês
também.
Então, vamos começar.
partprobe
Para verificar discos, digite o comando abaixo:
fdisk -l
O resultado do mesmo, deve ser semelhante ao abaixo:
Disk /dev/sda: 181.8 GB,
181812592640 bytes
255 heads, 63 sectors/track,
22104 cylinders
Units = cylinders of 16065 * 512
= 8225280 bytes
Device Boot Start End Blocks
Id System
/dev/sda1 *
1 16 128488+
83 Linux
/dev/sda2 17 538
4192965 82 Linux swap
/dev/sda3 539 22104
173228895 83 Linux
Disk /dev/sdb: 299.9 GB,
299974524928 bytes
255 heads, 63 sectors/track,
36469 cylinders
Units = cylinders of 16065 * 512
= 8225280 bytes
Identificado qual o disco que foi adicionado, neste caso
(/dev/sdb), o próximo passo é criar uma partição, segue comando abaixo:
fdisk
/dev/sdb
[root@orateste]~>
fdisk /dev/sdb
Device contains neither a valid DOS
partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel.
Changes will remain in memory only,
until you decide to write them.
After that, of course, the previous
content won't be recoverable.
The number of cylinders for this
disk is set to 36469.
There is nothing wrong with
that, but this is larger than 1024,
and could in certain setups
cause problems with:
1) software that runs at boot
time (e.g., old versions of LILO)
2) booting and partitioning
software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of
partition table 4 will be corrected by w(rite)
Command (m for help): m ( comentário: quando solicitado, digitei a
letra “m” somente para exibir o menu )
Command action
a
toggle a bootable flag
b
edit bsd disklabel
c
toggle the dos compatibility flag
d
delete a partition
l
list known partition types
m
print this menu
n
add a new partition
o
create a new empty DOS partition table
p
print the partition table
q
quit without saving changes
s
create a new empty Sun disklabel
t
change a partition's system id
u
change display/entry units
v
verify the partition table
w
write table to disk and exit
x
extra functionality (experts only)
Command (m for help): n (comentário: neste ponto, digitei a letra “n”
para criar a nova partição )
Command action
e
extended
p
primary partition (1-4)
p
Partition number (1-4): 1 ( comentário: Neste ponto, você pode
escolher o número da partição, no meu caso foi o “1” )
First cylinder (1-36469, default 1):
Using default value 1
Last cylinder or +size or +sizeM
or +sizeK (1-36469, default 36469):
Using default value 36469
Command (m for help): w ( comentário: a letra “w” é para salvar as
configurações, por isso é muito importante entender o menu “m” )
The partition table has been
altered!
Calling ioctl() to re-read
partition table.
Syncing disks.
Muito bem, a sua partição foi criada com sucesso, vamos
verificar como ficou as configurações:
fdisk -l
Para formatar o novo disco, digite o comando abaixo.
mkfs -t ext3 /dev/sdb
mke2fs 1.35 (28-Feb-2004)
/dev/sdb is entire device, not
just one partition!
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
36618240 inodes, 73235968 blocks
3661798 blocks (5.00%) reserved
for the super user
First data block=0
Maximum filesystem
blocks=75497472
2235 block groups
32768 blocks per group, 32768
fragments per group
16384 inodes per group
Superblock backups stored on
blocks:
32768, 98304, 163840, 229376, 294912,
819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000,
23887872, 71663616
Writing inode tables: done
Creating journal (8192 blocks):
done
Writing superblocks and
filesystem accounting information: done
This filesystem will be
automatically checked every 22 mounts or
180 days, whichever comes
first. Use tune2fs -c or -i to override.
Após concluir a formatação, vamos montar o disco e definir o
ponto de montagem.
criei um pasta chamada “dados” no diretório “/” para montar o
disco novo, conforme mostra o comando abaixo.
[root@orateste]/>
mkdir dados
[root@orateste]/> mount /dev/sdb
/dados
Digite o comando “df -h” para verificar se o novo disco foi
adicionado e montado com sucesso.
[root@orateste]/> df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 163G 122G
33G 79% /
/dev/sda1 122M 12M
105M 10% /boot
none 1.5G 0 1.5G 0% /dev/shm
/dev/sdb 275G 97M
261G 1% /dados
Para configurar unidade para montar automaticamente após o reboot,
ajuste o arquivo “fstab”, veja exemplo abaixo:
[root@orateste]/>
vi /etc/fstab
/dev/sdb /dados ext3 defaults 1 1
ex:
<device> <destino> <FS> defaults 1
1
Praticamente concluído, apenas vamos testar o ponto de
montagem:
[root@orateste]/> df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 163G 122G
33G 79% /
/dev/sda1 122M 12M
105M 10% /boot
none 1.5G 0
1.5G 0% /dev/shm
/dev/sdb 275G 97M
261G 1% /dados
Nos testes abaixo, iremos montar e desmontar para validar,
caso o ambiente que você fizer, pode ser reinicializado, execute um reboot e
verifique se o novo ponto de montagem será montado com sucesso.
[root@orateste]/> umount /dados
[root@orateste]/>
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 163G 122G
33G 79% /
/dev/sda1 122M 12M
105M 10% /boot
none 1.5G 0
1.5G 0% /dev/shm
[root@orateste]/>
mount /dados
[root@orateste]/>
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 163G 122G
33G 79% /
/dev/sda1 122M 12M
105M 10% /boot
none 1.5G 0
1.5G 0% /dev/shm
/dev/sdb 275G 97M
261G 1% /dados
Qualquer dúvida, deixe seu comentário.
Abraços.
Abraços.
Nenhum comentário:
Postar um comentário