9

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?

2
  • 1
    You can check LV fragmentation using lvs -o +devices. In general, it shouldn't be a problem. Snapshots are a temporary thing, they do not cause fragmentation, data stays in the original, unmodified LV. Mar 25, 2013 at 14:09
  • Thanks frostschutz, that's my answer. Would you like to post it (perhaps linking to the LVM docs here)?
    – user12810
    Mar 26, 2013 at 12:07

1 Answer 1

4

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.)

You must log in to answer this question.