I really wish you could use custom filesystems such as btrfs with WSL2. I don't think there's currently any way to do snapshotting, which means you can never be sure a backup taken within WSL is corrupt.
Nice. Unfortunately for my use case I can't use physical storage devices. I need a something similar to a qcow2 that can be created and completely managed by my app.
Hope that https://github.com/veeam/blksnap/issues/2 becomes available soon. It's on v7 of posting to linux-block and will make snapshotting available for all block devices.
This is the first I've heard of blksnap. Looks very interesting. There's not much documentation in the repo. Am I understanding correctly that if I were to build a custom WSL kernel with those patches, I would be able to do snapshotting in WSL today?
Can you give or link to a brief description of how blksnap works?
You could do block device snapshotting today if you build your block devices on top of LVM. You can also somewhat do it with fsfreeze and remounting your mount point on top of a dm-snapshot target.
Blksnap is better because it does not require setup in advance like LVM, and it does not require interrupting any live users like fsfreeze. It "should" just work with the live block device within the WSL distro.
This is all somewhat future-looking, and if you only want file-level snapshotting instead of block-level, it's probably easier to try and get btrfs/bcachefs/nilfs2 instead. My WSL2 on Windows 11 shows btrfs present inside /proc/filesystems.
In the 2024 century the default LVM setup still does not offer to leave some spare space on the volume group. Without that unallocated space it's impossible to create snapshots for LVs.
Oh, and the change-tracking function is non existent for both LVM and dev mapper!
Hell, even just being able to use XFS would be an improvement, because ext4 has painful degradation scenarios when you hit cases like exhausting the inode count.
(Somewhat related, but there has been a WIP 6.1 kernel for WSL2 "in preview" for a while now... I wonder why it hasn't become the default considering both it and 5.12 are LTS... For filesystems like btrfs I often want a newer kernel to pick up every bugfix.)
Maybe that could be adapted, but I don't think it would solve my problem currently. Basically I want to be able to do btrfs snapshots from within my WSL distros, so that I can run restic or similar on the snapshots.