Live data from Hacker News

Who Needs Git When You Have ZFS?

zef.me

21–30 of 148 posts

Re: Who Needs Git When You Have ZFS?

#21
post #7

ZFS is excellent for database development! Create a snapshot before you try something that mess up your data and instantly restore it! If your development database is a few gigabytes, this will save you a lot of time.

Except you'll lose all the data since you created the snapshot... You've been able to do this for years on Linux with LVM anyway.

> Except you'll lose all the data since you created the snapshot...

Yes, but that's the point

You're right about LVM though

Re: Who Needs Git When You Have ZFS?

#23
post #7

ZFS is excellent for database development! Create a snapshot before you try something that mess up your data and instantly restore it! If your development database is a few gigabytes, this will save you a lot of time.

Except you'll lose all the data since you created the snapshot... You've been able to do this for years on Linux with LVM anyway.

That's the point. If you mess up your db doing something you want to lose all the data since you created the snapshot.

>You've been able to do this for years on Linux with LVM anyway.

What's the point of saying this in that tone? I could achieve the same goal in a number of different ways - that doesn't make any of those methods invalid because another one exists.

Re: Who Needs Git When You Have ZFS?

#24
post #11

Earlier quoted context omitted.

Yes, if they have ZFS too, it is basically snapshot, send & receive. Or you can clone it and rsync it to them. Do not try to snapshot a running database though. Before you execute the snapshot you should make sure everything is flushed to disk. For example with PostgreSQL you need to create a checkpoint before the snapshot, so you write: SELECT pg_start_backup('prepare_my_snapshot'); AND when the snapshot is done: SE…

> Do not try to snapshot a running database though. Before you execute the snapshot you should make sure everything is flushed to disk. Is a database (or anything else) really supposed to behave that way? Shouldn't every state along the way be possible to resume from? In particular, shouldn't database transactions take care of this?

If the snapshot is atomic as it should be, then yes.

Re: Who Needs Git When You Have ZFS?

#25
post #11
post #10

Earlier quoted context omitted.

Sounds great. Can you also duplicate versions of a database to coworkers on the same machine without much cost?

Yes, if they have ZFS too, it is basically snapshot, send & receive. Or you can clone it and rsync it to them. Do not try to snapshot a running database though. Before you execute the snapshot you should make sure everything is flushed to disk. For example with PostgreSQL you need to create a checkpoint before the snapshot, so you write: SELECT pg_start_backup('prepare_my_snapshot'); AND when the snapshot is done: SE…

It's too bad Unix/Linux doesn't offer something like Windows' VSS API, where the operating system can inform registered applications or services of an impending backup operation.

Re: Who Needs Git When You Have ZFS?

#26
To play devil's advocate, sometimes Git is abused to store things that aren't code, and ZFS (or similar) might actually be a better fit in those situations.

Somebody further down mentions art assets. Also potentially relevant are document repositories.

ZFS isn't very easy to use for a lay person, but that's really only a "Time Machine"-esque front-end away.

Re: Who Needs Git When You Have ZFS?

#28

> Who needs Git? > Notably missing is support for merging So, it's almost like a car except it's missing its wheels No, it's not like Git

That and the rather obvious 'sudo' in front of all the commands. I mean, it's a cool tool; I use it on my NAS (particularly like the ECC mode instead of dumb RAID), but the git-equivalence aspect looks a little bit like a flamebait ;-)

    zfs allow zef mount,create,destroy,snapshot,rollback,diff,clone,send,receive mypool/projects
Now he doesn't need sudo in front of most of them.

Re: Who Needs Git When You Have ZFS?

#29
post #7

ZFS is excellent for database development! Create a snapshot before you try something that mess up your data and instantly restore it! If your development database is a few gigabytes, this will save you a lot of time.

Traditionally, DB engines avoid FS specific features like the plague.

Re: Who Needs Git When You Have ZFS?

#30
post #7

ZFS is excellent for database development! Create a snapshot before you try something that mess up your data and instantly restore it! If your development database is a few gigabytes, this will save you a lot of time.

Except you'll lose all the data since you created the snapshot... You've been able to do this for years on Linux with LVM anyway.

I don't think you read the comment thoroughly. This is the point.

Also, the discussion is centered around ZFS, there's no reason to bring up LVM. Everyone knows there's many ways to skin this cat and it doesn't make anyone appear any smarter because they know of one way.

Post reply on HN