Una forma de reducir el tamaño de un qcow2 para respaldar

El sistema de virtualización por excelencia en Linux es KVM (libvirt). Las máquinas virtuales en KVM usualmente almacenan su disco en formato QCOW2.

QCOW2 utiliza, en principio, solamente el espacio que requiere, digamos que tenemos un disco QCOW2 de 50GB de tamaño, sin embargo esto no significa que el archivo .QCOW2 utilizará 50GB en disco desde un inicio. Sino que utilizará lo que se va realmente almacenando, digamos que estamos utilizando 8GB de este disco, entonces QCOW2 utilizará aproximadamente 8GB de los 50GB del disco.

A medida que pasa el tiempo, el sistema operativo irá realizando escrituras en diversas partes del disco, creando archivos, actualizándolos, y también eliminándolos. Esto irá provocando que el espacio realmente utilizado vaya difiriendo del espacio utilizado por el archivo de disco de QCOW2. Pasado un tiempo, digamos que nuestro sistema operativo está ocupando 12GB, sin embargo el tamaño del disco del QCOW2 puede ser de, por ejemplo, 29GB.

A veces nos topamos conque queremos dar de baja ya a una máquina virtual, no le usaremos más (o al menos durante mucho tiempo) . Y queremos guardar un respaldo de ella. Tomemos el ejemplo anterior: definitivamente sería mejor almacenar solamente el espacio utilizado (12GB) que no los 29GB que actualmente tiene el QCOW2. Nos ahorramos 17GB de espacio.

Aunque existen muchas técnicas para reducir el tamaño del QCOW2, hoy experimenté con una de ellas que consiste en utilizar el comando virt-sparsify.

virt-sparsify es un binario parte del paquete guestfs-tools, por lo que debemos verificar que este paquete esté instalado. Para CentOS podemos ejecutar:

sudo yum install guestfs-tools

virt-sparsify en principio fue concebido como un comando que llena de 0 los espacios declarados como vacíos en un disco. Al llenarse de 0, puede aprovecharse esos 0 para comprimir todo ese espacio conteniendo la misma información. De esta forma logramos librarnos de contenidos escritos en disco que ya no nos son de valor (porque ya fueron declarados como borrados).

Para ellos utilizamos:

[root@backups respaldos]# virt-sparsify mivm.qcow2 --compress mivm-new.qcow2

Lo que hará será leer los contenidos de la VM ‘mivm.qcow2’ y los escribirá hacia la salida ‘mivm-new.qcow2’, comprimiendo sus contenidos.

En mi caso fallaba al iniciar indicándome que no había espacio en TMPDIR, pues TMPDIR por defecto es /tmp/, lo que hice fue, antes de volverlo a ejecutar cambié el contenido de la variable TMPDIR hacia /respaldos/tmp ya que en la partición donde está /respaldos/ yo sí tenía espacio suficiente:

mkdir /respaldos/tmp
export TMPDIR=/respaldos/tmp

y volví a repetir la operación. Ten en cuenta que tengo un disco duro con varios TB disponibles montado en /respaldos/, es por eso que opero con /respaldos/

El proceso puede tomar tiempo, incluso horas, depende del disco duro, y al finalizar podemos probar que mivm-new.qcow2 pueda ser leído

guestmount -a mivm-new.qcow2 -i /mnt
ls /mnt
umount /mnt

Si efectivamente podemos leer los contenidos, entonces ya con tranquilidad podemos borrar el qcow2 original (mivm.qcow2 en mi caso).

Por último: ¿qué hace guestmount? Es un comando muy interesante y que merece su propio post aparte. guestmount es un comando que te permite “abrir”, montar, un disco qcow2 y poder ver sus contenidos. En este caso lo utilicé para simplemente validar que el disco duro se podía acceder y ver sus contenidos (lo monté en /mnt), pero sirve para mucho más, por ejemplo un cliente al que no le arranca la red, puedes apagar la máquina (guestmount y virt-sparsify deben utilizarse con la VM apagada!), y puedes montar el disco y corregir cualquier falla en la configuración de la red que el usuario necesite, y entonces desmontar el disco montado con guestmount y volver a arrancar la VM.

Programar TV RIVIERA para Decodificador DirecTV LH02

Tengo un amigo con un TV Riviera que instaló el decoficador DirecTV llamado LH02. Es un decodificador pequeñito de color negro, el control remoto es de color blanco y tiene un botón amarillo en medio

En la etiqueda de abajo del decodificador dice: LH02-O-303.

Esta es una imagen del control remoto:

El código que me funcionó de mi TV Riviera fue el 13134.

Para programarlo hacemos lo siguiente:

  • Presionas a la vez SELECT+MUTE y esperas unos segundos hasta que el LED que está entre ON y OFF parpadee dos veces. Ahi le sueltas a ambos botones.
  • Ingresas el código: 13134 (no hay apuro, le ingresas normalmente)
  • Apuntando al TV Riviera, que tienes encendido, presionas el botón OFF

El TV debe apagarse luego de un momento.

Ya, eso es todo, ya tenemos configurado nuestro TV. Ahi puedes encenderle presionando ON, subir/bajar el volumen, etc.

Esto funciona para mi TV a la fecha de hoy, Noviembre del 2022.

Compiling FLRig for raspbian/Ubuntu

  • Download the source code http://www.w1hkj.com/files/flrig/
  • untar the source code
  • cd flrig*/
  • sudo apt-get install checkinstall libxft-dev fltk1.3
  • ./configure
  • make -j4
  • sudo checkinstall

That’s it!

Código de TV Riviera

En Ecuador es una marca muy popular un tipo de televisor marca Riviera.

Tengo un RIVIERA RLED-DSG32CHE3000 de unos pocos años atrás, y quise configurar el control remoto del Google TV (el nuevo Chromecast) que resulta que no le detecta automáticamente. Lo mismo me sucedió con Amazon FireTV

Luego de mil trabajos encontré que este TV Riviera DSG32CHE3000 usa el código de TV tipo Toshiba.

En este caso, el resto de la configuración fue muy sencilla, desde el control remoto Google Chromecast con Google TV le configuré un dispositivo tipo TV TOSHIBA y en pocos segundos pude realizar las dos acciones que más necesitaba que es que a través del control de Google TV se pueda apagar/encender el TV y subir/bajar el audio.

Running RS-HFIQ Under Linux (Raspberry PI4)

I have been running RS-HFIQ under raspbian and also under ubuntu Linux on a Raspberry Pi3 and currently under Raspberry Pi4. This is a very raw explanation on how to make it work RS-HFIQ under linux so I can use it as a guide in case I found myself having to reinstall it.

Here is my current Hardware:

As you can see I’m running it in Ubuntu 20.04 LTS on a 4GB RAM RPI 64bits (aarch64). But I have also ran it under raspbian 32bits (for raspi 3) as well as under Fedora Linux

The Input and output is being made via a StarTech USB sound card (recommended by the author of RS-HFIQ). Exactly like this one https://www.startech.com/en-us/cards-adapters/icusbaudio2d

The winning hand here is to be able to install quisk as well as wsjt-x and make them both work together.

How I connected the RS-HFIQ to the USB sound card? Well I followed the diagram in this link: https://sites.google.com/site/rshfiqtransceiver/rs-hfiq-technical-information-site/faq-and-troubleshooting?authuser=0

Here is a picture of how to connect it: IQ OUT RX to MIC, and IQ IN RX to the headphones.

On the raspberry pi4 I installed ubuntu 20.04 LTS from here. You may install the latest DESKTOP version found here. If you install the SERVER it will come up in text mode only, so you will have to install the graphical packages. If you are unexperienced, you better install the DESKTOP version.

Here is my LXDE desktop for my Ubuntu 20.04 in my raspi4

Of course you will notice there are several tasks already running (WSJT-X and QUISK). We will work on that, later,

I then proceed to install quisk, from the quisk website itself: https://james.ahlstrom.name/quisk/

I simply readed the whole page, and then proceeded to install quisk. https://james.ahlstrom.name/quisk/docs.html#Installation (look for the python3 install method in Linux, not the python2).

I’m pretty sure there was some package missing in the instructions but it was quite simple to find out and install it. Sorry, I can’t recall right now.

I tried then to start quisk by typing “quisk” in the linux terminal. It started, now you must configure it

  • Click on “Radios” TAB, then chose to add name the new radio and name it, for example: RS-HFIQ”

A new TAB with the chosen name will appear to the Right (See the TAB *RS-HFIQ* in my case. Ok, click that TAB.

Now download hardware_usbserial.py from here https://github.com/dl1ksv/rshfiq take note of where you downloaded it. In my case I simply downloaded to /home/ubuntu/ as my username is “ubuntu”. So the full path is /home/ubuntu/hardware_usbserial.py

Adapt, change the option “Hardware file path” under *RS-HFIQ* TAB to fit the place where you downloaded the file, in my case /home/ubuntu/hardware_usbserial.py

Now click on the “Sound” TAB and try to match exactly the options shown in the following image. Notice that, maybe the alsa hw:X,0 may change, in my case it is hw:2,0 but in your case X may be, for example, 1 (hw:1,0).

Under remote, match the “Remote” TAB options to the ones shown in the following screencapture:

I did not recall having changed anything else. Just clicked the buttons to configure the mode to DGT-USB, the BW to 3200 and the start option to “Config” in the main window. Oh, and AGC as I can see now.

One important thing to mention here: If you notice an error (in red characters) saying “Stream error: pulse Monitor of QuiskDigitalInput”, that usually means that quisk was started before the QuiskDigitalInput virtual sound card was created. Simply close Quisk and open it again.

Here you will notice the red messages:

Here is quisk after you close it and reopen it, as you may see, the error message have dissapeared:

I then install wsjt-x:

sudo apt-get update && sudo apt-get install wsjtx

In my case I compiled the latest version (currently 2.4.0) but using the stock version from ubuntu should be ok.

After installing wsjtx, open it and compare/adjust the settings:

Under radio settings, try to configure it like this:

Under “Audio” configure it like this:

The rest of the settings tab is up to you to customize them

After configuring it, you will be able to change bands, click on tune, receive stations, and also make calls.

I recall there was an issue with earlier versions of RS-HFIQ and a firmware upgrade must be done in order for digimodes to properly work. This issue is outside the scope of this article, just bear in mind that you must be using version 3.2 or newer. In case you have a version <3.2, check the instructions for upgrading here: https://sites.google.com/site/rshfiqtransceiver/rs-hfiq-technical-information-site/arduino-sketch?authuser=0

Agregar HP Laserjet m175A en debian buster

  1. Instalar cupsd
    1. sudo apt install cups cups-client cups-filters cups-ipp-utils
  2. Configurar cupsd para que escuche desde 0.0.0.0
    1. cupsctl –remote-admin –remote-any –share-printers
  3. Instalar drivers para pixma
    1. apt -y install hp-ppd hplip
  4. Acceder a cupsd desde el browser: https://laip:631
  5. Agregar nueva impresora
  6. Buscar en la lista de drivers HP y la versión de pixma que tengamos
    1. buscar lentamente hp laserjet color pro m175a, está desordenado. La m176n me funciona bien, pues no me apareció la m175a

Agregar canon pixma g2100 en debian buster

  1. Instalar cupsd
    1. sudo apt install cups cups-client cups-filters cups-ipp-utils
  2. Configurar cupsd para que escuche desde 0.0.0.0
    1. cupsctl –remote-admin –remote-any –share-printers
  3. Instalar drivers para pixma
    1. sudo apt install printer-driver-gutenprint
  4. Acceder a cupsd desde el browser: https://laip:631
  5. Agregar nueva impresora
  6. Buscar en la lista de drivers CANON y la versión de pixma que tengamos

docker de joomla con letsencrypt

Hace unos meses publicamos cómo echar a andar joomla con ssl vía letsencrypt. En el archivo adjunto a este post pueden encontrar al docker-compose.yml que creamos en este video. El archivo adjunto está comprimido con .gz para que los filtros de este sitio me permitan subirlo.

Compiling WSJT-x for ubuntu 20.04 (arm64)

This small tutorial will show you how to build and install wsjt-x for your ARMBIAN. In my case I have an OrangePI PC board and armbian buster desktop. But this tuto should work for any other board. It should also work for any other Linux and architecture. E.g.: raspios, debian, ubuntu, etc.

I followed this tutorial for Linux Mint:

http://kb4lhp.blogspot.com/2018/12/recipe-for-building-and-installing-new.html

Lets start by installing some requirements:

sudo apt-get install build-essential checkinstall texinfo gfortran libfftw3-dev qt5-default qttools5-dev qttools5-dev-tools libqt5svg5-dev qtmultimedia5-dev asciidoctor libqt5serialport5-dev libqt5multimedia5 docbook-xsl xsltproc libxml2-utils dpkg cmake libusb-dev libusb-1.0 libudev-dev libboost-all-dev

Then download the latest tgz from https://physics.princeton.edu/pulsar/K1JT/wsjtx.html ex;

wget https://physics.princeton.edu/pulsar/K1JT/wsjtx-2.3.1.tgz 

Lets extract the contents of this package and cd into the directory:

tar zxf wsjtx-2.3.1.tgz
cd wsjtx-2.3.1

And then, lets configure and build wsjtx:

cmake -DWSJT_SKIP_MANPAGES=ON -DWSJT_GENERATE_DOCS=OFF .
cmake --build . -- -j4

This process will take time depending on how fast is your CPU. After it finished, we will invoke the next command in order for it to build the .deb package. Pay attention you will have to modify option number 10:

sudo checkinstall

This package will be built according to these values: 

0 -  Maintainer: [ ecualinux@gmail.com ]
1 -  Summary: [ WSJT-X version 2.3.1 compiled by HC6PE ]
2 -  Name:    [ wsjtx ]
3 -  Version: [ 2.3.1 ]
4 -  Release: [ 1 ]
5 -  License: [ GPL ]
6 -  Group:   [ checkinstall ]
7 -  Architecture: [ armhf ]
8 -  Source location: [ wsjtx-2.3.1 ]
9 -  Alternate source location: [  ]
10 - Requires: [ libqt5multimedia5 ]
11 - Provides: [ wsjtx ]
12 - Conflicts: [  ]
13 - Replaces: [  ]
Enter a number to change any of them or press ENTER to continue: 

in here you enter “10” and add “libqt5multimedia5” (without the quotes). Then just continue and it will build the .deb:


Done. The new package has been installed and saved to
/home/radio/wsjtx-2.3.1/wsjtx_2.3.1-1_arm64.deb

Lets install it!

radio@pisdr:~$ sudo dpkg -i ~/wsjtx-2.3.1/wsjtx_2.3.1-1_arm64.deb
(Reading database … 112570 files and directories currently installed.)
Preparing to unpack …/wsjtx_2.3.1-1_arm64.deb …
Unpacking wsjtx (2.3.1-1) over (2.3.1-1) …
Setting up wsjtx (2.3.1-1) …
Processing triggers for man-db (2.7.5-1) …

And… it works!

Member of SKCC#7163T

%d bloggers like this: