How can I set up a copy-on-write volume without duplicating data on disk?

0
6
Asked By Wanderlust42 On

I'm trying to find a way to provision a copy-on-write (CoW) volume without creating a full copy on disk, but I might be misunderstanding how it works. Currently, I'm using LongHorn for my storage solution, but I'm willing to consider switching if it has limitations. So far, every method I've tried results in a full copy from the original volume. For instance, when using a VolumeSnapshot as a source in my PersistentVolumeClaim configuration, it ends up making a nearly full-sized copy (200Gi).

Here's a snippet of what I'm working with:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: snapshot-pvc
spec:
accessModes:
- ReadWriteOnce
storageClassName: longhorn
resources:
requests:
storage: 200Gi
dataSource:
name: volume-20250816214424
kind: VolumeSnapshot
apiGroup: snapshot.storage.k8s.io

I want multiple volumes to reference the same blocks on disk without creating copies. Although I will write some data, it won't be significant enough to require read-only volumes. Am I missing something fundamental in this process?

1 Answer

Answered By TechGuru99 On

Copy-on-write primarily relies on the capabilities of your storage system. Unfortunately, LongHorn doesn't support CoW as you might expect. If you write data, it's going to replicate to other volumes, which could introduce some latency during writes. I’d recommend checking out whether something like Btrfs or ZFS could work better for you. It sounds like you want to avoid full copies entirely, and those file systems do a better job of sharing blocks. Just make sure to confirm if they fit with your setup!

CuriousCoder77 -

Should I just stick with those file systems, or is there a CSI provisioner that works nicer with ext4? I’ve been reading about LongHorn and thought it could do more than it does based on the hype. Just looking for a cost-effective solution using my own hardware.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.