Fsync failed

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Fsync failed

googler

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.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Fsync failed

Ben Schmidt

googler 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.

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.



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Fsync failed

Ben Schmidt

Ben Schmidt wrote:

> googler 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.
>
> 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.

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.



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Fsync failed

Dominique Pellé
In reply to this post by googler

On Tue, Jul 22, 2008 at 7:17 AM, googler <[hidden email]> 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.


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

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Fsync failed

Ben Schmidt
Dominique Pelle wrote:

> On Tue, Jul 22, 2008 at 7:17 AM, googler <[hidden email]> 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.
>
>
> 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.
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.




--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---


diff -r c0ab5b35d8c4 src/fileio.c
--- a/src/fileio.c Fri Jul 18 22:23:27 2008 +1000
+++ b/src/fileio.c Tue Jul 22 19:09:30 2008 +1000
@@ -2882,6 +2882,7 @@
     long    nchars;
     char_u    *errmsg = NULL;
     char_u    *errnum = NULL;
+    int    errnomsg = 0;
     char_u    *buffer;
     char_u    smallbuf[SMBUFSIZE];
     char_u    *backup_ext;
@@ -4056,6 +4057,8 @@
 #ifdef UNIX
     struct stat st;
 
+    errnomsg = errno;
+
     /* Don't delete the file when it's a hard or symbolic link. */
     if ((!newfile && st_old.st_nlink > 1)
     || (mch_lstat((char *)fname, &st) == 0
@@ -4130,6 +4133,7 @@
  goto fail;
     }
     errmsg = NULL;
+    errnomsg = 0;
 
 #if defined(MACOS_CLASSIC) || defined(WIN3264)
     /* TODO: Is it need for MACOS_X? (Dany) */
@@ -4343,6 +4347,7 @@
     if (p_fs && fsync(fd) != 0 && !device)
     {
  errmsg = (char_u *)_("E667: Fsync failed");
+ errnomsg = errno;
  end = 0;
     }
 #endif
@@ -4382,6 +4387,7 @@
     if (close(fd) != 0)
     {
  errmsg = (char_u *)_("E512: Close failed");
+ errnomsg = errno;
  end = 0;
     }
 
@@ -4683,6 +4689,7 @@
     if (errmsg != NULL)
     {
  int numlen = errnum != NULL ? (int)STRLEN(errnum) : 0;
+ int errnolen = errnomsg != 0 ? 22 : 0;
 
  attr = hl_attr(HLF_E); /* set highlight for error messages */
  msg_add_fname(buf,
@@ -4692,8 +4699,8 @@
  fname
 #endif
      ); /* put file name in IObuff with quotes */
- if (STRLEN(IObuff) + STRLEN(errmsg) + numlen >= IOSIZE)
-    IObuff[IOSIZE - STRLEN(errmsg) - numlen - 1] = NUL;
+ if (STRLEN(IObuff) + STRLEN(errmsg) + numlen + errnolen >= IOSIZE)
+    IObuff[IOSIZE - STRLEN(errmsg) - numlen - errnolen - 1] = NUL;
  /* If the error message has the form "is ...", put the error number in
  * front of the file name. */
  if (errnum != NULL)
@@ -4702,6 +4709,11 @@
     mch_memmove(IObuff, errnum, (size_t)numlen);
  }
  STRCAT(IObuff, errmsg);
+ if (errnomsg != 0)
+ {
+    vim_snprintf(IObuff + STRLEN(IObuff), errnolen,
+    " (errno=%d)", errnomsg);
+ }
  emsg(IObuff);
 
  retval = FAIL;
Reply | Threaded
Open this post in threaded view
|

Re: Fsync failed

googler



On Jul 22, 4:10 am, Ben Schmidt <[hidden email]> wrote:

> Dominique Pelle wrote:
> > On Tue, Jul 22, 2008 at 7:17 AM, googler <[hidden email]> 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.
>
> > 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.
>
> 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
> 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).
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Fsync failed

Ben Schmidt

googler wrote:

> On Jul 22, 4:10 am, Ben Schmidt <[hidden email]> wrote:
>> Dominique Pelle wrote:
>>> On Tue, Jul 22, 2008 at 7:17 AM, googler <[hidden email]> 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.
>>> 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.
>> 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
>> 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.

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.



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Fsync failed

googler



On Jul 22, 8:02 am, Ben Schmidt <[hidden email]> wrote:

> googler wrote:
> > On Jul 22, 4:10 am, Ben Schmidt <[hidden email]> wrote:
> >> Dominique Pelle wrote:
> >>> On Tue, Jul 22, 2008 at 7:17 AM, googler <[hidden email]> 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
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Fsync failed

Ben Schmidt

> 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.



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Fsync failed

Tony Mechelynck
In reply to this post by Ben Schmidt

On 22/07/08 07:42, Ben Schmidt wrote:

> Ben Schmidt wrote:
>> googler 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.
>> 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.
>
> 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.

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

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---