Do LVM snapshots ultimately cause fragmentation

lvmsnapshot

I'm planning on using LVM in order to be able to take atomic snapshots of large files and rsync them to a remote site.

What I'd like to know is whether there is any long-term impact on the main (non-snapshot) volume: if I typically keep the snapshots for 24h before dropping and creating a new snapshot, does the main volume get progressively more fragmented?

Best Answer

No, there will be no fragmentation on the original filesystem because of the snapshot.

Snapshots basically work this way:

  1. you start your snapshot by giving it some disk space to keep track of changes,
  2. one block on your original volume gets modified,
  3. before the new block is actually written on the original volume, the (old) block content is copied within the snapshot area,
  4. whenever you access your snapshot device, LVM maps block access either to the original volume or the snapshot area, giving you the feeling that your snapshot volume is "frozen".

Nowhere in that process the original volume behaves differently because of the snapshot. It just ignores the whole snapshot thing.

(You will note that this "fragmentation-avoiding" behavior comes at a performance cost when writing to the original filesystem though.)

Related Question