Thursday 3 July 2008

Creating Multiple Volume .tar.gz files

Well, today I came a cross a problem: I have to backup a 29GB file system to recreate it under the new rules here (I have ReiserFS, and as the guy is jailed for killing his wife, the policy is to convert everything to ext3, since it tends to be unmaintained). My external HDD is formatted in FAT32, for compatibility issues (Use in Mac , Linux and windows machines).

I did some research, and to create multiple tar.gz files, you need to use a combination of FIFO, split and tar. First you need to create a FIFO file (which can be reused in later uses):

mkfifo /tmp/test.fifo

After you can issue the following command line to generate the files:

split -b 200m /tmp/test.fifo /media/UNTITLED/filename.tgz- | tar -czvf /tmp/teste.fifo .

Basically what I am doing is sending the tar output to the FIFO (First In First Out), and then splitting the FIFO in 200MB files.

To recover things from the tar.gz file you just need the following:

cat /media/UNTITLED/filename.tgz-* | tar zxvf -

This should put all the bits back together.

No comments: