JukyParaguay/trabajos2013/xoos/qemu tutorial: Difference between revisions

mNo edit summary
Line 34: Line 34:


==Redimensionar imagen==
==Redimensionar imagen==
{En construccion}
Al correr la vm nos damos cuenta que la imagen que descargamos solo tiene unos 600 MB libres aproximadamente, lo que para nuestro proposito no es suficiente.
Vemos las particiones con fdisk:
$ fdisk Fedora-17-armhfp-vexpress-mmcblk0.img
Welcome to fdisk (util-linux 2.21.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk Fedora-17-armhfp-vexpress-mmcblk0.img: 1888 MB, 1888485376 bytes
255 heads, 63 sectors/track, 229 cylinders, total 3688448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
                                Device Boot      Start        End      Blocks  Id  System
Fedora-17-armhfp-vexpress-mmcblk0.img1  *          63    1044224      522081    c  W95 FAT32 (LBA)
Fedora-17-armhfp-vexpress-mmcblk0.img2        1044225    3688447    1322111+  83  Linux
 
Para eso tenemos varias opciones. Para este tutorial vamos a redimencionar la particion principal<ref name="resize-fs">[http://askubuntu.com/questions/107228/how-to-resize-virtual-machine-disk] How to resize virtual machine disk.</ref>.
La imagen ''Fedora-17-armhfp-vexpress-mmcblk0.img'' descomprimida ocupa aproximadamente 1.8G
Para redimencionar la imagen podemos usar el comando '''qemu-img resize <filename> [+ | -]<size>'''. (La VM no debe estar activa!)
Pero primero crearemos un backup de esta imagen, un simple cp basta.
$ cp Fedora-17-armhfp-vexpress-mmcblk0.img backup.img
Luego redimencionamos la imagen, por ejemplo le agregamos 20G
$ qemu-img resize Fedora-17-armhfp-vexpress-mmcblk0.img +20G
  Image resized.
Ya tenemos mas espacio, y la vm puede verlo, pero todavia tenemos las viejas particiones.
Con '''fdisk''' vamos a hacer lo siguiente:
*Escribimos ''p'' para mostrar la tabla de particiones.
$ fdisk Fedora-17-armhfp-vexpress-mmcblk0.img 
  Welcome to fdisk (util-linux 2.21.2).
 
  Changes will remain in memory only, until you decide to write them.
  Be careful before using the write command.
 
  Command (m for help): p
 
 
  Disk Fedora-17-armhfp-vexpress-mmcblk0.img: 7257 MB, 7257194496 bytes
  255 heads, 63 sectors/track, 882 cylinders, total 14174208 sectors
  Units = sectors of 1 * 512 = 512 bytes
  Sector size (logical/physical): 512 bytes / 512 bytes
  I/O size (minimum/optimal): 512 bytes / 512 bytes
  Disk identifier: 0x00000000
 
                                  Device Boot      Start        End      Blocks  Id  System
  Fedora-17-armhfp-vexpress-mmcblk0.img1  *          63    1044224      522081    c  W95 FAT32 (LBA)
  Fedora-17-armhfp-vexpress-mmcblk0.img2        1044225    3688447    1322111+  83  Linux
Vemos como la segunda particion empieza en el sector 1044225. Lo que vamos a hacer es borrar esa particion de la tabla de particiones y creamos una nueva que empieza en el mismo sector pero termina en otro mucho despues. Luego la particion va contener un sistema de archivos valido.
*Escribimos ''d'' (delete) y elegimos la 2da particion
Command (m for help): d
Partition number (1-4): 2
Partition 2 is deleted
*Escribimos ''n'' (new) y elegimos particion primaria, la particion 2, el sector de inicio y fin. (en este caso podemos dejar los valores por defecto)
Command (m for help): n
Partition type:
    p  primary (1 primary, 0 extended, 3 free)
    e  extended
Select (default p): p
Partition number (1-4, default 2):
Using default value 2
First sector (1044225-14174207, default 1044225):
Using default value 1044225
Last sector, +sectors or +size{K,M,G} (1044225-14174207, default 14174207):
Using default value 14174207
Partition 2 of type Linux and of size 6.3 GiB is set
*Escribimos ''w'' para guardar los cambios al disco y salir de fdisk.
Command (m for help): w
The partition table has been altered!
Syncing disks.
Ahora debemos redimencionar el filesystem.
{En construccion}
 
==Configurar red y ssh==
==Configurar red y ssh==
{En construccion}
{En construccion}
==Referencias==
==Referencias==
<references />
<references />