sábado, 4 de junio de 2011

Cambiar tamaño de disco en qemu kvm

Una posible forma es la siguiente, suponemos que el disco inicial es inicial.qcow2:

1.- crear disco de destino del tamaño deseado p.e. 60G
qemu-img create -f qcow2 destino.qcow2 60G

2.- arrancamos gparted con un sistema con los dos discos
qemu -hda inicial.qcow2 -hdb destino.qcow2 -cdrom=gparted.iso -boot d

3.- con el gparted hacemos copiar/pegar de un disco a otro con el nuevo tamaño deseado
(tarda bastante si los discos son grandes)

4.- comprobamos que boota y nuevo tamaño de disco
qemu -had destino.qcow2
hacemos df -h para comprobar nuevo tamaño

Si el nuevo dominio no arranca podemos usar la distribuición rescatux y regrabar el grub en la MBR (gràcies Victor ;-))

qemu -hda destino.qcow2 -cdron=rescatux.iso -boot d

Pasar de VirtualBox a KVM o Xen

Para pasar un disco de vdkm o vdi a qcow2 pasamos primero por raw. Es decir:

convertim vmdk de virtual box a raw:
VBoxManage internalcommands converttoraw aaa.vmdk file.raw

comprbar que boota
qemu -had file.raw

Convertimos raw a qcow2
qemu-img convert file.raw -O qcow2 imatge.qcow2

comprobar que boota
qemu -had imatge.qcow2

Cómo virtualizar con ubuntu kvm y no morir en el intento

Ni se os ocurra seguir la server guide porque no solo no funciona sino que confunde. El manual apropiado es el "community"

Community KVM installation

sábado, 21 de mayo de 2011

Python extraer año de datetime.date


datetime.date.today().isocalendar()[0]

Python, más aritmética con meses


def suma_mes(current_date, month_step):
""" suma month_setp mesos a current_date """
carry, new_month=divmod(current_date.month-1+month_step, 12)
new_month+=1
return current_date.replace(year=current_date.year+carry, month=new_month)


¿Cuántos días faltan para el mismo día de hoy del mes que viene?


>>> print (suma_mes(datetime.date.today(), 1)-datetime.date.today()).days

Sumar un mes con python


>>> from datetime import date
>>> current_date=date.today()
>>> carry, new_month=divmod(current_date.month-1+1, 12)
>>> new_month+=1
>>> current_date=current_date.replace(year=current_date.year+carry, month=new_month)
>>> print date.today()
2011-05-21
>>> print current_date
2011-06-21
>>>

lunes, 4 de abril de 2011

Ubuntu One trabaja con IIS!!!

Anda que... estaba yo sicronizando música con Ubuntu One, me da un error de red y me sale:

The page cannot be found

The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.

Please try the following:

  • Make sure that the Web site address displayed in the address bar of your browser is spelled and formatted correctly.
  • If you reached this page by clicking a link, contact the Web site administrator to alert them that the link is incorrectly formatted.
  • Click the Back button to try another link.

HTTP Error 404 - File or directory not found.
Internet Information Services (IIS)


Technical Information (for support personnel)

  • Go to Microsoft Product Support Services and perform a title search for the words HTTP and 404.
  • Open IIS Help, which is accessible in IIS Manager (inetmgr), and search for topics titled Web Site Setup, Common Administrative Tasks, andAbout Custom Error Messages.
UArrrrrrgggg!!