Export the /home directory from a virtual machine into a tarball

This script lets you export any directory you like from a virtual machine as a tarball. For example, to export /home from a standard Fedora or RHEL virtual machine you would do:

export2tar guest.img /dev/VolGroup00/LogVol00 /home home.tar.gz

/dev/VolGroup00/LogVol00 is the partition or LV inside the VM which contains the directory you want.