Filesystems are weird
While cleaning up some files I encountered a curious conundrum.
Every now and then I try to tidy some of the entrophy in my life, as in tidying up the amount physical and digital stuff I’ve accumulated.
So, here’s the curious thing.
I have a folder with various projects I’ve accumulated over the years. Right-clicking on it and inspecting it on my laptop reveals: 259 139 items
, amounting to 30.5GB
. The filesystem type is ext4
.
To speed up the backup process, I combined all the files into a .tar
file. The file size of the .tar
file ended up being 30.5GB
, which makes sense since I didn’t use compression. Transferring the .tar file over the local network took approximately 4 min
, while my first attempt at just transferring all the file estimated to take 4 hours
.
The weird thing is that after transferring the file to my NAS (Network Accessible Storage), I noticed that the .tar
file’s size was 28.36GB
. Uh oh! Did everything actually transfer then? There had been no errors during the transfer.
After unpacking the .tar
file on my NAS, I inspected them through the NAS’s Web UI, which showed this info about the unpacked folder: 28.19GB
, 194 978 files
and 66732 folders
, which totalled 261 710 items
. The file system on my NAS is Btrfs
.
Weird. 😤 Both file size and number of items seem to be fluctuating. Even though I saw no errors, I still felt uneasy, considering this is supposed to be backing things up properly.
After a bit I went back and checked the files, by connecting to my NAS from my PC using the SMB protocol (like visiting a shared folder on the network). Inspecting the same files revealed yet other numbers: 30.5GB
was the size of the newly transferred .tar
file. And inspecting the unpacked folder showed 263 038 items
, and total file size 30.3GB
.
Some source online point to differences between file systems, which can lead to the same files taking up different amount space. Though, it’s a bit puzzling that the number of files would change as well.
I guess I just need to trust that nothing has been lost in the transfer. The numbers are almost aligned. Hopefully, I won’t end up in a situation where I’m almost able to recover my files.