little problem, smart solution;
i’m backing up my citrix xenserver vm’s using the command
-
xe template-export
i write the backup directly to a cifs-mounted share on the network. however, i need to compress those images, ideally before i send them over the network. the problem is that the template-export command doesn’t support writing to stdout, which would allow me to pipe it through gzip.
fortunately, there’s a way which allows me to pipe it through gzip nevertheless. i’m using a fifo;
1st step: create a fifo
-
mkfifo gzipfifo
2nd: start gzip and let it wait for data from the fifo and write to another file (in my case on the cifs-share)
-
gzip -c > /mnt/backup/PMIRZ_Firewall_Demo.xva.gz < gzipfifo &
3rd: write your backup to the fifo, instead of the mounted volume
NHAAAA, just noticed that the template-export command doesn’t want to write to files that already exist… but the above works for other things as well

In citrix xen server 5.6.1 which I am using, there is option compress=true, gzip is involved then.
xe vm-export vm=UUID compress=true filename=xxx
To export just leave the filename blank as in this example:
xe vm-export vm= filename= | gzip -c > /mnt/vm.xva.gz
To import use /dev/stdin as filename:
gunzip -c /mnt/vm.xva.gz | xe vm-import sr-uuid= filename=/dev/stdin
To export just leave the filename blank as in this example:
xe vm-export vm=VM-UUID filename= | gzip -c > /mnt/vm.xva.gz
To import use /dev/stdin as filename:
gunzip -c /mnt/vm.xva.gz | xe vm-import sr-uuid=SR-UUID filename=/dev/stdin