Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I would like to backup my server's home directory with tar, which is working fine except the result is a huge file.
Is it possible somehow to make a backup from my users home directories into a e.g: user1.tar.gz, user2.tar.gz etc file instead of home.tar.gz?
Even with max compression, eventually you could end up with huge file if the users store that much data.
Easiest way is to loop through each dir under /home, creating a new backup for each user.
Also means restores are easier for one user.
For better compression, try piping to 7zip with "ultra" settings
So, now that you have a tar.gz file for each user, you may try other compression mecanisms.
Gzip has not the greatest compressions. Bzip2 is better, and it also has a controlled and small amount of RAM spent to decompress (see man bzip2); I find this interesting for huge files.
Want to try even better compression? But this is not traditional (yet). Try pipeing a tar file to 7z. 7zip gives much better results on many commom cases (for me) and when not, still a little better than the others.
Do not use 7-zip alone to compress the user folders because tar is the right thing for backups. It keeps all file system properties for files.
The script works like a charm, now I can throw out my 180GiB tar file
But for some reason it generates weird files eg: dwrxdwrx---.tar.gz all of them are 45byte.
Dedec0,
I will try other compression mechanism too, maybe I could save some space.
Quote:
Originally Posted by edgardl
Hello
You could use a for loop, I think in something like
Code:
# Backup file system
$TAR -zcvf $DESTINATION/etc.tar.gz $SOURCE4;
$TAR -zcvf $DESTINATION/homes.tar.gz $SOURCE5;
$TAR -zcvf $DESTINATION/var.tar.gz $SOURCE16;
for i in $(ls -l /home); do
$TAR -zcvf $DESTINATION/$i.tar.gz /home/$i
done
Note also that both gzip & bzip2 have a param to set the amt of compression. Default value is roughly in the middle; better compression equals more time to run & vice-versa.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.