How to move an ext4 journal

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












I have an ext4 filesystem on an USB stick and after using it for some time I would like to move the journal to some other blocks, so that the stick lives longer. The journal is described by inode 8, but how to I reallocate its blocks to a different place?



Is it possible to do that at file system creation time?










share|improve this question



























    up vote
    2
    down vote

    favorite












    I have an ext4 filesystem on an USB stick and after using it for some time I would like to move the journal to some other blocks, so that the stick lives longer. The journal is described by inode 8, but how to I reallocate its blocks to a different place?



    Is it possible to do that at file system creation time?










    share|improve this question

























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      I have an ext4 filesystem on an USB stick and after using it for some time I would like to move the journal to some other blocks, so that the stick lives longer. The journal is described by inode 8, but how to I reallocate its blocks to a different place?



      Is it possible to do that at file system creation time?










      share|improve this question















      I have an ext4 filesystem on an USB stick and after using it for some time I would like to move the journal to some other blocks, so that the stick lives longer. The journal is described by inode 8, but how to I reallocate its blocks to a different place?



      Is it possible to do that at file system creation time?







      ext4






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 25 '16 at 20:48









      Anthon

      58.7k1796159




      58.7k1796159










      asked Apr 25 '16 at 20:33









      Zak

      111




      111




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote













          Check man mke2fs. Pay close attention to the -J / location section and the -E / packed_meta_blocks section.



          You said you were using a USB stick. I'm assuming it can be formatted without consequence. Did you backup your data?



          1. Format the disk with a default command and get data on how the USB stick is put together.

          2. Format the disk with a altered command and get data on how the USB stick looks with the location moved.

          3. Moving the journal on an in-use disk.

          You did backup you data?



          Part 1. Default journal for reference



          1. Insert USB stick.

          2. In a terminal window, use sudo or su and supply the password.

          3. Use blkid " to find your " /dev/sdXX label.

          4. Command mke2fs -t ext4 /dev/sdXX for a default format.

          5. Now to pull out data about the drive.

          6. Command tune2fs -l /dev/sdXX. Find the line "Journal inode". Write this number down. It is usually 8.


          7. Command debugfs /dev/sdXX




            1. Command stat <8>. The "8" comes from the "Journal inode" line. The command needs to be entered exactly with the <,>.



              What do you see? The third line lists the size of the journal. Write this down. My machine came in at 33554432 (~32Mb).
              The 13th line lists the extents used for the journal. Write this down. My machine came in at 196608 - 204799. 196608 time 4k per page equals 786M.



            2. Command q then quit.


          8. Remove USB stick

          Part 2. Moving the journal



          1. Same as above.

          2. Same as above.

          3. Same as above.

          4. command mke2fs -J location=600M /dev/sdXX. This should move the default journal to a point starting at the 600M mark.

          5. As above.

          6. As above.

          7. As above.

            1. The journal size should be the same. The first journal extent has moved to 153600 on my machine. 153600 times 4k per page equals ~614M.

            2. As above.


          8. As above.

          Part 3. Moving the journal on an in-use disk



          1. Backup your data?

          2. Unmount the partition. umount /dev/sdXX.

          3. Remove old journal. tune2fs -O ^has_journal /dev/sdXX.

          4. Install new journal. tune2fs -J location=XX[M,G] /dev/sdXX. Specify units. The journal can be moved to a mega, giga location.


          5. e2fsck -fv /dev/sdXX just to be safe.

          6. Reboot the machine. You did backup didn't you?

          You can change the journal size and location with mke2fs -J size=XX,location=YY[M,G,P,T] /dev/sdXX. The size notation is always in MB.



          Where did this come from? "Trial and Error" course from the School of Hard Knocks.






          share|improve this answer






















            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',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            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%2f278998%2fhow-to-move-an-ext4-journal%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            2
            down vote













            Check man mke2fs. Pay close attention to the -J / location section and the -E / packed_meta_blocks section.



            You said you were using a USB stick. I'm assuming it can be formatted without consequence. Did you backup your data?



            1. Format the disk with a default command and get data on how the USB stick is put together.

            2. Format the disk with a altered command and get data on how the USB stick looks with the location moved.

            3. Moving the journal on an in-use disk.

            You did backup you data?



            Part 1. Default journal for reference



            1. Insert USB stick.

            2. In a terminal window, use sudo or su and supply the password.

            3. Use blkid " to find your " /dev/sdXX label.

            4. Command mke2fs -t ext4 /dev/sdXX for a default format.

            5. Now to pull out data about the drive.

            6. Command tune2fs -l /dev/sdXX. Find the line "Journal inode". Write this number down. It is usually 8.


            7. Command debugfs /dev/sdXX




              1. Command stat <8>. The "8" comes from the "Journal inode" line. The command needs to be entered exactly with the <,>.



                What do you see? The third line lists the size of the journal. Write this down. My machine came in at 33554432 (~32Mb).
                The 13th line lists the extents used for the journal. Write this down. My machine came in at 196608 - 204799. 196608 time 4k per page equals 786M.



              2. Command q then quit.


            8. Remove USB stick

            Part 2. Moving the journal



            1. Same as above.

            2. Same as above.

            3. Same as above.

            4. command mke2fs -J location=600M /dev/sdXX. This should move the default journal to a point starting at the 600M mark.

            5. As above.

            6. As above.

            7. As above.

              1. The journal size should be the same. The first journal extent has moved to 153600 on my machine. 153600 times 4k per page equals ~614M.

              2. As above.


            8. As above.

            Part 3. Moving the journal on an in-use disk



            1. Backup your data?

            2. Unmount the partition. umount /dev/sdXX.

            3. Remove old journal. tune2fs -O ^has_journal /dev/sdXX.

            4. Install new journal. tune2fs -J location=XX[M,G] /dev/sdXX. Specify units. The journal can be moved to a mega, giga location.


            5. e2fsck -fv /dev/sdXX just to be safe.

            6. Reboot the machine. You did backup didn't you?

            You can change the journal size and location with mke2fs -J size=XX,location=YY[M,G,P,T] /dev/sdXX. The size notation is always in MB.



            Where did this come from? "Trial and Error" course from the School of Hard Knocks.






            share|improve this answer


























              up vote
              2
              down vote













              Check man mke2fs. Pay close attention to the -J / location section and the -E / packed_meta_blocks section.



              You said you were using a USB stick. I'm assuming it can be formatted without consequence. Did you backup your data?



              1. Format the disk with a default command and get data on how the USB stick is put together.

              2. Format the disk with a altered command and get data on how the USB stick looks with the location moved.

              3. Moving the journal on an in-use disk.

              You did backup you data?



              Part 1. Default journal for reference



              1. Insert USB stick.

              2. In a terminal window, use sudo or su and supply the password.

              3. Use blkid " to find your " /dev/sdXX label.

              4. Command mke2fs -t ext4 /dev/sdXX for a default format.

              5. Now to pull out data about the drive.

              6. Command tune2fs -l /dev/sdXX. Find the line "Journal inode". Write this number down. It is usually 8.


              7. Command debugfs /dev/sdXX




                1. Command stat <8>. The "8" comes from the "Journal inode" line. The command needs to be entered exactly with the <,>.



                  What do you see? The third line lists the size of the journal. Write this down. My machine came in at 33554432 (~32Mb).
                  The 13th line lists the extents used for the journal. Write this down. My machine came in at 196608 - 204799. 196608 time 4k per page equals 786M.



                2. Command q then quit.


              8. Remove USB stick

              Part 2. Moving the journal



              1. Same as above.

              2. Same as above.

              3. Same as above.

              4. command mke2fs -J location=600M /dev/sdXX. This should move the default journal to a point starting at the 600M mark.

              5. As above.

              6. As above.

              7. As above.

                1. The journal size should be the same. The first journal extent has moved to 153600 on my machine. 153600 times 4k per page equals ~614M.

                2. As above.


              8. As above.

              Part 3. Moving the journal on an in-use disk



              1. Backup your data?

              2. Unmount the partition. umount /dev/sdXX.

              3. Remove old journal. tune2fs -O ^has_journal /dev/sdXX.

              4. Install new journal. tune2fs -J location=XX[M,G] /dev/sdXX. Specify units. The journal can be moved to a mega, giga location.


              5. e2fsck -fv /dev/sdXX just to be safe.

              6. Reboot the machine. You did backup didn't you?

              You can change the journal size and location with mke2fs -J size=XX,location=YY[M,G,P,T] /dev/sdXX. The size notation is always in MB.



              Where did this come from? "Trial and Error" course from the School of Hard Knocks.






              share|improve this answer
























                up vote
                2
                down vote










                up vote
                2
                down vote









                Check man mke2fs. Pay close attention to the -J / location section and the -E / packed_meta_blocks section.



                You said you were using a USB stick. I'm assuming it can be formatted without consequence. Did you backup your data?



                1. Format the disk with a default command and get data on how the USB stick is put together.

                2. Format the disk with a altered command and get data on how the USB stick looks with the location moved.

                3. Moving the journal on an in-use disk.

                You did backup you data?



                Part 1. Default journal for reference



                1. Insert USB stick.

                2. In a terminal window, use sudo or su and supply the password.

                3. Use blkid " to find your " /dev/sdXX label.

                4. Command mke2fs -t ext4 /dev/sdXX for a default format.

                5. Now to pull out data about the drive.

                6. Command tune2fs -l /dev/sdXX. Find the line "Journal inode". Write this number down. It is usually 8.


                7. Command debugfs /dev/sdXX




                  1. Command stat <8>. The "8" comes from the "Journal inode" line. The command needs to be entered exactly with the <,>.



                    What do you see? The third line lists the size of the journal. Write this down. My machine came in at 33554432 (~32Mb).
                    The 13th line lists the extents used for the journal. Write this down. My machine came in at 196608 - 204799. 196608 time 4k per page equals 786M.



                  2. Command q then quit.


                8. Remove USB stick

                Part 2. Moving the journal



                1. Same as above.

                2. Same as above.

                3. Same as above.

                4. command mke2fs -J location=600M /dev/sdXX. This should move the default journal to a point starting at the 600M mark.

                5. As above.

                6. As above.

                7. As above.

                  1. The journal size should be the same. The first journal extent has moved to 153600 on my machine. 153600 times 4k per page equals ~614M.

                  2. As above.


                8. As above.

                Part 3. Moving the journal on an in-use disk



                1. Backup your data?

                2. Unmount the partition. umount /dev/sdXX.

                3. Remove old journal. tune2fs -O ^has_journal /dev/sdXX.

                4. Install new journal. tune2fs -J location=XX[M,G] /dev/sdXX. Specify units. The journal can be moved to a mega, giga location.


                5. e2fsck -fv /dev/sdXX just to be safe.

                6. Reboot the machine. You did backup didn't you?

                You can change the journal size and location with mke2fs -J size=XX,location=YY[M,G,P,T] /dev/sdXX. The size notation is always in MB.



                Where did this come from? "Trial and Error" course from the School of Hard Knocks.






                share|improve this answer














                Check man mke2fs. Pay close attention to the -J / location section and the -E / packed_meta_blocks section.



                You said you were using a USB stick. I'm assuming it can be formatted without consequence. Did you backup your data?



                1. Format the disk with a default command and get data on how the USB stick is put together.

                2. Format the disk with a altered command and get data on how the USB stick looks with the location moved.

                3. Moving the journal on an in-use disk.

                You did backup you data?



                Part 1. Default journal for reference



                1. Insert USB stick.

                2. In a terminal window, use sudo or su and supply the password.

                3. Use blkid " to find your " /dev/sdXX label.

                4. Command mke2fs -t ext4 /dev/sdXX for a default format.

                5. Now to pull out data about the drive.

                6. Command tune2fs -l /dev/sdXX. Find the line "Journal inode". Write this number down. It is usually 8.


                7. Command debugfs /dev/sdXX




                  1. Command stat <8>. The "8" comes from the "Journal inode" line. The command needs to be entered exactly with the <,>.



                    What do you see? The third line lists the size of the journal. Write this down. My machine came in at 33554432 (~32Mb).
                    The 13th line lists the extents used for the journal. Write this down. My machine came in at 196608 - 204799. 196608 time 4k per page equals 786M.



                  2. Command q then quit.


                8. Remove USB stick

                Part 2. Moving the journal



                1. Same as above.

                2. Same as above.

                3. Same as above.

                4. command mke2fs -J location=600M /dev/sdXX. This should move the default journal to a point starting at the 600M mark.

                5. As above.

                6. As above.

                7. As above.

                  1. The journal size should be the same. The first journal extent has moved to 153600 on my machine. 153600 times 4k per page equals ~614M.

                  2. As above.


                8. As above.

                Part 3. Moving the journal on an in-use disk



                1. Backup your data?

                2. Unmount the partition. umount /dev/sdXX.

                3. Remove old journal. tune2fs -O ^has_journal /dev/sdXX.

                4. Install new journal. tune2fs -J location=XX[M,G] /dev/sdXX. Specify units. The journal can be moved to a mega, giga location.


                5. e2fsck -fv /dev/sdXX just to be safe.

                6. Reboot the machine. You did backup didn't you?

                You can change the journal size and location with mke2fs -J size=XX,location=YY[M,G,P,T] /dev/sdXX. The size notation is always in MB.



                Where did this come from? "Trial and Error" course from the School of Hard Knocks.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Aug 15 at 0:28









                slm♦

                238k65492662




                238k65492662










                answered Aug 7 at 3:20









                user304068

                213




                213



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f278998%2fhow-to-move-an-ext4-journal%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    Peggy Mitchell

                    Palaiologos

                    The Forum (Inglewood, California)