Loading ...
Sorry, an error occurred while loading the content.

Re: Restore file from undo

Expand Messages
  • Vsevolod Velichko
    Hello, Christian, thanks for your answer. Yes, all the files I ve lost were created from scratch, so I suppose, that undofile contains all the file history
    Message 1 of 12 , May 31, 2011
    • 0 Attachment
      Hello,

      Christian, thanks for your answer.
      Yes, all the files I've lost were created from scratch, so I suppose,
      that undofile contains all the file history (undolevels=1000 should be
      sufficient for every file).

      ----
      Best wishes and have a nice day,
      Vsevolod Velichko



      2011/5/31 Christian Brabandt <cblists@...>:
      > That would only work, if you had previously reloaded your whole buffer
      > using :e! and 'undoreload' was set to a negative number (or you file
      > contained less than that number of lines). If you know, the whole
      > file content was previously saved in your undofile and you'd like to
      > try out reloading your changes, let me know. I made a patch, that
      > enables you to force reloading the undo history, which you could try out
      > if you want. But that is not very useful by itself.
      >
      > regards,
      > Christian

      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Christian Brabandt
      ... Ok then here is a patch. It allows to use :rundo! to let vim read in any undo file. You need to create a new empty file with more lines, than your original
      Message 2 of 12 , May 31, 2011
      • 0 Attachment
        On Tue, May 31, 2011 1:50 pm, Vsevolod Velichko wrote:
        > Christian, thanks for your answer.
        > Yes, all the files I've lost were created from scratch, so I suppose,
        > that undofile contains all the file history (undolevels=1000 should be
        > sufficient for every file).

        Ok then here is a patch. It allows to use :rundo! to let vim read in any
        undo file. You need to create a new empty file with more lines, than your
        original file had, e.g. 1000 empty lines. Then do :rundo! original_file.un~
        and you can move through the undo history using g- and g+ or using
        the :earlier :later commands.
        The histwin or gundo plugin may also come useful to see your different
        undo branches.

        regards,
        Christian

        --
        You received this message from the "vim_use" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      • ZyX
        Reply to message «Re: Restore file from undo», sent 15:50:06 31 May 2011, Tuesday ... If files are so small that undolevels=1000 is sufficient, maybe you
        Message 3 of 12 , May 31, 2011
        • 0 Attachment
          Reply to message «Re: Restore file from undo»,
          sent 15:50:06 31 May 2011, Tuesday
          by Vsevolod Velichko:

          > Christian, thanks for your answer.
          > Yes, all the files I've lost were created from scratch, so I suppose,
          > that undofile contains all the file history (undolevels=1000 should be
          > sufficient for every file).
          If files are so small that undolevels=1000 is sufficient, maybe you should
          retype them instead?

          There are additional options: for ext* filesystems you may use extundelete
          application and for every filesystem you may open its device as a file and
          search for parts of the text you still remember. Before doing the latter, ask
          somebody for application that is able to do the job, Vim is not a good option
          for this. I once did something similar with grep.

          And I guess you now know why people use backups. Mercurial+bitbucket.org or
          something similar for your code can also serve for this need.

          Original message:
          > Hello,
          >
          > Christian, thanks for your answer.
          > Yes, all the files I've lost were created from scratch, so I suppose,
          > that undofile contains all the file history (undolevels=1000 should be
          > sufficient for every file).
          >
          > ----
          > Best wishes and have a nice day,
          > Vsevolod Velichko
          >
          > 2011/5/31 Christian Brabandt <cblists@...>:
          > > That would only work, if you had previously reloaded your whole buffer
          > > using :e! and 'undoreload' was set to a negative number (or you file
          > > contained less than that number of lines). If you know, the whole
          > > file content was previously saved in your undofile and you'd like to
          > > try out reloading your changes, let me know. I made a patch, that
          > > enables you to force reloading the undo history, which you could try out
          > > if you want. But that is not very useful by itself.
          > >
          > > regards,
          > > Christian
        • Vsevolod Velichko
          ZyX, less than 1000 undolevels in each file, but files more than one :) The idea of grepping fs was the first one, but all the day (before I found that the
          Message 4 of 12 , May 31, 2011
          • 0 Attachment
            ZyX,
            less than 1000 undolevels in each file, but files more than one :)
            The idea of grepping fs was the first one, but all the day (before I
            found that the code has been deleted) I had filled my hdd with the
            enormous dumps, so that there is no chance, that code is still placed
            somewhere in the free space.
            And, yes, the code was placed in the VCS working dir, just not
            commited&pushed yet.

            Christian,
            thanks for your patch.
            Unfortunately, it wasn't fully helpful, but I've recovered a lot of data.
            Thanks for your help!

            ----
            Best wishes and have a nice day,
            Vsevolod Velichko



            2011/5/31 ZyX <zyx.vim@...>:
            > If files are so small that undolevels=1000 is sufficient, maybe you should
            > retype them instead?

            --
            You received this message from the "vim_use" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php
          • Christian Brabandt
            Hi Vsevolod! ... even if less then 1000 undolevels, it might still be valuable... ... I thought so. But even if it helped only a little bit, it s better than
            Message 5 of 12 , May 31, 2011
            • 0 Attachment
              Hi Vsevolod!

              On Di, 31 Mai 2011, Vsevolod Velichko wrote:

              > less than 1000 undolevels in each file, but files more than one :)

              even if less then 1000 undolevels, it might still be valuable...

              > The idea of grepping fs was the first one, but all the day (before I
              > found that the code has been deleted) I had filled my hdd with the
              > enormous dumps, so that there is no chance, that code is still placed
              > somewhere in the free space.
              > And, yes, the code was placed in the VCS working dir, just not
              > commited&pushed yet.
              >
              > Christian,
              > thanks for your patch.
              > Unfortunately, it wasn't fully helpful, but I've recovered a lot of data.

              I thought so. But even if it helped only a little bit, it's better than
              nothing.

              regards,
              Christian

              --
              You received this message from the "vim_use" maillist.
              Do not top-post! Type your reply below the text you are replying to.
              For more information, visit http://www.vim.org/maillist.php
            • Christian Brabandt
              Hi ZyX! ... Hm, if I remember correctly, the inodes are zeroed out, when a file is deleted for ext3 and ext4. That s why extundelete only works correctly with
              Message 6 of 12 , May 31, 2011
              • 0 Attachment
                Hi ZyX!

                On Di, 31 Mai 2011, ZyX wrote:

                > There are additional options: for ext* filesystems you may use
                > extundelete application and for every filesystem you may open its
                > device as a file and search for parts of the text you still remember.
                > Before doing the latter, ask somebody for application that is able to
                > do the job, Vim is not a good option for this. I once did something
                > similar with grep.

                Hm, if I remember correctly, the inodes are zeroed out, when a file is
                deleted for ext3 and ext4. That's why extundelete only works correctly
                with ext2.


                regards,
                Christian

                --
                You received this message from the "vim_use" maillist.
                Do not top-post! Type your reply below the text you are replying to.
                For more information, visit http://www.vim.org/maillist.php
              • Vsevolod Velichko
                ... Not exactly. There is even utility ext3grep[1] written by Carlo Wood, which performs all the lookup for you. It can help in some cases. [1]
                Message 7 of 12 , May 31, 2011
                • 0 Attachment
                  2011/5/31 Christian Brabandt <cblists@...>:
                  > Hm, if I remember correctly, the inodes are zeroed out, when a file is
                  > deleted for ext3 and ext4. That's why extundelete only works correctly
                  > with ext2.

                  Not exactly.

                  There is even utility ext3grep[1] written by Carlo Wood, which
                  performs all the lookup for you. It can help in some cases.

                  [1] http://code.google.com/p/ext3grep/

                  ----
                  Best wishes and have a nice day,
                  Vsevolod Velichko

                  --
                  You received this message from the "vim_use" maillist.
                  Do not top-post! Type your reply below the text you are replying to.
                  For more information, visit http://www.vim.org/maillist.php
                • ZyX
                  Reply to message «Re: Restore file from undo», sent 23:17:12 31 May 2011, Tuesday ... According to description of sys-fs/extundelete package it works only
                  Message 8 of 12 , May 31, 2011
                  • 0 Attachment
                    Reply to message «Re: Restore file from undo»,
                    sent 23:17:12 31 May 2011, Tuesday
                    by Christian Brabandt:

                    > Hm, if I remember correctly, the inodes are zeroed out, when a file is
                    > deleted for ext3 and ext4. That's why extundelete only works correctly
                    > with ext2.
                    According to description of sys-fs/extundelete package it works only for ext3
                    and ext4, not for ext2 filesystem. I don't know anything about zeroing inodes
                    and I use neither extundelete nor ext* filesystems.

                    Original message:
                    > Hi ZyX!
                    >
                    > On Di, 31 Mai 2011, ZyX wrote:
                    > > There are additional options: for ext* filesystems you may use
                    > > extundelete application and for every filesystem you may open its
                    > > device as a file and search for parts of the text you still remember.
                    > > Before doing the latter, ask somebody for application that is able to
                    > > do the job, Vim is not a good option for this. I once did something
                    > > similar with grep.
                    >
                    > Hm, if I remember correctly, the inodes are zeroed out, when a file is
                    > deleted for ext3 and ext4. That's why extundelete only works correctly
                    > with ext2.
                    >
                    >
                    > regards,
                    > Christian
                  • Bram Moolenaar
                    ... This is an interesting idea. Not only when the file was deleted, but also when it was changed by another program. Perhaps we can have a starting point
                    Message 9 of 12 , May 31, 2011
                    • 0 Attachment
                      Christian Brabandt wrote:

                      > On Tue, May 31, 2011 1:50 pm, Vsevolod Velichko wrote:
                      > > Christian, thanks for your answer.
                      > > Yes, all the files I've lost were created from scratch, so I suppose,
                      > > that undofile contains all the file history (undolevels=1000 should be
                      > > sufficient for every file).
                      >
                      > Ok then here is a patch. It allows to use :rundo! to let vim read in any
                      > undo file. You need to create a new empty file with more lines, than your
                      > original file had, e.g. 1000 empty lines. Then do :rundo! original_file.un~
                      > and you can move through the undo history using g- and g+ or using
                      > the :earlier :later commands.
                      > The histwin or gundo plugin may also come useful to see your different
                      > undo branches.

                      This is an interesting idea. Not only when the file was deleted, but
                      also when it was changed by another program.

                      Perhaps we can have a "starting point" marker in the undo file, where
                      the base file is completely empty. From there it's always possible to
                      repeat changes. With some command to do this, perhaps ":undorecover"?

                      When trying to load the undo file and the hash doesn't match, and there
                      is a starting point marker, we could give the user a hint that
                      :undorecover can be used.

                      --
                      I'm writing a book. I've got the page numbers done.

                      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                      /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                      \\\ an exciting new programming language -- http://www.Zimbu.org ///
                      \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

                      --
                      You received this message from the "vim_use" maillist.
                      Do not top-post! Type your reply below the text you are replying to.
                      For more information, visit http://www.vim.org/maillist.php
                    • Christian Brabandt
                      ... Thanks. I was refering to that part from the ext3 faq©ö: ,---- ... `---- It seems, this is not entirely correct, as stated in the ext3 undelete
                      Message 10 of 12 , Jun 1, 2011
                      • 0 Attachment
                        On Tue, May 31, 2011 9:35 pm, Vsevolod Velichko wrote:
                        > 2011/5/31 Christian Brabandt <cblists@...>:
                        >> Hm, if I remember correctly, the inodes are zeroed out, when a file is
                        >> deleted for ext3 and ext4. That's why extundelete only works correctly
                        >> with ext2.
                        >
                        > Not exactly.
                        >
                        > There is even utility ext3grep[1] written by Carlo Wood, which
                        > performs all the lookup for you. It can help in some cases.
                        >
                        > [1] http://code.google.com/p/ext3grep/

                        Thanks. I was refering to that part from the ext3 faq易:

                        ,----
                        | Q: How can I recover (undelete) deleted files from my ext3
                        | partition?
                        |
                        | Actually, you can't! This is what one of the developers, Andreas
                        | Dilger, said about it: In order to ensure that ext3 can safely
                        | resume an unlink after a crash, it actually zeros out the block
                        | pointers in the inode, whereas ext2 just marks these blocks as
                        | unused in the block bitmaps and marks the inode as "deleted" and
                        | leaves the block pointers alone.
                        |
                        | Your only hope is to "grep" for parts of your files that have been
                        | deleted and hope for the best.
                        `----

                        It seems, this is not entirely correct, as stated in the ext3 undelete
                        HOWTO昌.

                        extundelete昆, ext3grep昂 and ext3undel⁵ and might be helpful in
                        these cases.

                        That being said, I have no experience with any of these tools and just
                        wanted to add this info to this thread, just in case this might be useful
                        to anybody who stumbles over this thread via google.

                        Links:
                        易)http://batleth.sapienti-sat.org/projects/FAQs/ext3-faq.html
                        昌)http://carlo17.home.xs4all.nl/howto/undelete_ext3.html
                        昆)http://extundelete.sourceforge.net/
                        昂)http://code.google.com/p/ext3grep/
                        ⁵)http://projects.izzysoft.de/trac/ext3undel

                        regards,
                        Christian

                        --
                        You received this message from the "vim_use" maillist.
                        Do not top-post! Type your reply below the text you are replying to.
                        For more information, visit http://www.vim.org/maillist.php
                      Your message has been successfully submitted and would be delivered to recipients shortly.