how to extract file from a ext4 filesystem data?










1















i have a XXX.img file.



system.img: Linux rev 1.0 ext4 filesystem data, UUID=XXXX (extents) (large files)



i want to extract some file from it, how?



or XXX.subimg.tgz file



first gunzip it, get subimg file, then as image file.










share|improve this question
























  • Mount it as a loopback filesystem.

    – Mark Setchell
    Sep 1 '14 at 6:13











  • oops, how fool am i! i'm not notice img file and iso file are same.Thanks!

    – liuyang1
    Sep 1 '14 at 6:18











  • Sometimes we all need more coffee ;-)

    – Mark Setchell
    Sep 1 '14 at 6:21















1















i have a XXX.img file.



system.img: Linux rev 1.0 ext4 filesystem data, UUID=XXXX (extents) (large files)



i want to extract some file from it, how?



or XXX.subimg.tgz file



first gunzip it, get subimg file, then as image file.










share|improve this question
























  • Mount it as a loopback filesystem.

    – Mark Setchell
    Sep 1 '14 at 6:13











  • oops, how fool am i! i'm not notice img file and iso file are same.Thanks!

    – liuyang1
    Sep 1 '14 at 6:18











  • Sometimes we all need more coffee ;-)

    – Mark Setchell
    Sep 1 '14 at 6:21













1












1








1








i have a XXX.img file.



system.img: Linux rev 1.0 ext4 filesystem data, UUID=XXXX (extents) (large files)



i want to extract some file from it, how?



or XXX.subimg.tgz file



first gunzip it, get subimg file, then as image file.










share|improve this question
















i have a XXX.img file.



system.img: Linux rev 1.0 ext4 filesystem data, UUID=XXXX (extents) (large files)



i want to extract some file from it, how?



or XXX.subimg.tgz file



first gunzip it, get subimg file, then as image file.







linux filesystems






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 28 '14 at 6:18







liuyang1

















asked Sep 1 '14 at 6:11









liuyang1liuyang1

1,0301120




1,0301120












  • Mount it as a loopback filesystem.

    – Mark Setchell
    Sep 1 '14 at 6:13











  • oops, how fool am i! i'm not notice img file and iso file are same.Thanks!

    – liuyang1
    Sep 1 '14 at 6:18











  • Sometimes we all need more coffee ;-)

    – Mark Setchell
    Sep 1 '14 at 6:21

















  • Mount it as a loopback filesystem.

    – Mark Setchell
    Sep 1 '14 at 6:13











  • oops, how fool am i! i'm not notice img file and iso file are same.Thanks!

    – liuyang1
    Sep 1 '14 at 6:18











  • Sometimes we all need more coffee ;-)

    – Mark Setchell
    Sep 1 '14 at 6:21
















Mount it as a loopback filesystem.

– Mark Setchell
Sep 1 '14 at 6:13





Mount it as a loopback filesystem.

– Mark Setchell
Sep 1 '14 at 6:13













oops, how fool am i! i'm not notice img file and iso file are same.Thanks!

– liuyang1
Sep 1 '14 at 6:18





oops, how fool am i! i'm not notice img file and iso file are same.Thanks!

– liuyang1
Sep 1 '14 at 6:18













Sometimes we all need more coffee ;-)

– Mark Setchell
Sep 1 '14 at 6:21





Sometimes we all need more coffee ;-)

– Mark Setchell
Sep 1 '14 at 6:21












3 Answers
3






active

oldest

votes


















3














mount -o loop [imgfilename] [path to mount]


just like iso file.






share|improve this answer























  • And if I cannot mount? (I'm on a KVM VPS, mount is not possibile at all)

    – realtebo
    Jan 30 '17 at 15:39











  • If you cannot mount, you can use extfstools

    – Frederik Carlier
    Nov 15 '18 at 14:21


















0














mkdir -p /mnt/rootfs 
mkdir -p /mnt/disk

mount -o loop rootfs.ext4 /mnt/rootfs
mount /dev/sda2 /mnt/disk

cp -r /mnt/rootfs/* /mnt/disk

umount /mnt/rootfs





share|improve this answer


















  • 1





    An explanation, why this solves the problem of the OP, would greatly improve this answer.

    – Mr. T
    Aug 30 '18 at 7:45







  • 1





    While your code may correct as answer But Elaborating what your code does, It can improve the quality of your answer. Checkout the Article : [ How do I write a good answer? ](stackoverflow.com/help/how-to-answer)

    – LuFFy
    Aug 30 '18 at 8:28


















0














If you cannot mount (because you don't have root privileges), you can extract the ext4 filesystem data in userspace using extfstools.



To install it, run:



git clone https://github.com/qmfrederik/extfstools
cd extfstools
./autogen.sh
./configure
make


To extract all files from XXX.img to savedir:



ext2rd XXX.img ./:savedir





share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    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: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    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%2fstackoverflow.com%2fquestions%2f25599767%2fhow-to-extract-file-from-a-ext4-filesystem-data%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    3














    mount -o loop [imgfilename] [path to mount]


    just like iso file.






    share|improve this answer























    • And if I cannot mount? (I'm on a KVM VPS, mount is not possibile at all)

      – realtebo
      Jan 30 '17 at 15:39











    • If you cannot mount, you can use extfstools

      – Frederik Carlier
      Nov 15 '18 at 14:21















    3














    mount -o loop [imgfilename] [path to mount]


    just like iso file.






    share|improve this answer























    • And if I cannot mount? (I'm on a KVM VPS, mount is not possibile at all)

      – realtebo
      Jan 30 '17 at 15:39











    • If you cannot mount, you can use extfstools

      – Frederik Carlier
      Nov 15 '18 at 14:21













    3












    3








    3







    mount -o loop [imgfilename] [path to mount]


    just like iso file.






    share|improve this answer













    mount -o loop [imgfilename] [path to mount]


    just like iso file.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Sep 1 '14 at 8:56









    liuyang1liuyang1

    1,0301120




    1,0301120












    • And if I cannot mount? (I'm on a KVM VPS, mount is not possibile at all)

      – realtebo
      Jan 30 '17 at 15:39











    • If you cannot mount, you can use extfstools

      – Frederik Carlier
      Nov 15 '18 at 14:21

















    • And if I cannot mount? (I'm on a KVM VPS, mount is not possibile at all)

      – realtebo
      Jan 30 '17 at 15:39











    • If you cannot mount, you can use extfstools

      – Frederik Carlier
      Nov 15 '18 at 14:21
















    And if I cannot mount? (I'm on a KVM VPS, mount is not possibile at all)

    – realtebo
    Jan 30 '17 at 15:39





    And if I cannot mount? (I'm on a KVM VPS, mount is not possibile at all)

    – realtebo
    Jan 30 '17 at 15:39













    If you cannot mount, you can use extfstools

    – Frederik Carlier
    Nov 15 '18 at 14:21





    If you cannot mount, you can use extfstools

    – Frederik Carlier
    Nov 15 '18 at 14:21













    0














    mkdir -p /mnt/rootfs 
    mkdir -p /mnt/disk

    mount -o loop rootfs.ext4 /mnt/rootfs
    mount /dev/sda2 /mnt/disk

    cp -r /mnt/rootfs/* /mnt/disk

    umount /mnt/rootfs





    share|improve this answer


















    • 1





      An explanation, why this solves the problem of the OP, would greatly improve this answer.

      – Mr. T
      Aug 30 '18 at 7:45







    • 1





      While your code may correct as answer But Elaborating what your code does, It can improve the quality of your answer. Checkout the Article : [ How do I write a good answer? ](stackoverflow.com/help/how-to-answer)

      – LuFFy
      Aug 30 '18 at 8:28















    0














    mkdir -p /mnt/rootfs 
    mkdir -p /mnt/disk

    mount -o loop rootfs.ext4 /mnt/rootfs
    mount /dev/sda2 /mnt/disk

    cp -r /mnt/rootfs/* /mnt/disk

    umount /mnt/rootfs





    share|improve this answer


















    • 1





      An explanation, why this solves the problem of the OP, would greatly improve this answer.

      – Mr. T
      Aug 30 '18 at 7:45







    • 1





      While your code may correct as answer But Elaborating what your code does, It can improve the quality of your answer. Checkout the Article : [ How do I write a good answer? ](stackoverflow.com/help/how-to-answer)

      – LuFFy
      Aug 30 '18 at 8:28













    0












    0








    0







    mkdir -p /mnt/rootfs 
    mkdir -p /mnt/disk

    mount -o loop rootfs.ext4 /mnt/rootfs
    mount /dev/sda2 /mnt/disk

    cp -r /mnt/rootfs/* /mnt/disk

    umount /mnt/rootfs





    share|improve this answer













    mkdir -p /mnt/rootfs 
    mkdir -p /mnt/disk

    mount -o loop rootfs.ext4 /mnt/rootfs
    mount /dev/sda2 /mnt/disk

    cp -r /mnt/rootfs/* /mnt/disk

    umount /mnt/rootfs






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Aug 30 '18 at 7:28









    Gopi ShankarGopi Shankar

    298




    298







    • 1





      An explanation, why this solves the problem of the OP, would greatly improve this answer.

      – Mr. T
      Aug 30 '18 at 7:45







    • 1





      While your code may correct as answer But Elaborating what your code does, It can improve the quality of your answer. Checkout the Article : [ How do I write a good answer? ](stackoverflow.com/help/how-to-answer)

      – LuFFy
      Aug 30 '18 at 8:28












    • 1





      An explanation, why this solves the problem of the OP, would greatly improve this answer.

      – Mr. T
      Aug 30 '18 at 7:45







    • 1





      While your code may correct as answer But Elaborating what your code does, It can improve the quality of your answer. Checkout the Article : [ How do I write a good answer? ](stackoverflow.com/help/how-to-answer)

      – LuFFy
      Aug 30 '18 at 8:28







    1




    1





    An explanation, why this solves the problem of the OP, would greatly improve this answer.

    – Mr. T
    Aug 30 '18 at 7:45






    An explanation, why this solves the problem of the OP, would greatly improve this answer.

    – Mr. T
    Aug 30 '18 at 7:45





    1




    1





    While your code may correct as answer But Elaborating what your code does, It can improve the quality of your answer. Checkout the Article : [ How do I write a good answer? ](stackoverflow.com/help/how-to-answer)

    – LuFFy
    Aug 30 '18 at 8:28





    While your code may correct as answer But Elaborating what your code does, It can improve the quality of your answer. Checkout the Article : [ How do I write a good answer? ](stackoverflow.com/help/how-to-answer)

    – LuFFy
    Aug 30 '18 at 8:28











    0














    If you cannot mount (because you don't have root privileges), you can extract the ext4 filesystem data in userspace using extfstools.



    To install it, run:



    git clone https://github.com/qmfrederik/extfstools
    cd extfstools
    ./autogen.sh
    ./configure
    make


    To extract all files from XXX.img to savedir:



    ext2rd XXX.img ./:savedir





    share|improve this answer



























      0














      If you cannot mount (because you don't have root privileges), you can extract the ext4 filesystem data in userspace using extfstools.



      To install it, run:



      git clone https://github.com/qmfrederik/extfstools
      cd extfstools
      ./autogen.sh
      ./configure
      make


      To extract all files from XXX.img to savedir:



      ext2rd XXX.img ./:savedir





      share|improve this answer

























        0












        0








        0







        If you cannot mount (because you don't have root privileges), you can extract the ext4 filesystem data in userspace using extfstools.



        To install it, run:



        git clone https://github.com/qmfrederik/extfstools
        cd extfstools
        ./autogen.sh
        ./configure
        make


        To extract all files from XXX.img to savedir:



        ext2rd XXX.img ./:savedir





        share|improve this answer













        If you cannot mount (because you don't have root privileges), you can extract the ext4 filesystem data in userspace using extfstools.



        To install it, run:



        git clone https://github.com/qmfrederik/extfstools
        cd extfstools
        ./autogen.sh
        ./configure
        make


        To extract all files from XXX.img to savedir:



        ext2rd XXX.img ./:savedir






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 15 '18 at 14:20









        Frederik CarlierFrederik Carlier

        1,3261514




        1,3261514



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • 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%2fstackoverflow.com%2fquestions%2f25599767%2fhow-to-extract-file-from-a-ext4-filesystem-data%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







            這個網誌中的熱門文章

            How to read a connectionString WITH PROVIDER in .NET Core?

            Node.js Script on GitHub Pages or Amazon S3

            Museum of Modern and Contemporary Art of Trento and Rovereto