martes, 10 de abril de 2012

lunes, 9 de abril de 2012

Renombrar CTID OpenVZ "on the fly"



Ojo al crear máquinas virtuales con OpenVZ y asignar un 'ctid' menor que 100, pues están reservados para el sistema.He creado dos máquinas en "enjuto" , el servidor que tengo "rulando" en casa con OpenVZ y al realizar un backup con vzdump de una de las máquinas devolvía en siguiente error:


root@enjuto:/backups# vzdump --suspend --dumpdir /backups --snapshot 2
ERROR: got reserved VM ID '2'


Supongo que en la actualidad OpenVZ tendrá un modo más rápido(en realidad lo es) que teclear 5 líneas para cambiar ctid's, pero lo que he leído en este foro ha funcionado al 100% .


enjuto# vzctl chkpnt 1 --dumpfile /tmp/Dump.1
enjuto# mv /etc/vz/conf/1.conf /etc/vz/conf/100.conf
enjuto# mv /vz/private/1 /vz/private/100
enjuto# mv /vz/root/1 /vz/root/100
enjuto# vzctl restore 100 --dumpfile /tmp/Dump.1


Ahora sí funciona el comando vzdump sin problemas:

root@enjuto:/backups# vzdump --dumpdir /backups --snapshot 100
unable to find command 'lvcreate'
root@enjuto:/backups# vzdump 100
INFO: starting new backup job: vzdump 100
INFO: Starting Backup of VM 100 (openvz)
INFO: CTID 100 exist mounted running
INFO: status = CTID 100 exist mounted running
INFO: mode failure - unable to detect lvm volume group
INFO: trying 'suspend' mode instead
INFO: backup mode: suspend
INFO: bandwidth limit: 10240 KB/s
INFO: starting first sync /var/lib/vz/private/100/ to /var/lib/vz/dump/vzdump-openvz-100-2012_04_09-11_38_50.tmp
INFO: Number of files: 24892
INFO: Number of files transferred: 19140
INFO: Total file size: 456167369 bytes
INFO: Total transferred file size: 455391436 bytes
INFO: Literal data: 455391436 bytes
INFO: Matched data: 0 bytes
INFO: File list size: 573708
INFO: File list generation time: 0.001 seconds
INFO: File list transfer time: 0.000 seconds
INFO: Total bytes sent: 456866413
INFO: Total bytes received: 398372
INFO: sent 456866413 bytes received 398372 bytes 4595625.98 bytes/sec
INFO: total size is 456167369 speedup is 1.00
INFO: first sync finished (99 seconds)
INFO: suspend vm
INFO: Setting up checkpoint...
INFO: suspend...
INFO: get context...
INFO: Checkpointing completed succesfully
INFO: starting final sync /var/lib/vz/private/100/ to /var/lib/vz/dump/vzdump-openvz-100-2012_04_09-11_38_50.tmp
INFO: Number of files: 24892
INFO: Number of files transferred: 0
INFO: Total file size: 456167369 bytes
INFO: Total transferred file size: 0 bytes
INFO: Literal data: 0 bytes
INFO: Matched data: 0 bytes
INFO: File list size: 573708
INFO: File list generation time: 0.001 seconds
INFO: File list transfer time: 0.000 seconds
INFO: Total bytes sent: 575625
INFO: Total bytes received: 1916
INFO: sent 575625 bytes received 1916 bytes 231016.40 bytes/sec
INFO: total size is 456167369 speedup is 789.84
INFO: final sync finished (2 seconds)
INFO: resume vm
INFO: Resuming...
INFO: vm is online again after 5 seconds
INFO: Total bytes written: 473118720 (452MiB, 9.3MiB/s)
INFO: tar: Exiting with failure status due to previous errors
INFO: archive file size: 451MB
INFO: Finished Backup of VM 100 (00:02:40)
INFO: Backup job finished successfuly

sábado, 7 de abril de 2012

How Linux is built

Como suele ser habitual, la gente de Linux Foundation se ha publicado un vídeo muy interesante sobre cómo y quién construye el kernel de Linux.

viernes, 6 de abril de 2012

debootstrap con Ubuntu UCK de una imagen ISO


Esta semana he dedicado tiempo a trastear con deboostrap tanto en Linux Mint, Debian GNU/Linux y Ubuntu.


Para los que no conozcan debootstrap comentar que es una herramienta que permite instalar Debian GNU/Linux o derivados en un subdirectorio. No requiere de un CD para la instalación, sólo el acceso a un repositorio Debian GNU/Linux(u otros). Si dispones de un buena conexión a Internet podrás descargar e instalar vía deboostrap (p.e) Ubuntu 11.10 en menos de 10 minutos(puede que en 5). No voy a escribir cómo hacerlo pues hay miles de sitios web donde indican cómo hacerlo.

El caso es que me preguntaba cómo instalar el SSOO vía imagen ISO y en el sitio web de Ubuntu Linux he encontrado un buen "how to" . Intentaré explicar cómo hacerlo tomando como referencia dicho sitio web. El sistema operativo anfitrión en mi caso es Linux Mint 12 Lisa con kernel 3.0.0-16-generic-x86_64

El primer paso es instalar el paquete uck. Más información en http://uck.sourceforge.net/

Nota: Este ejemplo lo que realizado como "root". Os recomiendo usar "sudo".

aptitude install uck

La variable BASEDIR debe tomar el valor del directorio dónde vamos a "enjaular" el ssoo, en mi caso:
export BASEDIR=/home/apermuy/debootstraps/oneiric_64/

Descomprimir la imagen ISO. Este proceso puede durar unos minutos.
uck-remaster-unpack-iso /home/apermuy/software/ubuntu-11.10-desktop-amd64.iso "$BASEDIR" && sudo uck-remaster-unpack-rootfs "$BASEDIR" && sudo uck-remaster-unpack-initrd "$BASEDIR"

Ahora sólo queda entrar en la "jaula":
uck-remaster-chroot-rootfs /home/apermuy/debootstraps/oneiric_64/


Mounting /proc
Mounting /sys
Mounting /dev/pts
Mounting /var/run
Mounting /tmp
Mounting /home/apermuy/debootstraps/oneiric_64//remaster-root-home
Mounting /home/apermuy/debootstraps/oneiric_64//remaster-apt-cache
Copying resolv.conf...
Copying fstab/mtab...
Creating DBUS uuid...
Deactivating initctl...
Deactivating update-grub...
Remembering kernel update state...


Comprobamos si realmente estamos "dentro" de Ubuntu 11.10:


root@mabu:/# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 11.10
Release: 11.10
Codename: oneiric




En otro post comentaré como crear subinterfaces, algo esencial,a mi entender después de instalar el sistema "enjaulado"