jueves, 6 de septiembre de 2012

Extender tamaño de Disco Virtual de VM Linux en XenServer Citrix

Ingresamos al XenCenter, vamos a la Máquina Virtual que deseamos redimensionar, seleccionamos la solapa "Storage". Sobre el disco elegido clickeamos botón derecho y "Propiedades":



En el panel derecho seleccionamos "Size and Location":



Especificamos el tamaño final deseado, en este caso redimensionamos de 50 a 150 Gb:



Una vez finalizado nos logueamos a la VM y desmontamos el dispositivo que redimensionamos "/dev/xvde" donde está montada en data:


# umount /data
umount: data: device is busy
umount: data: device is busy

Como no me dejaba desmontarla, edité el /etc/fstab, comenté la línea y reinicié el server:

# vi /etc/fstab
        #/dev/xvde1     /data           ext4    defaults        0       0  (Comentamos la línea)
# reboot

Verificamos que el disco fue redimensionado:

# fdisk -l /dev/xvde
Disk /dev/xvde: 161.0 GB, 161061273600 bytes
255 heads, 63 sectors/track, 19581 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Pero la partición /dev/xvde1 sigue estando en 53 Gb:

# fdisk -l /dev/xvde1
Disk /dev/xvde1: 53.6 GB, 53686370304 bytes
255 heads, 63 sectors/track, 6526 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Borramos la partición y la recreamos con la opción "d":

# fdisk /dev/xvde
The number of cylinders for this disk is set to 19581.
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)
Command (m for help): d
Selected partition 1

Luego de borrarla volvemos a crearla con la "n", seleccionamos la "p" de partición primaria y en este caso seleccionamos la primer partición "1", volvemos a seleccionar "1" que es la opción por default y luego damos "ENTER". Finalmente guardamos con "w":

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-19581, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-19581, default 19581): ENTER
Using default value 19581
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.

Chequeamos el sistema de archivo que queremos redimensionar:

# e2fsck -f /dev/xvde1
e2fsck 1.41.3 (12-Oct-2008)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/xvde1: 81365/3276800 files (41.8% non-contiguous), 11429802/13107024 blocks

Redimensionamos la partición:

# resize2fs /dev/xvde1
Resizing the filesystem on /dev/xvde1 to 39321087 (4k) blocks.
The filesystem on /dev/xvde1 is now 39321087 blocks long.

Editamos nuevamente el /etc/fstab y descomentamos la línea que comentamos anteriormente:

# vim /etc/fstab
/dev/xvde1      /data           ext4    defaults        0       0

Finalmente volvemos a montar la partición y verificamos que realmente fué redimensionada la partición:

# mount /data/
# df -h |grep /data
/dev/xvde1            148G   43G   98G  31% /data






No hay comentarios: