Fsync failed

3,609 views
Skip to first unread message

googler

unread,
Jul 22, 2008, 1:17:45 AM7/22/08
to vim_use
I am seeing this error message when trying to save a file in gvim:
"E667: Fsync failed". Anyone knows what is causing this and how to fix
this? I googled a bit and found somebody saying this is caused by
insufficient disk space. I have 94% disk full, so there is still space
and the file is also small, so I guess that might not be the reason.
This is really annoying as I can't save my work. Thanks for any
suggestion.

Ben Schmidt

unread,
Jul 22, 2008, 1:39:27 AM7/22/08
to vim...@googlegroups.com

It still might be a disk space issue. Some OSes reserve the last bit of
space for the system/root only. I wouldn't have thought it was a whole
5% though.

I presume you've tried saving the file with a different name (using an
argument to :w or the :saveas command)?

Vim does have 'swapsync' and 'fsync' options you can investigate (:help
'swapsync' and :help 'fsync') but if it hasn't always happened, I expect
something is truly wrong, and fiddling those options may just give you a
false sense of security by avoiding the issue rather than actually
letting you secure your data.

Ben.


Ben Schmidt

unread,
Jul 22, 2008, 1:42:29 AM7/22/08
to vim...@googlegroups.com

Also fiddling with the 'writebackup' and 'backup' options can help save
a file if the disk is almost full, but of course it's more dangerous if
you don't use/keep backups.

:help 'backup'
:help 'writebackup'
:help :w_f
:help :saveas

Ben.


Dominique Pelle

unread,
Jul 22, 2008, 3:11:40 AM7/22/08
to vim...@googlegroups.com


How about adding the value of errno or strerror(errno) in the
error message? It would help diagnose such errors. There
could be several reasons such as file system full, quota exceeded,
invalid file descriptor, etc.

-- Dominique

Ben Schmidt

unread,
Jul 22, 2008, 5:10:15 AM7/22/08
to vim...@googlegroups.com, Bram Moolenaar

Good call, Dominique. I was thinking the same kinds of things but didn't
think to look to errno.

Attached is a patch that does this for Bram's consideration.

Ben.

write_errno.patch

googler

unread,
Jul 22, 2008, 8:40:07 AM7/22/08
to vim_use


On Jul 22, 4:10 am, Ben Schmidt <mail_ben_schm...@yahoo.com.au> wrote:
> Dominique Pelle wrote:
>  write_errno.patch
> 2KDownload- Hide quoted text -
>
> - Show quoted text -

How do I get the errno?
Sorry, I didn't understand how I should be using the patch file you
attached. Am I supposed to recompile vim using the code (diff) you
sent? If that is the case, then that won't be possible to do for me.

Also, I deleted several directories in order to free up space, but
keep seeing this problem. Had never seen this problem before. I am
trying to save the original file using ":w<enter>" (that is, not with
a different name).

Ben Schmidt

unread,
Jul 22, 2008, 9:02:16 AM7/22/08
to vim...@googlegroups.com

Yes, the patch is a patch to the Vim source code that would add the
errno to the error message you are seeing if Vim were recompiled. I
didn't expect it to help in your situation, but it may help if/when this
kind of problem occurs again.

> Also, I deleted several directories in order to free up space, but
> keep seeing this problem. Had never seen this problem before. I am
> trying to save the original file using ":w<enter>" (that is, not with
> a different name).

Is this just happening for one file you have open, or for multiple
files? Can you try saving the file with a different name and if that
doesn't work, try a completely different directory as well? Maybe the
directory the file was originally in has moved or become corrupted or
something. It seems unlikely, as fsync is failing, not open, but
still... Or perhaps you can just get your data onto disk with something
like

:w !cat > somefile

then verify with some other tool that somefile does contain your data
before abandoning it in Vim.

Is this happening for just one file, or every file you edit, or what?

Could you send us the output of Vim's :version command? You can
hopefully capture it with

:redir > someotherfile
:version
:redir END

and then send us the contents of someotherfile.

Cheers,

Ben.


googler

unread,
Jul 23, 2008, 2:07:47 AM7/23/08
to vim_use


On Jul 22, 8:02 am, Ben Schmidt <mail_ben_schm...@yahoo.com.au> wrote:
> googler wrote:
> > On Jul 22, 4:10 am, Ben Schmidt <mail_ben_schm...@yahoo.com.au> wrote:
> >> Dominique Pelle wrote:
> >>> On Tue, Jul 22, 2008 at 7:17 AM, googler <pinaki_...@yahoo.com> wrote:
> >>>> I am seeing this error message when trying to save a file in gvim:
> >>>> "E667: Fsync failed". Anyone knows what is causing this and how to fix
> >>>> this? I googled a bit and found somebody saying this is caused by
> >>>> insufficient disk space. I have 94% disk full, so there is still space
> >>>> and the file is also small, so I guess that might not be the reason.
> >>>> This is really annoying as I can't save my work. Thanks for any
> >>>> suggestion.

<<< snip >>>

> Yes, the patch is a patch to the Vim source code that would add the
> errno to the error message you are seeing if Vim were recompiled. I
> didn't expect it to help in your situation, but it may help if/when this
> kind of problem occurs again.
>
> > Also, I deleted several directories in order to free up space, but
> > keep seeing this problem. Had never seen this problem before. I am
> > trying to save the original file using ":w<enter>" (that is, not with
> > a different name).
>
> Is this just happening for one file you have open, or for multiple
> files? Can you try saving the file with a different name and if that
> doesn't work, try a completely different directory as well? Maybe the
> directory the file was originally in has moved or become corrupted or
> something. It seems unlikely, as fsync is failing, not open, but
> still... Or perhaps you can just get your data onto disk with something
> like
>
> :w !cat > somefile
>
> then verify with some other tool that somefile does contain your data
> before abandoning it in Vim.
>
> Is this happening for just one file, or every file you edit, or what?

Hello. This problem seems to be gone. Suddenly. I didn't do anything
to fix it though. It was happening for the files (more than one) in a
particular directory. I was trying to experiment a little. I saw that
I could create a very small file (two words), but when I added 200
more words in it and tried to save it, it gave the same error. I don't
know if the actual problem is saving a file which is already existing
(because I could save it for the first time during its creation) or is
it 200 additional words that I wrote (although the disk was only 93%
full). Now that the problem is gone, I checked the disk usage and it
is actually more now (96%). If that is any indication, this may not be
due to insufficient disk space. Thanks.

>
> Could you send us the output of Vim's :version command? You can
> hopefully capture it with
>
> :redir > someotherfile
> :version
> :redir END
>
> and then send us the contents of someotherfile.
>
> Cheers,
>
> Ben

:ver
VIM - Vi IMproved 7.0 (2006 May 7, compiled Aug 24 2006 13:31:26)
Compiled by root-dn@lca-659
Normal version with GTK2 GUI. Features included (+) or not (-):
-arabic +autocmd +balloon_eval +browse +builtin_terms +byte_offset
+cindent +clientserver +clipboard +cmdline_compl
+cmdline_hist +cmdline_info +comments +cryptv -cscope +cursorshape
+dialog_con_gui +diff +digraphs +dnd -ebcdic -emacs_tags
+eval +ex_extra +extra_search -farsi +file_in_path +find_in_path
+folding -footer +fork() -gettext -hangul_input +iconv
+insert_expand +jumplist -keymap -langmap +libcall +linebreak
+lispindent +listcmds +localmap +menu +mksession
+modify_fname +mouse +mouseshape -mouse_dec +mouse_gpm -mouse_jsbterm -
mouse_netterm +mouse_xterm +multi_byte +multi_lang
-mzscheme +netbeans_intg -osfiletype +path_extra -perl +postscript
+printer -profile -python +quickfix +reltime -rightleft
-ruby +scrollbind +signs +smartindent -sniff +statusline -sun_workshop
+syntax +tag_binary +tag_old_static -tag_any_white
-tcl +terminfo +termresponse +textobjects +title +toolbar
+user_commands +vertsplit +virtualedit +visual +visualextra
+viminfo +vreplace +wildignore +wildmenu +windows +writebackup +X11 -
xfontset +xim +xsmp_interact +xterm_clipboard
-xterm_save
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "$VIM/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
system menu file: "$VIMRUNTIME/menu.vim"
fall-back for $VIM: "/usr/local/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -I/usr/
include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/i
nclude/atk-1.0 -I/usr/include/pango-1.0 -I/usr/X11R6/include -I/usr/
include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib64/g
lib-2.0/include -g -O2 -I/usr/X11R6/include
Linking: gcc -L/usr/X11R6/lib64 -L/usr/local/lib -o vim -Wl,--
export-dynamic -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgd
k_pixbuf-2.0 -lm -lpangoxft-1.0 -lpangox-1.0 -lpango-1.0 -lgobject-2.0
-lgmodule-2.0 -lglib-2.0 -lXt -lncurses -lacl -lgpm

Ben Schmidt

unread,
Jul 23, 2008, 4:59:55 AM7/23/08
to vim...@googlegroups.com
> Hello. This problem seems to be gone. Suddenly. I didn't do anything
> to fix it though. It was happening for the files (more than one) in a
> particular directory. I was trying to experiment a little. I saw that
> I could create a very small file (two words), but when I added 200
> more words in it and tried to save it, it gave the same error. I don't
> know if the actual problem is saving a file which is already existing
> (because I could save it for the first time during its creation) or is
> it 200 additional words that I wrote (although the disk was only 93%
> full). Now that the problem is gone, I checked the disk usage and it
> is actually more now (96%). If that is any indication, this may not be
> due to insufficient disk space. Thanks.

Mmm. Sounds like something funny has been going on with your OS or disk.
I can think of a couple of reasons you could see symptoms like you
describe, but they're a bit too technical and vague to bother
explaining, particularly as they would only be explanations, not
solutions.

I'd recommend a full fsck (i.e. not just the standard journal check)
though. That might just iron things out.

Ben.


Tony Mechelynck

unread,
Jul 28, 2008, 9:54:35 AM7/28/08
to vim...@googlegroups.com

Even if it's not Vim which does it, sooner or later _every_ HD will
prove too small, and it sounds like you (googler) are dangerously
skirting that wall now.

I guess the only medium-range solution is to rack your pocket bottoms
and/or break your piggy bank for the price of a new and bigger disk ;-).
A short-term workaround (but not a solution) might be to search your
drive for large files which you don't need and can safely delete --
delete forever, not just move to trash. Or maybe just emptying the trash
might already give you some "breathing room", so to speak. Try to delete
only files which you know about, so you won't haplessly delete something
which is badly needed by the OS but whose name means nothing to you.
There is no really permanent solution for the long term -- other than
starting a new piggy bank for the next drive as soon as you've bought
this one: this is (loosely speaking) what company accountants mean by
"amortization".


Best regards,
Tony.
--
Paul Revere was a tattle-tale

Reply all
Reply to author
Forward
0 new messages