[CentOS-es] Redimencionar HDD Centos Virtual

Federico Don federico.don13 en gmail.com
Mar Ago 2 21:03:22 EDT 2011


Jajajaja es verdad, no aclare que fue realizado sobre una vm de prueba!!

Saludos y gracias a todos por su tiempo.


2011/8/2 Carlos Tirado Elgueta <carlos.tirado en gmail.com>

> Todo bien, salvo que el Reinicio NO era necesario :)
>
> Si hubiese sido maquina en produccion te castigaba :)
>
> Saludos!
>
> 2011/8/2 Federico Don <federico.don13 en gmail.com>
>
> > Solucionado, dejo tutorial, gracias a todos!
> >
> > Primero verificamos el estado del disco antes de hacer los cambios
> >
> > [root en localhost ~]# df -h
> > Filesystem            Size  Used Avail Use% Mounted on
> > /dev/mapper/VolGroup00-LogVol00
> >                       97G  3.0G   89G   4% /
> > /dev/sda1              99M   13M   82M  14% /boot
> > tmpfs                 187M     0  187M   0% /dev/shm
> >
> > [root en localhost ~]# fdisk -l
> >
> > Disk /dev/sda: 107.3 GB, 107374182400 bytes
> > 255 heads, 63 sectors/track, 13054 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       13054   104751832+  8e  Linux LVM
> >
> >
> >
> >
> > Ahora paramos la VM para hacer un grow del disco con:
> >
> > [root en localhost ~]# shutdown -h now
> >
> >
> >
> > Ampliamos el disco de 100GB a 200GB desde vCenter (recuerda de borrar los
> > snapshots para poder ampliar el disco) y levantamos la VM
> >
> > [root en localhost ~]# df -h
> > Filesystem            Size  Used Avail Use% Mounted on
> > /dev/mapper/VolGroup00-LogVol00
> >                       97G  3.0G   89G   4% /
> > /dev/sda1              99M   13M   82M  14% /boot
> > tmpfs                 187M     0  187M   0% /dev/shm
> >
> > [root en localhost ~]# fdisk -l
> >
> > Disk /dev/sda: 214.7 GB, 214748364800 bytes
> > 255 heads, 63 sectors/track, 26108 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       13054   104751832+  8e  Linux LVM
> >
> > Observa que el tamaño del disco /dev/sda ha cambiado a 214.7 GB
> >
> >
> >
> >
> > Ahora cramos una partición con el nuevo espacio:
> >
> > [root en localhost ~]# fdisk /dev/sda
> >
> > The number of cylinders for this disk is set to 26108.
> > 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): n <--- Nueva partición
> > Command action
> > e extended
> > p primary partition (1-4)
> > p
> > Partition number (1-4): 3 <--- crearemos /dev/sda3
> > First cylinder (13055-26108, default 13055):
> > Using default value 13055
> > Last cylinder or +size or +sizeM or +sizeK (13055-26108, default 26108):
> > 26108
> > Using default value 26108
> >
> > Command (m for help): t <--- Cambiamos el tipo de partición a 8e para
> Linux
> > Volume Manager
> > Partition number (1-4): 3
> > Hex code (type L to list codes): 8e
> > Changed system type of partition 3 to 8e (Linux LVM)
> >
> > Command (m for help): w <--- Grabamos los cambios realizados
> > The partition table has been altered!
> >
> > Calling ioctl() to re-read partition table.
> >
> > WARNING: Re-reading the partition table failed with error 16: Device or
> > resource busy.
> > The kernel still uses the old table.
> > The new table will be used at the next reboot.
> > Syncing disks.
> >
> > [root en localhost ~]# fdisk -l
> >
> > Disk /dev/sda: 214.7 GB, 214748364800 bytes
> > 255 heads, 63 sectors/track, 26108 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       13054   104751832+  8e  Linux LVM
> > /dev/sda3           13055       26108   104856255   8e  Linux LVM
> >
> >
> > Ahora reiniciamos:
> >
> > [root en localhost ~]# reboot
> >
> > Tras reiniciar, preparamos la nueva partición, para ampliar
> > /dev/VolGroup00/LogVol00 :
> > Primero creamos el Volumen Lógico
> >
> > [root en localhost ~]# pvcreate /dev/sda3
> >  Physical volume "/dev/sda3" successfully created
> >
> >
> > Ahora añadimos extendemos en Volume Group VolGroup00 (que vimos en el df
> > -h)
> > con el Volumen Físico creado
> >
> > [root en localhost ~]# vgextend VolGroup00 /dev/sda3
> >  /dev/hdc: open failed: No medium found
> >  Volume group "VolGroup00" successfully extended
> >
> >
> > Verificamos que tenemos espacio libre no asignado, y que coincide, como
> > esperabamos con el Volumen Físico añadido:
> >
> > [root en localhost ~]# vgdisplay
> >  /dev/hdc: open failed: No medium found
> >  --- Volume group ---
> >  VG Name               VolGroup00
> >  System ID
> >  Format                lvm2
> >  Metadata Areas        2
> >  Metadata Sequence No  4
> >  VG Access             read/write
> >  VG Status             resizable
> >  MAX LV                0
> >  Cur LV                2
> >  Open LV               2
> >  Max PV                0
> >  Cur PV                2
> >  Act PV                2
> >  VG Size               199.84 GB
> >  PE Size               32.00 MB
> >  Total PE              6395
> >  Alloc PE / Size       3196 / 99.88 GB
> >  Free  PE / Size       3199 / 99.97 GB
> >  VG UUID               sgvNZD-kr1q-CVV6-23Vf-xa83-1bh5-Xvg3e6
> >
> >
> > Ampliamos Volumen Lógico /dev/VolGroup00/LogVol00 con el espacio que nos
> > aporta /dev/sda3
> >
> > [root en localhost ~]# lvextend -L+99.00G /dev/VolGroup00/LogVol00
> >  /dev/hdc: open failed: No medium found
> >  Extending logical volume LogVol00 to 198.12 GB
> >  Logical volume LogVol00 successfully resized
> >
> >
> > [root en localhost ~]# resize2fs -p /dev/VolGroup00/LogVol00
> > resize2fs 1.39 (29-May-2006)
> > Filesystem at /dev/VolGroup00/LogVol00 is mounted on /; on-line resizing
> > required
> > Performing an on-line resize of /dev/VolGroup00/LogVol00 to 51937280 (4k)
> > blocks.
> > The filesystem on /dev/VolGroup00/LogVol00 is now 51937280 blocks long.
> >
> >
> >
> > Verificamos que hemos ampliado /dev/VolGroup00/LogVol00
> >
> > [root en localhost ~]# df -h
> > Filesystem            Size  Used Avail Use% Mounted on
> > /dev/mapper/VolGroup00-LogVol00
> >                      192G  3.0G  180G   2% /
> > /dev/sda1              99M   13M   82M  14% /boot
> > tmpfs                 187M     0  187M   0% /dev/shm
> >
> > [root en localhost ~]# fdisk -l
> >
> > Disk /dev/sda: 214.7 GB, 214748364800 bytes
> > 255 heads, 63 sectors/track, 26108 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       13054   104751832+  8e  Linux LVM
> > /dev/sda3           13055       26108   104856255   8e  Linux LVM
> >
> >
> >
> > Enjoy!
> >
> > El 2 de agosto de 2011 15:00, Ramón Macías Zamora <
> > ramon.macias en raykasolutions.com> escribió:
> >
> > > Cuando alguna vez tuve ese problema, lo que hice fue en mi máquina
> > virtual
> > > cargué un live-cd con Fedora donde tenía preinstalado gparted, con ese
> > > aplicativo dimensioné la partición y listo
> > >
> > > Saludos
> > > --
> > >
> > >
> > >
> > > Ramón Macías Zamora
> > > Tecnología, Investigación y Desarrollo
> > > Guayaquil - Ecuador
> > > msn:    ramon_macias en hotmail.com
> > > skype:  ramon_macias
> > > UserLinux# 180926 (http://counter.li.org)
> > > Cel:    593-8-0192238
> > > Tel:    593 4 6044566
> > >
> > > <http://www.raykasolutions.com/>
> > >
> > >
> > > WEB SITES, HOSTINGS, DOMINIOS, MANTENIMIENTO DE EQUIPOS, REDES,
> > SERVIDORES
> > > LINUX, SOPORTE.
> > >
> > >
> > >
> > > On Mon, Aug 1, 2011 at 2:52 PM, Federico Don <federico.don13 en gmail.com
> > > >wrote:
> > >
> > > > Buenas, es mi primer desafio y soy muy novato para esto, agradeceria
> > > ayuda,
> > > > tengo una virtual con centos, la cual necesito mas espacio en disco.
> > > > Agrande
> > > > el disco virtual de 100GB a 150GB.
> > > >
> > > > En el Centos=
> > > >
> > > > # fdisk -l
> > > >
> > > > *Disk /dev/sda: 161.0 GB, 161061273600 bytes*
> > > > 255 heads, 63 sectors/track, 19581 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       13054   104751832+  8e  Linux LVM*
> > > >
> > > >
> > > > # df -h
> > > > Filesystem            Size  Used Avail Use% Mounted on
> > > > /dev/mapper/VolGroup00-LogVol00
> > > >                       *97G  3.1G   89G   4% /*
> > > > /dev/sda1              99M   13M   82M  14% /boot
> > > > tmpfs                 187M     0  187M   0% /dev/shm
> > > >
> > > > Como puedo agregar el espacio en disco al Filesystem en el / ??
> > > >
> > > > Gracias a todos!
> > > > _______________________________________________
> > > > CentOS-es mailing list
> > > > CentOS-es en centos.org
> > > > http://lists.centos.org/mailman/listinfo/centos-es
> > > >
> > > _______________________________________________
> > > CentOS-es mailing list
> > > CentOS-es en centos.org
> > > http://lists.centos.org/mailman/listinfo/centos-es
> > >
> > _______________________________________________
> > CentOS-es mailing list
> > CentOS-es en centos.org
> > http://lists.centos.org/mailman/listinfo/centos-es
> >
>
>
>
> --
> Carlos Francisco Tirado Elgueta
> Google AdWords Professional (GAP)
> http://www.ChileMedios.com <http://www.chilemedios.com/> <
> http://www.chilemedios.com/>
> Red Hat Certified Engineer (RHCE) 805010694850055.
> http://www.LinuxSupport.cl <http://www.linuxsupport.cl/> <
> http://www.linuxsupport.cl/>
> _______________________________________________
> CentOS-es mailing list
> CentOS-es en centos.org
> http://lists.centos.org/mailman/listinfo/centos-es
>


Más información sobre la lista de distribución CentOS-es