![]() ![]() Neither option is part of the POSIX spec for file. PS: 7z can also create solid archives, which result in better compression, but comes with the same limitations as using tar inside any compressor.If you have a version of file that supports the -z or -Z options, you can use either of those to try to look inside compressed files to find out what they are. ![]() 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 |