0

I saw the mention of 'c-o-w' in a lvm tuto and that made me confused because it kept me thinking the snapshot vol behaves like overlayfs or other cow fs where changes are written to it after you modified stuff in original vol.

  1. So in actual, the snapshot vol keeps the original copy of files from a volume after the original files are modified? Do I understand this right?

  2. Does btrfs snapshot also work this way?

  3. Supposedly I'm more interested in modification and I want to get only modified files and other changes made in original vol, eg for incremental backup, what is more better way to do this?

1 Answer 1

1

You can't really compare LVM with btrfs, since btrfs is a filesystem and operates on files, while LVM operates at the block layer and operates on disk blocks. An LVM volume typically contains a filesystem, but LVM itself doesn't know anything about files.

LVM does copy-on-write at the block level: after a snapshot is created, the first time a particular block in the volume is overwritten, the old content of that block is first copied to the snapshot. LVM doesn't know or care what the data means: whether it's part of a file, free space, internal filesystem structures, or whatever. It's just a chunk of bytes at a particular location within the volume.

This means that the snapshot preserves the original content of the entire LVM volume at the time the snapshot was made. If the volume contains a filesystem (as is typically the case), the snapshot contains a copy of the filesystem as it existed in the past. You can mount that historical copy of the filesystem and access the old versions of the files; it's completely independent of the main volume with the "current" copy of the filesystem.

If you want to find differences in files between a volume and a snapshot, you'll need to mount both filesystems and use some other tool to compare the two sets of files. Since LVM doesn't know anything about files, it can't tell you which files are comprised by the historical block data stored in the snapshot.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .