Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
LVM Snapshots with xfs
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
BigBeer
n00b
n00b


Joined: 18 Oct 2004
Posts: 40

PostPosted: Thu Feb 02, 2006 9:46 pm    Post subject: LVM Snapshots with xfs Reply with quote

I'm trying to do LVM snapshots with an xfs filesystem.

I do the following:

Code:

xfs_freeze -f /mnt/dir
lvcreate -L 1G -s -n snapshot1 /dev/vg1/lv-to-snapshot


It just hangs.. no output at all, can't kill the pid for lvcreate.


If I do a lvscan it hangs, but I can ctl-c out and I get this:

Code:

......
ACTIVE      '/dev/vg2/otherlvs' [size] inherit
CTL-c detected: giving up waiting for lock
/var/lock/lvm/V_vg1: flock failed: Interrupted system call
Can't lock vg1: skipping




Yes I have snapshoting enabled in kernel.
I am running gentoo-sources 2.6.15-r1

Am I missing something to taking the snapshots correctly?
Back to top
View user's profile Send private message
BigBeer
n00b
n00b


Joined: 18 Oct 2004
Posts: 40

PostPosted: Fri Feb 03, 2006 3:16 pm    Post subject: Reply with quote

I went to ~x86 for lvm2 to see if I could get some love.

Still nothing with lvm2-2.01.14


I guess I'll start playing with different kernels/fs next.
Back to top
View user's profile Send private message
MrTV
n00b
n00b


Joined: 08 Jun 2002
Posts: 34

PostPosted: Mon Aug 14, 2006 7:30 am    Post subject: Reply with quote

Hi,

I am having the same problem on two separate the systems. They become totally locked, even hitting ctrl-c doesn't do anything.

system 1:
2.6.16-gentoo-r7
sys-fs/lvm2-2.02.06

system 2:
2.6.15-gentoo-r1
sys-fs/lvm2-2.01.09

I am going to update to the latest kernel on one system now to see if that helps. If you have any further experiences please post them.

TIA
Timo
Back to top
View user's profile Send private message
Janne Pikkarainen
Veteran
Veteran


Joined: 29 Jul 2003
Posts: 1143
Location: Helsinki, Finland

PostPosted: Mon Aug 14, 2006 8:07 am    Post subject: Reply with quote

xfs + lvm2 + snapshots have been a shaky ground quite a long time. This bug is still in REOPENED state:

http://oss.sgi.com/bugzilla/show_bug.cgi?id=400

I don't know if it's actually fixed somewhere or not: anyway it seems that the bug is somehow related to LVM2 userland tools.
_________________
Yes, I'm the man. Now it's your turn to decide if I meant "Yes, I'm the male." or "Yes, I am the Unix Manual Page.".
Back to top
View user's profile Send private message
Sachankara
l33t
l33t


Joined: 11 Jun 2004
Posts: 696
Location: Stockholm, Sweden

PostPosted: Mon Aug 14, 2006 8:25 am    Post subject: Re: LVM Snapshots with xfs Reply with quote

Unless you use LVM1, that is not the way you're supposed to do it (with XFS). This is how:

Code:
$ lvcreate -L512M -s -n home-backup /dev/volumegroup/home
$ mkdir /mnt/home-backup
$ mount /dev/volumegroup/home-backup /mnt/home-backup -o nouuid,ro
(Make the backup from /mnt/home-backup after this step)

$ umount /mnt/home-backup
$ lvremove /dev/volumegroup/home-backup
(When you've done the backup)


Notice that xfs_freeze is not used with LVM2 because it handles that itself. The mount options are also worth noticing. :)
_________________
Gentoo Hardened Linux 2.6.21 + svorak (Swedish dvorak)
Back to top
View user's profile Send private message
MrTV
n00b
n00b


Joined: 08 Jun 2002
Posts: 34

PostPosted: Mon Aug 14, 2006 9:32 am    Post subject: Reply with quote

Actually that was the way I was trying to do my backups before.

I am doing md5sum checks on all files to verify my backup. I found that some files fail the test (8 of more than 70000). Besides the md5sum checks, I compared the size of the files and it matches. cmp told me that the difference is only in the first byte. So I thought it could be a file system caching issue. First I stopped the services that write to those files. No difference. Then I inserted a "sync" command in my backup script just before doing the lvm snapshot and still became 2 errors. May sound strange to stop services and to do syncing while lvm snapshots shouldn't be affected by that.

Somehow I found xfs_freeze and the man page sounds promising. Unfortunately I experienced those system lock.

Btw, tried it again with kernel 2.6.17-gentoo-r4, sys-fs/xfsprogs-2.7.11, sys-fs/lvm2-2.02.06. Still the same.

Timo
Back to top
View user's profile Send private message
MrTV
n00b
n00b


Joined: 08 Jun 2002
Posts: 34

PostPosted: Wed Aug 16, 2006 9:53 am    Post subject: Reply with quote

Hi,

I recompiled the whole system (with gcc-3.4.6-r1 and glibc-2.3.6-r4) and installed a newer lvm2 version (lvm2-2.02.07).

This time I opened two shells, one for entering the xfs_freeze commands and one for lvcreate. lvcreate -s hangs until I unfreeze the file system again. So the problem remains. It seems like the file system is "too frozen" that lvcreate could read it. Just like described in the bug's comment from above. But should lvm be independent of the file system? It is operating one layer beneath...
Back to top
View user's profile Send private message
MrTV
n00b
n00b


Joined: 08 Jun 2002
Posts: 34

PostPosted: Wed Aug 16, 2006 4:17 pm    Post subject: Reply with quote

Sachankara,

you were right. LVM2 is said to be used without xfs_freeze. I found that the lvm howto was changed explicitly for that. But that doesn't explain the md5sum errors I get when comparing my backup files. :(
Back to top
View user's profile Send private message
Sachankara
l33t
l33t


Joined: 11 Jun 2004
Posts: 696
Location: Stockholm, Sweden

PostPosted: Wed Aug 16, 2006 6:12 pm    Post subject: Reply with quote

MrTV wrote:
Sachankara,

you were right. LVM2 is said to be used without xfs_freeze. I found that the lvm howto was changed explicitly for that. But that doesn't explain the md5sum errors I get when comparing my backup files. :(
Did you use the right mount options (ro and nouuid) and did you perform the backup from the newly mounted partition and not the usual one?
_________________
Gentoo Hardened Linux 2.6.21 + svorak (Swedish dvorak)
Back to top
View user's profile Send private message
MrTV
n00b
n00b


Joined: 08 Jun 2002
Posts: 34

PostPosted: Thu Aug 17, 2006 11:20 am    Post subject: Reply with quote

Sachankara wrote:
Did you use the right mount options (ro and nouuid) and did you perform the backup from the newly mounted partition and not the usual one?


Yes, I mounted ro,nouuid and yes I rsynced from the right partition.
Back to top
View user's profile Send private message
Sachankara
l33t
l33t


Joined: 11 Jun 2004
Posts: 696
Location: Stockholm, Sweden

PostPosted: Sat Aug 26, 2006 9:35 am    Post subject: Reply with quote

MrTV wrote:
Sachankara wrote:
Did you use the right mount options (ro and nouuid) and did you perform the backup from the newly mounted partition and not the usual one?


Yes, I mounted ro,nouuid and yes I rsynced from the right partition.
Late answer: That's strange. It workes for me. For example:
Code:
$ lvcreate -L1G -s -nhome-backup /dev/vg1/home
$ mount /dev/vg1/home-backup /mnt/temp

$ cd /
$ find /mnt/temp/ -type f -exec md5sum {} >> /tmp/md5sum1 \;

(Use the computer for a couple of hours here)

$ md5sum -c /tmp/md5sum1 | grep -v OK
(No changes in the snapshot)

$ find /mnt/temp/ -type f -exec md5sum {} >> /tmp/md5sum2 \;;
$ diff -u /tmp/md5sum1 /tmp/md5sum2
(No changes reported)

_________________
Gentoo Hardened Linux 2.6.21 + svorak (Swedish dvorak)
Back to top
View user's profile Send private message
MrTV
n00b
n00b


Joined: 08 Jun 2002
Posts: 34

PostPosted: Mon Aug 28, 2006 4:54 pm    Post subject: Reply with quote

Sachankara wrote:
Late answer: That's strange. It workes for me. For example:
Code:
$ lvcreate -L1G -s -nhome-backup /dev/vg1/home
$ mount /dev/vg1/home-backup /mnt/temp

$ cd /
$ find /mnt/temp/ -type f -exec md5sum {} >> /tmp/md5sum1 \;

(Use the computer for a couple of hours here)

$ md5sum -c /tmp/md5sum1 | grep -v OK
(No changes in the snapshot)

$ find /mnt/temp/ -type f -exec md5sum {} >> /tmp/md5sum2 \;;
$ diff -u /tmp/md5sum1 /tmp/md5sum2
(No changes reported)


You are doing the md5sum check against the same data. This is not what I do. What I do is more like so:
Code:
$ lvcreate -L1G -s -nhome-backup /dev/vg1/home
$ mount /dev/vg1/home-backup /mnt/temp

$ rsync -aHRx --delete --delete-excluded --numeric-ids /mnt/temp/ /mnt/backup/

$ cd /mnt/temp
$ find ./ -type f -exec md5sum {} >> /tmp/md5sum1 \;

$ cd /mnt/backup
$ md5sum -c /tmp/md5sum1 | grep -v OK


Errors are not reported (or at least I haven't seen any yet) if I do mkfs.xfs on the /mnt/backup partition just before the first rsync. Errors show up after say the 2nd or 3rd time I do the rsync. I must add that I do rsyncs according to http://www.mikerubel.org/computers/rsync_snapshots/. And the errors become fewer, if I do sync; sync; sync right before I do lvcreate -s. It feels like if the file system was maiden-like, it is ok. And if the file system becomes more and more used, the errors show up. Just like a dirty buffer, that wasn't written cleanly to the disk.
Back to top
View user's profile Send private message
Sachankara
l33t
l33t


Joined: 11 Jun 2004
Posts: 696
Location: Stockholm, Sweden

PostPosted: Mon Aug 28, 2006 5:21 pm    Post subject: Reply with quote

You missed the fact that I did one md5sum control first, then another several hours later and then compared the two md5sums. If the mounted snapshot wouldn't have contained exactly the same files as before, one would have noticed it.
_________________
Gentoo Hardened Linux 2.6.21 + svorak (Swedish dvorak)
Back to top
View user's profile Send private message
MrTV
n00b
n00b


Joined: 08 Jun 2002
Posts: 34

PostPosted: Mon Aug 28, 2006 5:48 pm    Post subject: Reply with quote

Sachankara wrote:
You missed the fact that I did one md5sum control first, then another several hours later and then compared the two md5sums. If the mounted snapshot wouldn't have contained exactly the same files as before, one would have noticed it.


I noticed that. But you still do the check against the same data/partition. Of course one could assume that the change could also happen there. But as it didn't (as you found out) thats not the problem.

The problem is, that the rsynced data on /mnt/backup are not the same as on /mnt/temp. but they should be! You would assume that rsync provides an exact copy of the source, don't you?
Back to top
View user's profile Send private message
Sachankara
l33t
l33t


Joined: 11 Jun 2004
Posts: 696
Location: Stockholm, Sweden

PostPosted: Mon Aug 28, 2006 6:30 pm    Post subject: Reply with quote

MrTV wrote:
The problem is, that the rsynced data on /mnt/backup are not the same as on /mnt/temp. but they should be! You would assume that rsync provides an exact copy of the source, don't you?
Yes, one would, but if you try the same thing as I did and it works the same way as it did for me, then you can rule out the snapshot as being the problem. Perhaps the problem lies in rsync or in the partition you sync to? Perhaps rsync "works in mysterious ways" on XFS? :/
_________________
Gentoo Hardened Linux 2.6.21 + svorak (Swedish dvorak)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum