![]() ![]() The linux-3.18.19.tar file was compressed and decompressed 9 times each by gzip, bzip2 and xz at each available compression level from 1 to 9. This file was 580,761,600 Bytes in size prior to compression. With XZ it is possible to specify the amount of threads to run which can greatly increase performance, for further information see example 9 here.Īll tests were performed on linux-3.18.19.tar, a copy of the Linux kernel from. The server had 4 CPU cores and 16GB of available memory, during the tests only one CPU core was used as all of these tools run single threaded by default, while testing this CPU core would be fully utilized. The test server was running CentOS with kernel 3.10.0-229.11.1 in use, all updates to date are fully applied. PS: 7z can also create solid archives, which result in better compression, but comes with the same limitations as using tar inside any compressor.Gzip, Bzip2 and XZ are all popular compression tools used in UNIX based operating systems, but which should you use? Here we are going to benchmark and compare them against each other to get an idea of the trade off between the level of compression and time taken to achieve it.įor further information on how to use gzip, bzip2 or xz see our guides below: With an archive like 7z (not using tar inside) your chances of recovering more files are better. Therefore, for a bunch of regular files, and where ownership doesn't matter, just use 7z directly.Īlso, if a tar file (or a compressed tar.anything file) is damaged, you will only be able to recover your data up to the point of injury. However, 7z will only know about the one tar file inside, and the entire tar file will have to be unpacked and read to discover what lies inside. One can use tar inside 7z (resulting in directory.tar.7z) to make sure you have preserved all the special Linux goodies. If you want to send files and directories (not the owner of file) to others Unix/MacOS/Windows users, you can use the 7-zip format.ĭo not use "-r" because this flag does not do what you think.ĭo not use directory/* because of ".*" files (example : "directory/*" does not match "directory/.profile") to restore your backup : 7za x -so directory.tar.7z | tar xf. to backup a directory : tar cf - directory | 7za a -si directory.tar.7z On Linux/Unix, in order to backup directories you must use tar : 7-zip does not store the owner/group of the file. I quote from man 7z on my Ubuntu system: Backup and limitationsĭO NOT USE the 7-zip format for backup purpose on Linux/Unix because : Other answers have explained the difference between compression and archiving well.ħz is an archiver, which means it knows about the internal directory structure, file names, etc. Some files don't compress well because they may already be compressed with some other means (ie. ![]() It's 7z's ability to exclude the file metadata that it can offer great compression (amongst other things of course).Ĭompression depends entirely on data type as well. I guess a backup.tar.7z file is just a tar file (with permissions) compressed by a 7z file, though I wouldn't be surprised if little compression occurred because 7z may not be able to dump the file metadata. Rzip is another compression utility that offers comparable compression with 7z as well. The P flag saves files with full paths, so - /home/username vs home/username (notice the leading forward slash).ħz compression offers greater compression, but does not preserve file ownership, permissions, etc. Tar xpPkvf backup.tar #extracting a tar with permissions(p) and not extracting(k) files that exist on disk already tar upPvf backup.tar folder #updating a tar file Then to update, replace 'c' with 'u' and when unpacking, you can use 'k' to preserve files that already exist. If you want to have a tar file you can "update" package the tar using the P flag: tar cpPvf backup.tar folder Tar cjpvf 2 folder #backup.tbz2 works too ![]() ![]() tar czpvf folder #backup.tgz is acceptable as well Use the z flag for gzip compression or the j flag for bzip compression. To preserve file permissions, use tar: tar cpvf backup.tar folder When I talk about archiving, I mean preserving permissions, directory structure, etc.Ĭompression may ignore most of that and just get your files in a smaller packages. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |