Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'd like to start using LVM snapshots to help ensure quality backups.

If I have a /var partition that is on a separate volume from the rest of the root filesystem, can I still ensure that a backup accurately reflects the state of the entire system at a particular point in time? Is it worthwhile, based on the nature of the files in /var, to be concerned with this?

share|improve this question

1 Answer 1

Create snapshots for both filesystems at the same time.

share|improve this answer
    
Yes, well certainly, but the question is, how can I do this? Even issuing two lvcreate commands on the same command line will result in a slight delay between the snapshot-takings. If a file is being written to at that point in time, there will be some inconsistency between the two snapshots. –  intuited Feb 16 '11 at 15:28
    
@intuited: If a file is being written to at the time, it will be inconsistent regardless. Writing to two different files on two different volumes at the same time is no worse. –  psusi Feb 17 '11 at 20:43
    
But I may end up with something in /var saying that an installation completed, but having corrupted (i.e. not completely written) files in /usr/... Whereas if the whole system is on one volume, at least the system won't think it's finished doing something that it didn't finish. Also things like lock files could get out of sync. As I understand it, this is the main benefit of LVM snapshots as aides to backup; I wouldn't want to lose that. –  intuited Feb 17 '11 at 23:42
    
@intuited: Such an application would flush the writes to /usr first, then write to /var. If you take the snapshot between the two, then you are in the same boat whether you are taking a snapshot of a single fs, or two different ones, which is to say, the same as a power failure at that same moment. Applications that do that sort of thing are designed to deal with that. –  psusi Feb 18 '11 at 1:58
    
No, it's not the same as a power failure, because with a power failure all filesystems get "frozen" at exactly the same moment. Whereas with two separate snapshots, the first will be frozen before the second. So it's possible that after the first snapshot is taken, and before the second is taken, some operation writing to /usr/... completes, and a consequent write to /var/... is also completed. So the snapshotted-and-subsequently-backed-up /usr volume contains a file which was not completely written, and the /var volume contains a file which says that the writes to `/usr/ completed. –  intuited Feb 18 '11 at 3:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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