Hola! Esta es mi receta para dar de alta discos sin gparted
Espero que os sea de utilidad!
1) Parar servidor y añadir un disco nuevo. Arrancar servidor de nuevo
2) formatearlo (fdisk), añadir partición nueva y darle el formato de "Linux LVM" (8e). Escribir los
cambios en la tabla (w) y salir
root@Server:~# fdisk /dev/sdb
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1): "enter"
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610): "enter"
Using default value 2610
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
root@Server:~#
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2610, default 1): "enter"
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-2610, default 2610): "enter"
Using default value 2610
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
root@Server:~#
3) Hacer del nuevo disco un volumen físico (VP)
root@Server:~# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created
Physical volume "/dev/sdb1" successfully created
4) 'Extender' el volume group (VG) que ya existe (en este caso se llama Mega) añadiéndole el
nuevo disco
root@Server:~# vgextend Mega /dev/sdb1
Volume group "Mega" successfully extended
Volume group "Mega" successfully extended
Para saber cómo se llama el volumen a extender, podéis ejecutar vgdisplay, que muestra todos
los volúmenes definidos
Con pvscan podréis comprobar que el nuevo disco forma parte del volumen al que lo habéis
añadido:
root@Server:~# pvscan
PV /dev/sda5 VG Mega lvm2 [19.76 GiB / 0 free]PV /dev/sdb1 VG Mega lvm2 [19.99 GiB / 19.99 GiB free]
Total: 2 [39.75 GiB] / in use: 2 [39.75 GiB] / in no VG: 0 [0 ]
5) Vamos ahora a ampliar el espacio del disco propiamente dicho; el disco en realidad es un LV
(volumen lógico)
root@Server:~# lvextend /dev/Mega/root /dev/sdb1
Extending logical volume root to 38.90 GiB
Logical volume root successfully resized
Extending logical volume root to 38.90 GiB
Logical volume root successfully resized
y por último, reformateamos el sistema de archivos para que se adapte al nuevo disco:
root@Server:~# resize2fs /dev/Mega/root
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/Mega/root is mounted on /; on-line resizing required
old desc_blocks = 2, new_desc_blocks = 3
Performing an on-line resize of /dev/Mega/root to 10196992 (4k) blocks.
The filesystem on /dev/Mega/root is now 10196992 blocks long.
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/Mega/root is mounted on /; on-line resizing required
old desc_blocks = 2, new_desc_blocks = 3
Performing an on-line resize of /dev/Mega/root to 10196992 (4k) blocks.
The filesystem on /dev/Mega/root is now 10196992 blocks long.