Transfer sparse files under Linux

Hello,

The main idea of this is :

We have bare-metal server A and we want to copy the virtual machine from A to bare-metal server B. If the virtual machine is 80GB and the connectivity between the two servers is 1GB the transfer will be ready for 20 minutes.

If our virtual machine is 1GB big, the transfer will still take so much because we will transfer all 80GB – 79GB of which zeros.

In this post I will share a way with tar how to avoid this annoying transfer of redundant data to sparse files.

Create a sparse file

For the test, I created a virtual machine with a size of 80GB hard drive :