viernes, 26 de agosto de 2011

LINUX: agregar una unidad de disco duro.

Después de agregar físicamente un nuevo hdd al server, es necesario seguir los pasos a continuación para poder utilizar la nueva unidad de almacenamiento.

Se comprueba que el SO lea el Disco duro.
[root@localhost ~]# fdisk -l

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 2610 20860402+ 8e Linux LVM

Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table



Formatear el Disco Duro
[root@localhost ~]# 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 1305.
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)

En el siguiente menu se debe pinchar por las opciones que se presentan en el ejemplo a continuación:
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4):
Value out of range.
Partition number (1-4): 1
First cylinder (1-1305, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1305, default 1305):
Using default value 1305

Command (m for help): p

Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 1305 10482381 83 Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]#


Nuevamente Comprobar con el comando fdisk
[root@localhost ~]# fdisk -l

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 2610 20860402+ 8e Linux LVM

Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 1305 10482381 83 Linux
[root@localhost ~]#


Una vez que el nuevo hw es reconocido se procede a crear el volumen fisico o PV
[root@localhost ~]# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created
[root@localhost ~]#


Comprobar los volumenes fisicos y logicos
[root@localhost ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 VolGroup00 lvm2 a- 19.88G 11.50G
/dev/sdb1 lvm2 -- 10.00G 10.00G
[root@localhost ~]# vgs
VG #PV #LV #SN Attr VSize VFree
VolGroup00 1 3 0 wz--n- 19.88G 11.50G
[root@localhost ~]#


Añadir nuestro nuevo volumen fisico al actual volumen logico que ya tenemos.
[root@localhost ~]# vgextend VolGroup00 /dev/sdb1
Volume group "VolGroup00" successfully extended
[root@localhost ~]#


Comprobar mirando como quedan los volumenes fisicos y logicos
[root@localhost ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 VolGroup00 lvm2 a- 19.88G 11.50G
/dev/sdb1 VolGroup00 lvm2 a- 9.97G 9.97G
[root@localhost ~]# vgs
VG #PV #LV #SN Attr VSize VFree
VolGroup00 2 3 0 wz--n- 29.84G 21.47G
[root@localhost ~]#

No hay comentarios:

Publicar un comentario