BSDTAR vs TAR plus much more
Here is one benefit!!
I'm going to go into 5 topics here (and go way off topic, but it will cover what you want as well):
- bsdtar vs tar
- sparse files vs not
- thick and thin files/luns with btrfs
- thick and thin files/luns without btrfs
- diff between thick and thin and how it doesn't apply to just luns
bsdtar handles sparse files better then regular tar
- bsdtar will take all of the zeros and just metadata them up
- tar will actually processes every zero
*example:
imagine a 20 tb sparse file (called biglun) with 10 megs of data throughout the 20 tb sparsefile (biglun)... now since this is a sparse file it will only take up 10 megs on the drive.
How to make a sparse file:
Sparse File - how to make it - detect it - everything
Sparse files are like "thin" luns (if you were to use it for a lun). "thick" luns would be different story.
*back to topic:
taring up the biglun will make tar go through all of 10 megs along with all of the ~20tb worse of zeroes spread across the lun... it will take some time I presume, and the tar file will be pretty big. Also -- extracting it -- I've never done an extract of a tar file of a sparse file, but it might not be pretty; I might be wrong here.
bsdtarring the biglun will just process the 10 megs of data, and make small metadata for the ~20tb of zeros.
Benefit? Well lots of them; I just wrote some above.
It's similar to rsync vs cp
- Also, if you rsync a giant sparse file, it will behave like tar
- If you cp a giant file, it will behave automatically like bsdtar (you can change cp'ss behaviour to go over the zeroes, or not go over the zeroes)
Personally, I like to imagine sparse files like thin luns, and regular files like thick luns...
Next topic is BTRFS thin vs thick luns:
With filesystems like BTRFS, thin luns are sparse files (make it with truncate, like in the wiki doc).
truncate -s <size in kilobytes> filename
tip: backup with bsdtar, copy with cp
thick luns are regular files with the +C attribute (+C so that it makes it none COW, copy on write, so that all writes essentially stick around to where it's allocated to, and no new writes happen for that file when there are overwrites or deletes - research COW and BTRFS). Instead of making the file with truncate, make it with "fallocate -l "
fallocate -l <size in kilobytes> filename
chattr +C filename
tip: backup with bsdtar or tar, copy with rsync or cp
next topic is EXT thin vs thick luns:
thin luns which are sparse
truncate -s <size in kilobytes> filename
tip: backup with bsdtar, copy with cp
thick luns are regular files with the +C attribute (+C so that it makes it none COW, copy on write, so that all writes essentially stick around to where its allocated to, and no new writes happen for that file when there are overwrites or deletes - research COW and BTRFS). Instead of making the file with truncate, make it with "fallocate -l "
touch filename
fallocate -l <size in kilobytes> filename
tip: backup with bsdtar or tar, copy with rsync or cp
whats a thick vs thin file
- thick luns/files, fill up their data from 0 to the size allotted, metadata pretends where the 0s are. as you fill up data, the data fills up
- thick luns/files: fill up their data at the start with 0s or whatever (lazy zero or eager zero) - these set reservations (or as ZFS like to call refreservations)
VMWARE ARTICLE HERE describes lazy vs eager zero with thick luns/files: https://communities.vmware.com/message/2199576
tip
remember thick and thin doesn't just apply to luns, it can also be on files, zfs filesystems (shares/volumes/luns), and I'm sure other things (just look at zfs).
--sort
,--mtime
, and so on, whereas bsdtar does not appear to support those options. This is important e.g. in the context of reproducible builds.tar -cf Ł.tar
ends up asL.tar
. Reproduced in cmd, powershell, and (git-)bash. On Ubuntu (bash) I do not see this issue (gnu tar 1.34 and bsdtar 3.6.0).