Re: broken repo after power cut

2015-06-22 Thread Theodore Ts'o
On Mon, Jun 22, 2015 at 01:19:59PM +0200, Richard Weinberger wrote: > > > The bottome lins is that if you care about files being written, you > > need to use fsync(). Should git use fsync() by default? Well, if you > > are willing to accept that if your system crashes within a second or > > so o

Re: broken repo after power cut

2015-06-22 Thread Richard Weinberger
Am 22.06.2015 um 02:35 schrieb Theodore Ts'o: > On Sun, Jun 21, 2015 at 03:07:41PM +0200, Richard Weinberger wrote: > >>> I was then shocked to learn that ext4 apparently has a default >>> setting that allows it to truncate files upon power failure >>> (something about a full journal vs a fast jou

Re: broken repo after power cut

2015-06-21 Thread Theodore Ts'o
On Sun, Jun 21, 2015 at 03:07:41PM +0200, Richard Weinberger wrote: > > I was then shocked to learn that ext4 apparently has a default > > setting that allows it to truncate files upon power failure > > (something about a full journal vs a fast journal or some such) s/ext4/all modern file systems

Re: broken repo after power cut

2015-06-21 Thread Richard Weinberger
Am 21.06.2015 um 15:59 schrieb Christoph Hellwig: > On Sun, Jun 21, 2015 at 03:07:41PM +0200, Richard Weinberger wrote: To me it seems like git was creating a new object and got interrupted before fsync/fdatasync'ing it. As the object was referenced before syncing the data to disk th

Re: broken repo after power cut

2015-06-21 Thread Christoph Hellwig
On Sun, Jun 21, 2015 at 03:07:41PM +0200, Richard Weinberger wrote: > >> To me it seems like git was creating a new object and got interrupted > >> before fsync/fdatasync'ing it. > >> As the object was referenced before syncing the data to disk the repo > >> broke. Git doesn't fsync by default, a

Re: broken repo after power cut

2015-06-21 Thread Richard Weinberger
Hi Johannes, [CC'ing linux-fsdevel and tytso] Am 21.06.2015 um 14:28 schrieb Johannes Schindelin: > Hi Richard, > > On 2015-06-20 21:40, Richard Weinberger wrote: > >> Yesterday our git server faced a power cut and a git repository broke. >> The server is running a ext4 filesystem on top of Lin

Re: broken repo after power cut

2015-06-21 Thread Johannes Schindelin
Hi Richard, On 2015-06-20 21:40, Richard Weinberger wrote: > Yesterday our git server faced a power cut and a git repository broke. > The server is running a ext4 filesystem on top of Linux 3.16 (stable > from openSUSE) and git 2.1.4. > We had a backup, so no data was lost but I really would like

broken repo after power cut

2015-06-20 Thread Richard Weinberger
Hi! Yesterday our git server faced a power cut and a git repository broke. The server is running a ext4 filesystem on top of Linux 3.16 (stable from openSUSE) and git 2.1.4. We had a backup, so no data was lost but I really would like to figure out what happened. This is the output of git fsck: