Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I searched the web but did not find any info about this. I'm mounting an LVM snapshot and I notice the timestamps of the files there keep changing. I though LVM snapshot was a one time freeze in time w/ write on copy of the original partition, so the timestamps should not change.

Of course now tar is giving me an error saying the "file changed as we read it" which I think comes from the timestamps being changed.

Any insights?

share|improve this question
    
Are you saying that you mount a snapshot under, e.g., /mnt and then create a tarball of /mnt filesystem during which you get the "file changed as we read it?" –  Mark Wagner Oct 25 '10 at 22:08
    
yes, exactly, do timestamps of snapshot files change? –  Ricardo Oct 25 '10 at 22:38

3 Answers 3

The snapshot will keep changing. The underlying filesystem will not. Make backups from that instead.

share|improve this answer
    
I dont understand. I can i make a backup from the filesystem without having to mount the snapshot in /mnt –  Ricardo Oct 25 '10 at 22:39
    
You don't mount the snapshot in /mnt. You mount the snapshot where you normally would, and you mount the underlying filesystem read-only in /mnt. –  Ignacio Vazquez-Abrams Oct 26 '10 at 2:36
    
still dont get it. im using the procedure for backups as explained here: mysqlperformanceblog.com/2006/08/21/… –  Ricardo Oct 26 '10 at 2:38
    
That article has it backwards. Mount the snapshot in place, and backup the underlying filesystem. –  Ignacio Vazquez-Abrams Oct 26 '10 at 2:39
    
but the underlying filesystem is changing cause the tables are unlocked... thats the all purpose of having the snapshot, to avoid table locking for more than n seconds –  Ricardo Oct 26 '10 at 2:48

So apparently lvm1 timestamps the mtime on files instead of the snapshot creation time: http://www.redhat.com/archives/linux-lvm/2005-April/msg00039.html

this explains why tar is complaining. Any way i can make tar ignore this?

share|improve this answer
    
just realized i can do --warning=no-file-changed but only works for tar v>=1.23 ;( –  Ricardo Oct 26 '10 at 0:29

To ensure that no one can write to your snapshot while you run your backup, try mounting it read-only:

mount -o ro <snapshot-device> /mnt

EDIT

If the snapshot is already mounted, try this instead:

mount -o remount,ro <snapshot-device> /mnt
share|improve this answer
    
it's giving me a mount error "already mounted" if i give that option. besides how would the timestamps be updated if it's read only? –  Ricardo Oct 26 '10 at 2:49
    
I updated my answer. Please try the remount option. I don't understand the rest of your comment. What timestamps do you think should be updated? –  Steven Monday Oct 26 '10 at 3:23

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.