MySQL + LVM - backup.tar.gz?

5 views
Skip to first unread message

BJ Dierkes

unread,
Aug 21, 2010, 11:32:45 AM8/21/10
to hollan...@googlegroups.com
In watching the new video it is mentioned that 'backup.tar.gz' extracts files into the current dir (meaning there is no prefix directory in the tarbal). I assume there is a reason for that but I was curious if someone could explain why that is. I always find it a treat when I untar something and it borks my cwd with all its contents. ;)

---
derks

Tim Soderstrom

unread,
Aug 21, 2010, 11:35:17 AM8/21/10
to hollan...@googlegroups.com
Heheh. I assume that is to account for different datadir names. Like your data might be called "BJs datadir" and others might call it 'mysql'. If you tar everything up inside then it's a non-issue - you can extract it out into whatever you want. I am not sure as to the full logic here but it follows the conventions of Xtrabackup as well.

> --
> WIKI: http://wiki.hollandbackup.org
> CODE: http://github.com/holland-backup
> UNSUBSCRIBE: holland-deve...@googlegroups.com
>

Andrew Garner

unread,
Aug 21, 2010, 5:31:45 PM8/21/10
to hollan...@googlegroups.com
It's mostly that way because that's how I shuffle around datadirs as a
DBA. As Tim noted, xtrabackup (unsurprisingly) works the same way. I
haven't heard any complaints/comments along these lines from the
current mysql-lvm users, some of whom do restores themselves on a
regular basis. But this is a potential gotcha, I suppose.

~Andy

Tim Soderstrom

unread,
Aug 21, 2010, 5:35:42 PM8/21/10
to hollan...@googlegroups.com
Been thinking of ways to address this. Only thing I can think of it including the entire path in the tarball; or using a standard path when we go to compress it (something similar to how we lay out /var/spool/holland). Perhaps we should add better documentation for this behavior. It's behavior is on the Wiki (and now a video) but maybe something in the example backup-set or something like that.

Tim

Andrew Garner

unread,
Aug 21, 2010, 6:35:10 PM8/21/10
to hollan...@googlegroups.com
No, we shouldn't include the entire path in the tarball :P Using a
"standard path" (whatever that means) isn't going to be a good
solution either. Newer versions of gnu tar let you do
transformations, but that's not very portable. python tarfile lets you
do all kinds of interesting things, but that's not very performant. I
suppose the easiest is to just symlink some base path and use tar
--dereference.

This is a pretty much a non-issue, not even raised by a real user and
really low on my list of priorities. I haven't seen anyone who's
actually used holland/mysql-lvm mention much less complain about this.
I don't think changing behavior in the middle of a release is a very
useful thing to do at any rate.

~Andy

Tim Soderstrom

unread,
Aug 21, 2010, 6:44:25 PM8/21/10
to hollan...@googlegroups.com
I think I was talking about dereferencing. Basically, something like:

# tar -xvzf backup.tar.gz
mysql-datadir/ibdata1
...

Something like that, though I agree it's not something we should do mid-release. I see what BJ is talking about though since I hate when that happens too if I don't know to expect it. I have just gotten used to this method. I think since multiple backup solutions for MySQL do this too that we should be ok. Mostly just opening up friendly discussion around it more than anything else.

BJ Dierkes

unread,
Aug 21, 2010, 8:01:38 PM8/21/10
to hollan...@googlegroups.com

On Aug 21, 2010, at 5:35 PM, Andrew Garner wrote:

> No, we shouldn't include the entire path in the tarball :P

I agree, that would be annoying.


> Using a
> "standard path" (whatever that means) isn't going to be a good
> solution either. Newer versions of gnu tar let you do
> transformations, but that's not very portable. python tarfile lets you
> do all kinds of interesting things, but that's not very performant. I
> suppose the easiest is to just symlink some base path and use tar
> --dereference.
>
> This is a pretty much a non-issue, not even raised by a real user and
> really low on my list of priorities. I haven't seen anyone who's
> actually used holland/mysql-lvm mention much less complain about this.

Until someone does:

cd /var/lib/mysql
tar -zxvf /var/spool/holland/blah/backup.tar.gz


Please correct me if I'm wrong.. but I'd assume that would effectively bork any regular file in the root of the directory (including ibdata, etc), wouldn't it?

---
derks

Andrew Garner

unread,
Aug 21, 2010, 8:19:35 PM8/21/10
to hollan...@googlegroups.com
On Sat, Aug 21, 2010 at 7:01 PM, BJ Dierkes
<wdie...@5dollarwhitebox.org> wrote:
>> This is a pretty much a non-issue, not even raised by a real user and
>> really low on my list of priorities. I haven't seen anyone who's
>> actually used holland/mysql-lvm mention much less complain about this.
>
> Until someone does:
>
> cd /var/lib/mysql
> tar -zxvf /var/spool/holland/blah/backup.tar.gz
>
>
> Please correct me if I'm wrong.. but I'd assume that would effectively bork any regular file in the root of the directory (including ibdata, etc), wouldn't it?

This is pretty uncommon, but the same sort of thing can be done with
with any backup - even with a prefix you can end up overwriting
unintended files. I already noted this is a potential gotcha and
we'll likely address this in a future release. I don't think this is
'critical' or anywhere near as serious as you'd like to make it out to
be. Feel free to contribute code.

~Andy

Tim Soderstrom

unread,
Aug 22, 2010, 12:23:39 AM8/22/10
to hollan...@googlegroups.com
Yes. On the other hand even when storing the path in the tarball, that's still a bad idea unless you already expect to overwrite stuff.

Sent from my iPhone

Reply all
Reply to author
Forward
0 new messages