Are released blocks logged in the journal for ext4?












2















Suppose we have a simple case:





  • ext4 file system with journaling

  • a single file named file, which has no other hard links

  • the inode for file has associated with it only 1 data block


My understanding of the deletion process for this specific case is as follows:




  1. log that we will delete file


    1. log that we will reduce inode's ref_cnt by 1

    2. commit

    3. log that because ref_cnt is 0, release inode back to pool

    4. commit

    5. log that because inode is released, release associated block back to pool



  2. commit deletion of file


Among these, how do I get the block number that was released from step 1.5? Is it stored in the journal? If so, how would I access it?



I have been searching for some interface to the filesystem that gives this information. The best I've come to is debugfs -R "logdump -a", but I'm not sure how to move forward from there.



NOTE: I understand that there are tools like ext3grep that will help me with recovering file. My goal is to try this manually by getting the block number out of the journal, for educational purposes. I also understand that the inode and block may be reused before getting this information. For the purposes of this question, assume that the filesystem is read-only after the delete is done.










share|improve this question



























    2















    Suppose we have a simple case:





    • ext4 file system with journaling

    • a single file named file, which has no other hard links

    • the inode for file has associated with it only 1 data block


    My understanding of the deletion process for this specific case is as follows:




    1. log that we will delete file


      1. log that we will reduce inode's ref_cnt by 1

      2. commit

      3. log that because ref_cnt is 0, release inode back to pool

      4. commit

      5. log that because inode is released, release associated block back to pool



    2. commit deletion of file


    Among these, how do I get the block number that was released from step 1.5? Is it stored in the journal? If so, how would I access it?



    I have been searching for some interface to the filesystem that gives this information. The best I've come to is debugfs -R "logdump -a", but I'm not sure how to move forward from there.



    NOTE: I understand that there are tools like ext3grep that will help me with recovering file. My goal is to try this manually by getting the block number out of the journal, for educational purposes. I also understand that the inode and block may be reused before getting this information. For the purposes of this question, assume that the filesystem is read-only after the delete is done.










    share|improve this question

























      2












      2








      2








      Suppose we have a simple case:





      • ext4 file system with journaling

      • a single file named file, which has no other hard links

      • the inode for file has associated with it only 1 data block


      My understanding of the deletion process for this specific case is as follows:




      1. log that we will delete file


        1. log that we will reduce inode's ref_cnt by 1

        2. commit

        3. log that because ref_cnt is 0, release inode back to pool

        4. commit

        5. log that because inode is released, release associated block back to pool



      2. commit deletion of file


      Among these, how do I get the block number that was released from step 1.5? Is it stored in the journal? If so, how would I access it?



      I have been searching for some interface to the filesystem that gives this information. The best I've come to is debugfs -R "logdump -a", but I'm not sure how to move forward from there.



      NOTE: I understand that there are tools like ext3grep that will help me with recovering file. My goal is to try this manually by getting the block number out of the journal, for educational purposes. I also understand that the inode and block may be reused before getting this information. For the purposes of this question, assume that the filesystem is read-only after the delete is done.










      share|improve this question














      Suppose we have a simple case:





      • ext4 file system with journaling

      • a single file named file, which has no other hard links

      • the inode for file has associated with it only 1 data block


      My understanding of the deletion process for this specific case is as follows:




      1. log that we will delete file


        1. log that we will reduce inode's ref_cnt by 1

        2. commit

        3. log that because ref_cnt is 0, release inode back to pool

        4. commit

        5. log that because inode is released, release associated block back to pool



      2. commit deletion of file


      Among these, how do I get the block number that was released from step 1.5? Is it stored in the journal? If so, how would I access it?



      I have been searching for some interface to the filesystem that gives this information. The best I've come to is debugfs -R "logdump -a", but I'm not sure how to move forward from there.



      NOTE: I understand that there are tools like ext3grep that will help me with recovering file. My goal is to try this manually by getting the block number out of the journal, for educational purposes. I also understand that the inode and block may be reused before getting this information. For the purposes of this question, assume that the filesystem is read-only after the delete is done.







      filesystems ext4 storage journaling






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 2 hours ago









      nehcsivartnehcsivart

      363310




      363310






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "106"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f508603%2fare-released-blocks-logged-in-the-journal-for-ext4%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f508603%2fare-released-blocks-logged-in-the-journal-for-ext4%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          宮崎県

          濃尾地震

          シテ島