1

I have a CentOS7 (RedHat) server with 2 boot drives in RAID1 and 8 data drives in a software RAID10 (mdadm). I was trying to use LVM snapshots to back up a mongo data base, stored on the data drives, then zip up the snapshot and store it on a different server. My problem is every time I check to see if the snapshot is up to date it never is. I will create a new file in the original logical volume then mount the snapshot to check if it has the file and it is never there unless I remove the snapshot lvremove and recreate it lvcreate


Here is what my setup looks like: CentOS server mismatch in LVM snapshot

The directory /mnt/snap is where the snapshot is mounted and /data is the logical volume I want to snapshot. The files aren't the same in both. Am I thinking about LVM snapshotting the wrong way? Would I actually need to snapshot each time I want to backup and archive the database?

  • Maybe you want mirroring and not snapshots? – mdpc Dec 21 '17 at 18:58
  • Well I was reading we have to allocate a size for the snapshot which is the size of the amount of changes made right? – vbhakta Dec 21 '17 at 19:07
0

It sounds like you're thinking about them wrong. An LVM snapshot captures the state of the source device at the instant the snapshot is created. So the typical snapshot-and-backup workflow is:

  1. Create a snapshot
  2. Mount the snapshot
  3. Copy the data off
  4. Unmount the snapshot
  5. Delete the snapshot

Old snapshots can also be retained as additional backup, but there are costs to that (maintaining copies of data is not free in either disk space or disk access terms).

  • Gotcha thanks! So then what does the space I allocate for a snapshot mean? Isn't it for changes made to the original lv? – vbhakta Dec 21 '17 at 19:08
  • The space you allocate is to hold the difference between the snapshot and the original. Any blocks that are not changed, remain as one copy on the drive. – Mioriin Dec 21 '17 at 19:23
  • @vbhakta yes, that's how the original LV can continue to change: the old version of any modified data is stored in the snapshot space. – derobert Dec 21 '17 at 19:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.