Using a truncated file for not just practice, but production?

I’ve used truncated files plenty of times, playing with different zfs configurations, commands, etc. to practice and learn. It is a powerful playground.

Eventually, my laptop will have a proper partition for zfs, but I am not able to configure that at the moment. I’m stuck with a single ext4 partition across the whole drive.

I have a “server” at home with a pool of dedicated drives, and I also backup pool for that production pool.

I often take care of family administration tasks (paying bills, purchasing groceries, etc.) on my laptop. I maintain the permanent, root-source-of-truth copy of receipts on the server since it has a backup. But I like to keep them available locally so that I can reference them for returns, or updating my budget entries, etc.

I am not always able to connect to my server when I need access to the files, so nfs/smb doesn’t solve my problem. I have used rsync, but ensuring a file is in both locations feels like a hassle (e.g. --checksum is not default).
git would do the job simply enough, but a repo full of pdf files just for sync seems an abuse of the tool. (Maybe my proposal here is also an abuse of zfs, … partly what I’m asking.)

If I had a truncated file with a production dataset, I know zfs would inherently ensure both sides were the same via forced receive. And bonus, my e.g. paycheck stubs could be encrypted on my traveling laptop.

So my questions:

  1. is it unsafe / unwise, to use a truncated file as a production pool?
    • 1a) what {reasons | mechanisms} cause it to be a bad idea?
  2. if it were a temporary solution for only 1 small dataset (the use case above, and, I expect to be able to properly configure my laptop within 6 months), does the answer to 1) change?
  3. anything else I need to watch out for, or consider?

Thanks!

edit: minor formatting, slight sentence clarification

I have a cheap cloud VPS that I run some containers on. I really wanted ZFS, but the OS was pre-installed by the provider. I’ve been using ZFS on top of a file for years now to store all of my container data. Not sure I’d do it in any situation where I had any other option, but I haven’t yet seen any issues.

2 Likes

Sweet, I’ll do it then. Thanks for the anecdotal data point! :grinning_face:
Did you use truncate to create the file, or some other method?

Honestly, I don’t remember. I just checked my .bash_history and it was way too long ago to still be there. My very vague recollection is that I may have used fallocate.

I see. I just looked up the difference between fallocate and truncate.

It made me have another question, but I think it belongs as a new topic here:

I can’t comment on the ZFS-specific aspects of it, but may I recommend using SyncThing to, uh, sync things? I think it might be just what you need to maintain your receipts in multiple places, with or without ZFS. It works very well in my experience.

Yeah, I know about syncthing. I’ve set it up in the past, but it was one more piece of infrastructure to maintain when I could solve the problem with other components I was already using (NFS primarily), so I ended up dropping it in my “maybe later” bin. When they dropped their official android client, and the fork did as well, was pretty much the nail in the coffin for me. I already use NFS and ZFS, and android was the only case where neither of those work. So ultimately, it is the idea of one less piece of software to configure and maintain.