Back to Our Home

Documentation

Introduction:

Zsplit and Unzsplit are command line linux utilities which operate like such popular software as Symantec Norton Ghost™ or Acronis True Image™ and allow to create an exact disk image for complete system backup and disk cloning, providing the most comprehensive data protection. However, unlike other similar software solutions zsplit and unzsplit are free for download and distribution ! Please notice, both programs zsplit and unzsplit are protected by the GNU GPL2.

Zsplit and Unzsplit are using the zlib library in order to implement in-memory compression and decompression functions, including integrity checks of the uncompressed data. This library was written by Jean-loup Gailly (compression) and Mark Adler (decompression). Author acknowledges with thanks the possibility to use this library under conditions of the zlib license.

Usage Overview:

For details of usage of different options please see the help documentation for zsplit and unzsplit. We would like to discuss here a few possible general approaches in using these tools for different backup/restore situations.

Operating localy:

Situation 1: In our computer we have a device hda with bootable linux partition and zsplit on board. In our computer we have also plugged-in a device hdb with some other operating system on it, for example Windows XP. The device hda is adequately sized, so that on additional space it can contain the whole size of device hdb. We would like to make a backup-image of whole device hdb, so that later we could transfer our image to one or more DVD disks for storage.

Assume we boot linux from hda, select the directory were the image should be stored and in this directory we issue the following command on prompt:

zsplit -s 4.5G -N WinXP_backup -d /dev/hdb

That’s all, the image of device hdb will be compressed using default compression rate, split into chunks of size 4,5 Gibibyte (Gigabyte binary) and saved in the current directory (files: WinXP_backup_0.spl.zp, WinXP_backup_1.spl.zp, WinXP_backup_2.spl.zp ...). Each of these files fit exactly one DVD disk and could be transferred to it for storage. Option '-d' enables creation of the debug.log file in the current directory. In this file you can find all time- and size information about creation of the image files. If you would like to save image files to some other directory on the hda device do the following:

zsplit -s 4.5G -N WinXP_backup -o /some/other/dir -d /dev/hdb

Please notice: in some cases, for example if you have a heavily fragmented NTFS partition or bad sectors on your HDD, it may happen that zsplit breaks its operation and aborts with I/O error. To overcome this error situation you can use an option -r, --noerror. This option will switch zsplit in a special read-mode, so that all intact sectors will be safely read and bad sectors will be excluded. Of course the output file will have holes in it and there is a certain possibility that backup-image file can lose its consistency. Therefore it is a good idea after restore operation to check the restored disk with tools like "scandisk" (FAT16-FAT32) "chkdsk" (NTFS) "fsck.xxx" (ext,swap,reiserfs).

Example of the same command as above with added --noerror option:

zsplit -s 4.5G -N WinXP_backup -o /some/other/dir -d -r /dev/hdb

To restore the whole device hdb you should have unzsplit on board, than you transfer all split chunks from DVD disks to some directory on hda (you should consider following: you are responsible for all split chunks to be complete in the selected directory). If you have all needed chunks for restoring, cd into this directory and issue the following command on the prompt:

unzsplit -D /dev/hdb -d WinXP_backup

Unzsplit will read the file list in a current directory with a common name-part WinXP_backup, such as: WinXP_backup_0.spl.zp,WinXP_backup_1.spl.zp, WinXP_backup_2.spl.zp ..., deduce a right order of reading, uncompress and glue them together to one image. Finally it will restore this image to the device /dev/hdb. All time- and size information of restore operation will be written into the debug.log file in the current directory.

Situation 2: We are going to backup the whole bootable system device (hda) in our computer. Please notice, it absolutely does not matter what operating system is installed on this device (win95, win98, winNT or Linux). What we need in this situation is: an adequately sized storage device (hdb), DeviceImage-LiveCD and, of course, zsplit tool. Please notice, you can use another LiveCD distribution such as KNOPPIX bootable CD but zsplit and unzsplit are not included in this distribution. So after booting from original Knoppix CD you need to download it to the Knoppix environment (with a help of floppy, ftp or smbmount).

To create the image backup of the system device (hda) we boot the computer with DeviceImage-LiveCD, create (if no partitions exist) a partition on hdb device (for example ext2 on hdb1), mount this partition to some directory on LiveCD environment (mount -t [fstype] /dev/hdb1 /some/new/dir), cd to this new directory ( cd /some/new/dir/) and use zsplit for creating image backup:

Backup in form of split image files:

zsplit -s 700M -N WinXP_backup -d /dev/hda

creates image of device hda compressed and split into chunks of size 700 Mebibyte (Megabyte binary). See a full description above.

Backup as one big image file:

zsplit -N WinXP_backup -d /dev/hda

creates image of device hda as one compressed image file.

To restore the system device hda we need a second device (for example hdb) with backuped image file/files, DeviceImage-LiveCD with unzsplit. The whole procedure could be as follows:

we boot the computer with DeviceImage-LiveCD and mount partition on hdb device which contains the backup-image file/files, cd into the new directory and issue the following command on the prompt:

unzsplit -D /dev/hda -d WinXP_backup

Unzsplit reads the file list in a current directory with a common name-part WinXP_backup, such as: WinXP_backup_0.spl.zp, WinXP_backup_1.spl.zp, WinXP_backup_2.spl.zp ..., uncompresses and glues them together to one image, and restores this image to the device /dev/hda. The debug information is written into the debug.log file in the current directory.

Operating over the network:

The usage of options for netcat in this docu is based on the man page of original implementation of netcat by *Hobbit* <hobbit@avian.org>. Any deviations from the original implementation may have other options which need to be considered.

Example: netcat for Fedora Core is re-written nc(1) for OpenBSD with different usage of -l and -p options.

Situation 1: Suppose you would like to make a backup-image from the bootable system device and your system has no other device which you could use as backup repository, but you have a second computer and there is a network connection between both computers. Zsplit with a help of netcat and dd will do the job and make a backup-image from one location to the other, over the network. The following scenario could be easily realized:

The backup-image should be created from system device of computer A over the network to some device on computer B. We boot machine A with the DeviceImage-LiveCD. Suppose we have a Linux-Box as machine B, or if not, we can also boot the machine B with DeviceImage-LiveCD. After both computers are running, you may need to know what IP address is assigned on the machine A and B. Please use the command ifconfig -a to check the IP. Assuming the Linux-Box A is up and running with IP 192.168.0.1 and Linux-Box B is up and running with 192.168.0.2 do the following:

Step 1: on the machine B issue the following command:

nc -l -p 9000 | zsplit -s 4.5G -N Linx_bkp -d -

this will switch the netcat into the listener mode. netcat will listen at port 9000, if some data will come through this port, it will pipe the incoming data over to zsplit. Zsplit in turn will do its own job, it will compress all incoming over the stdin data using default compression rate, split the compressed data into chunks of size 4,5 Gibibyte (Gigabyte binary) and save all this data chunks in the current directory (files: Linx_bkp_0.spl.zp, Linx_bkp_1.spl.zp, Linx_bkp_2.spl.zp ...). In the current directory you will see also the debug.log file with all time and size information.

Step 2: on the machine A issue the following command:

dd if=/dev/hda bs=1024 | nc 192.168.0.2 9000

this will initialize a data stream over the network to the port 9000 on the machine with IP 192.168.0.2 . Depending on the network speed and size of the hard drive of the machine A it may take some time to transfer all image-data to machine B. As result of this operation you will get compressed and split image chunks of device hda, (computer A ) on the machine B. The advantage of this method is: you get compressed and split image chunks at the end of operation. The disadvantage however is: the transfer speed over the network is rather low, because in this case we transfer uncompressed data.

If you prefer to have possibly high transfer rate, you may do the other setup procedure:

Please notice, the difference between these two setups is only the place of running of zsplit and dd.

 

 

Step 1: on the machine B issue the following command:

nc -l -p 9000 | dd of=Linx_bkp_0.spl.zp bs=1024

netcat will listen at port 9000 it will hand over all incoming data to dd, dd in turn will save all data to one image file Linx_bkp_0.spl.zp . Please notice, the naming convention even for alone file remains the same. In case we would like to restore this file, it is important for unzsplit to have the part of the name as "_0.spl.zp", see documentation for unzsplit.

Step 2: on the machine A issue the following command:

zsplit -c -d /dev/hda | nc 192.168.0.2 9000

zsplit will read from /dev/hda, using default compression rate in-memory compress the data and hand over all compressed data to netcat, which makes a transfer to listening netcat on the machine B.

The advantage of this method is the highest possible transfer rate over the network. The disadvantage is: at the end of operation you will get one big compressed image file.

We can also restore the system device hda on the machine A over the network. Suppose, after the backup procedure we have split image chunks on the machine B from device hda of machine A.

To setup the restore procedure, please do the following: boot machine A with the DeviceImage-LiveCD. If we do not have a machine B as Linux-Box, we can also boot the machine B with DeviceImage-LiveCD. After both computers are running, you may need to know what IP address is assigned on the machine A and B. Then do the following:

Step1: on the machine A issue the following command:

nc -l -p 9000 | dd of=/dev/hda bs=1024

netcat will listen at port 9000 it will hand over all incoming data to dd, dd in turn will restore all data to to the device /dev/hda.

Step 2: on the machine B, cd to the directory which contains the image files and issue the following command:

unzsplit -c -d Linx_bkp | nc 192.168.0.1 9000

unzsplit will find all files with a common name part Linx_bkp, determine the right reading order and the sequentially read all chunks, decompress them and hand over the data stream to netcat. Netcat connects to port 9000 on the machine with IP address 192.168.0.1 and transfers all data over the netcat on the machine A to dd. dd in turn restores all data to the device hda. Option -d controls the output of all size and time information of the restore procedure to the debug.log file.

Situation 2: suppose you would like to make a cloning over the network. i.e. you plan to distribute many identical installations over the network. The following setup will help you:

Please notice the setup is very similar to the setup mentioned above. The difference is: we use in such case both tools zsplit and unzsplit together with netcat, and we have to boot all machines with DeviceImage-LiveCD.

To setup the clone procedure, please do the following: start both machines with DeviceImage-LiveCD. Define on both machines the IP addresses (see man for ifconfig), suppose machine A has IP 192.168.0.1 and machine B has the IP address 192.168.0.2 . We define the machine A as master and machine B as slave. The cloning direction is from master (A) to slave (B). Please notice, the device size on the machine B should be equal or bigger than the device on the machine A.

Step 1: on the machine B issue the following command:

nc -l -p 9000 | unzsplit -D /dev/hda -d -

netcat will listen at port 9000, it will hand over all incoming data to unzsplit over the stdin, unzsplit in turn will decompress and restore all incoming data to the device /dev/hda.

Step 2: on the machine A issue the following command:

zsplit -c -d /dev/hda | nc 192.168.0.2 9000

zsplit will read from /dev/hda, using default compression rate in-memory compress the data and hand over all compressed data to netcat, which makes a transfer to listening netcat on the machine B.

Copyright(C) 2005 - 2007 DeviceImage-Project

Contact Us

07.07.2007: DeviceImage software goes commercial. Please see here for details.

28.11.2006: Broadening multilanguage option of the homepage. Italian translation has been added. Thank you very much Gianfranco!

14.03.2006: Added mini-HowTo your feedback is very appreciated

27.09.2005: Broadening a multilanguage homepage, Spanish translation has been added, thank you very much Jose!

05.06.2005: zspli/unzsplit version 1.2.0 has been released, please see release notes. Also DeviceImage-LiveCD is now available.

08.04.2005: started multilanguage version of DeviceImage homepage + Forum.

06.03.2005: zsplit/unzsplit version 1.0.1 has been released, please see release notes.