Transfer image compressed via SSH

From Univention Wiki

Jump to: navigation, search

This article describes the how to copy hardrive images compressed via SSH.

Introduction

The copy procedure can easily be done with standard Linux system tools.

To copy an image from your local device /dev/sda to a virtualization host, execute the following command:

dd if=/dev/sda | gzip | ssh root@<HOST> "gunzip | dd of=/var/lib/libvirt/images/image.img" bs=2K

Explanation

dd reads the Harddrive /dev/sda/, the output is being compressed by gzip. The compressed file will be transmitted to the foreign host with ssh and there decompressed with gunzip which writes the file to the given path. The block size of 2 Kbyte will speed up the transmission of bigger files.

Personal tools