2

i have an lvm snapshot and i would like to see what files have been changed, added or deleted. (Just the file list is sufficient.)

Is there an easy way to get the list?

Thanks in advance for any reply.

1 Answer 1

6
  1. Mount the old snapshot read-only mount /dev/snapshot-somewhere /snap
  2. Make lists of the files on real fs and snapshot cd /snap; ls -lR . >/tmp/list.snap (or use mtree or rsync to make the list)
  3. Compare the lists diff -u list.real list.snap

rsync can make a file list when called with just one argument:

$ cd /tmp
$ rsync -r .
drwxrwxrwt         612 2012/01/19 10:43:15 .
-rwxr-xr-x        9444 2012/01/19 08:43:13 foo

mtree can make a file which it can check for changes against life filesystem:

$ cd /tmp/tree
$ mtree -c > /tmp/list.mtree
$ touch bar.c
$ echo '/* comment */' >> foo.c
$ mtree < /tmp/list.mtree
$ mtree < /tmp/desc 
. changed
    modification time expected Thu Jan 19 11:18:11 2012 found Thu Jan 19 11:20:46 2012
bar.c extra
foo.c changed
    size expected 1350 found 1364
    modification time expected Thu Jan 19 11:18:11 2012 found Thu Jan 19 11:21:26 2012
4
  • that was something i was thinking of, but isn't there a faster and maybe more sophisticated solution? can't we directly ask LVM?
    – JMW
    Jan 19, 2012 at 9:24
  • 1
    @JMW LVM is a pure volume manager that hosts binary chunks which you may format to any file system you like. LVM doesn't know about files at all. There are filesystems that have their snapshots though.
    – jkj
    Jan 19, 2012 at 9:31
  • And there is ZFS that does both volume management and filesystem stuff :)
    – jkj
    Jan 19, 2012 at 9:32
  • ok, good to know, that there is no faster method.
    – JMW
    Jan 19, 2012 at 9:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .