How to mount qcow2 image












4















I've read that with qemu-nbd and the network block device kernel module, I can mount a qcow2 image. I haven't seen any tutorials on mounting a qcow2 via a loop device. Is it possible? If not, why?



I don't really understand the difference between a qcow2 and an iso.










share|improve this question


















  • 2





    You don't mount a qcow2 image via a loop device; you mount it via the network block device (nbd). Not intuitive, but easy enough to find via your favourite search engine.

    – roaima
    Mar 8 '16 at 21:35













  • related: serverfault.com/questions/213232/mount-qcow2-snapshots

    – Ciro Santilli 新疆改造中心 六四事件 法轮功
    Jan 15 at 23:50
















4















I've read that with qemu-nbd and the network block device kernel module, I can mount a qcow2 image. I haven't seen any tutorials on mounting a qcow2 via a loop device. Is it possible? If not, why?



I don't really understand the difference between a qcow2 and an iso.










share|improve this question


















  • 2





    You don't mount a qcow2 image via a loop device; you mount it via the network block device (nbd). Not intuitive, but easy enough to find via your favourite search engine.

    – roaima
    Mar 8 '16 at 21:35













  • related: serverfault.com/questions/213232/mount-qcow2-snapshots

    – Ciro Santilli 新疆改造中心 六四事件 法轮功
    Jan 15 at 23:50














4












4








4








I've read that with qemu-nbd and the network block device kernel module, I can mount a qcow2 image. I haven't seen any tutorials on mounting a qcow2 via a loop device. Is it possible? If not, why?



I don't really understand the difference between a qcow2 and an iso.










share|improve this question














I've read that with qemu-nbd and the network block device kernel module, I can mount a qcow2 image. I haven't seen any tutorials on mounting a qcow2 via a loop device. Is it possible? If not, why?



I don't really understand the difference between a qcow2 and an iso.







qemu loop-device nbd






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 8 '16 at 17:50









onlyaneggonlyanegg

31538




31538








  • 2





    You don't mount a qcow2 image via a loop device; you mount it via the network block device (nbd). Not intuitive, but easy enough to find via your favourite search engine.

    – roaima
    Mar 8 '16 at 21:35













  • related: serverfault.com/questions/213232/mount-qcow2-snapshots

    – Ciro Santilli 新疆改造中心 六四事件 法轮功
    Jan 15 at 23:50














  • 2





    You don't mount a qcow2 image via a loop device; you mount it via the network block device (nbd). Not intuitive, but easy enough to find via your favourite search engine.

    – roaima
    Mar 8 '16 at 21:35













  • related: serverfault.com/questions/213232/mount-qcow2-snapshots

    – Ciro Santilli 新疆改造中心 六四事件 法轮功
    Jan 15 at 23:50








2




2





You don't mount a qcow2 image via a loop device; you mount it via the network block device (nbd). Not intuitive, but easy enough to find via your favourite search engine.

– roaima
Mar 8 '16 at 21:35







You don't mount a qcow2 image via a loop device; you mount it via the network block device (nbd). Not intuitive, but easy enough to find via your favourite search engine.

– roaima
Mar 8 '16 at 21:35















related: serverfault.com/questions/213232/mount-qcow2-snapshots

– Ciro Santilli 新疆改造中心 六四事件 法轮功
Jan 15 at 23:50





related: serverfault.com/questions/213232/mount-qcow2-snapshots

– Ciro Santilli 新疆改造中心 六四事件 法轮功
Jan 15 at 23:50










2 Answers
2






active

oldest

votes


















4














A loop device just turns a file into a block device. If the file has some special internal mapping of its blocks, the loop device won't translate any of it. qcow2 is special... it has special mapping inside that handles different snapshots of the same blocks stored in different places. If you mount that as a loop device, you'll just get one big block device that doesn't represent the actual data in the image.



Another option is to convert to raw and mount as a loop device:



qemu-img convert -p -O raw oldfile.qcow2 newfile.raw


But then you have to convert it back to qcow2 to use it again as before.



I think using qemu-nbd is not the most efficient IO, but is easy. Mounting it in a VM, like one booted with a live usb, is easy too. Converting doesn't make much sense... it was just an example of how they're different.






share|improve this answer



















  • 2





    guestmount is the easy way! It does the mounting-in-a-vm under the hood, but it's all wrapped up neatly.

    – Gilles
    Mar 8 '16 at 23:08













  • nice! I hadn't heard of that.

    – onlyanegg
    Mar 10 '16 at 4:18



















0














Thanks to Gilles for pointing out guestmount. Mounting a qcow2 image is very simple on RHEL/Centos/Fedora:





  1. First install guestmount (comes as part of libguestfs-tools in Centos6)



    yum install libguestfs-tools libguestfs



  2. Then you should be able to auto-magically mount your qcow2 image using the -i option



    guestmount -a path_to_image.qcow2 -i --ro /mount_point


    You can manually specify mount points (within the image) using the -m option.

    As always read the man page on guestmount for more details...




Note: This only addresses the question title. Please see Peter's answer for the differences between qcow2 and ISOs...





share

























    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%2f268460%2fhow-to-mount-qcow2-image%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    4














    A loop device just turns a file into a block device. If the file has some special internal mapping of its blocks, the loop device won't translate any of it. qcow2 is special... it has special mapping inside that handles different snapshots of the same blocks stored in different places. If you mount that as a loop device, you'll just get one big block device that doesn't represent the actual data in the image.



    Another option is to convert to raw and mount as a loop device:



    qemu-img convert -p -O raw oldfile.qcow2 newfile.raw


    But then you have to convert it back to qcow2 to use it again as before.



    I think using qemu-nbd is not the most efficient IO, but is easy. Mounting it in a VM, like one booted with a live usb, is easy too. Converting doesn't make much sense... it was just an example of how they're different.






    share|improve this answer



















    • 2





      guestmount is the easy way! It does the mounting-in-a-vm under the hood, but it's all wrapped up neatly.

      – Gilles
      Mar 8 '16 at 23:08













    • nice! I hadn't heard of that.

      – onlyanegg
      Mar 10 '16 at 4:18
















    4














    A loop device just turns a file into a block device. If the file has some special internal mapping of its blocks, the loop device won't translate any of it. qcow2 is special... it has special mapping inside that handles different snapshots of the same blocks stored in different places. If you mount that as a loop device, you'll just get one big block device that doesn't represent the actual data in the image.



    Another option is to convert to raw and mount as a loop device:



    qemu-img convert -p -O raw oldfile.qcow2 newfile.raw


    But then you have to convert it back to qcow2 to use it again as before.



    I think using qemu-nbd is not the most efficient IO, but is easy. Mounting it in a VM, like one booted with a live usb, is easy too. Converting doesn't make much sense... it was just an example of how they're different.






    share|improve this answer



















    • 2





      guestmount is the easy way! It does the mounting-in-a-vm under the hood, but it's all wrapped up neatly.

      – Gilles
      Mar 8 '16 at 23:08













    • nice! I hadn't heard of that.

      – onlyanegg
      Mar 10 '16 at 4:18














    4












    4








    4







    A loop device just turns a file into a block device. If the file has some special internal mapping of its blocks, the loop device won't translate any of it. qcow2 is special... it has special mapping inside that handles different snapshots of the same blocks stored in different places. If you mount that as a loop device, you'll just get one big block device that doesn't represent the actual data in the image.



    Another option is to convert to raw and mount as a loop device:



    qemu-img convert -p -O raw oldfile.qcow2 newfile.raw


    But then you have to convert it back to qcow2 to use it again as before.



    I think using qemu-nbd is not the most efficient IO, but is easy. Mounting it in a VM, like one booted with a live usb, is easy too. Converting doesn't make much sense... it was just an example of how they're different.






    share|improve this answer













    A loop device just turns a file into a block device. If the file has some special internal mapping of its blocks, the loop device won't translate any of it. qcow2 is special... it has special mapping inside that handles different snapshots of the same blocks stored in different places. If you mount that as a loop device, you'll just get one big block device that doesn't represent the actual data in the image.



    Another option is to convert to raw and mount as a loop device:



    qemu-img convert -p -O raw oldfile.qcow2 newfile.raw


    But then you have to convert it back to qcow2 to use it again as before.



    I think using qemu-nbd is not the most efficient IO, but is easy. Mounting it in a VM, like one booted with a live usb, is easy too. Converting doesn't make much sense... it was just an example of how they're different.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Mar 8 '16 at 21:53









    PeterPeter

    88468




    88468








    • 2





      guestmount is the easy way! It does the mounting-in-a-vm under the hood, but it's all wrapped up neatly.

      – Gilles
      Mar 8 '16 at 23:08













    • nice! I hadn't heard of that.

      – onlyanegg
      Mar 10 '16 at 4:18














    • 2





      guestmount is the easy way! It does the mounting-in-a-vm under the hood, but it's all wrapped up neatly.

      – Gilles
      Mar 8 '16 at 23:08













    • nice! I hadn't heard of that.

      – onlyanegg
      Mar 10 '16 at 4:18








    2




    2





    guestmount is the easy way! It does the mounting-in-a-vm under the hood, but it's all wrapped up neatly.

    – Gilles
    Mar 8 '16 at 23:08







    guestmount is the easy way! It does the mounting-in-a-vm under the hood, but it's all wrapped up neatly.

    – Gilles
    Mar 8 '16 at 23:08















    nice! I hadn't heard of that.

    – onlyanegg
    Mar 10 '16 at 4:18





    nice! I hadn't heard of that.

    – onlyanegg
    Mar 10 '16 at 4:18













    0














    Thanks to Gilles for pointing out guestmount. Mounting a qcow2 image is very simple on RHEL/Centos/Fedora:





    1. First install guestmount (comes as part of libguestfs-tools in Centos6)



      yum install libguestfs-tools libguestfs



    2. Then you should be able to auto-magically mount your qcow2 image using the -i option



      guestmount -a path_to_image.qcow2 -i --ro /mount_point


      You can manually specify mount points (within the image) using the -m option.

      As always read the man page on guestmount for more details...




    Note: This only addresses the question title. Please see Peter's answer for the differences between qcow2 and ISOs...





    share






























      0














      Thanks to Gilles for pointing out guestmount. Mounting a qcow2 image is very simple on RHEL/Centos/Fedora:





      1. First install guestmount (comes as part of libguestfs-tools in Centos6)



        yum install libguestfs-tools libguestfs



      2. Then you should be able to auto-magically mount your qcow2 image using the -i option



        guestmount -a path_to_image.qcow2 -i --ro /mount_point


        You can manually specify mount points (within the image) using the -m option.

        As always read the man page on guestmount for more details...




      Note: This only addresses the question title. Please see Peter's answer for the differences between qcow2 and ISOs...





      share




























        0












        0








        0







        Thanks to Gilles for pointing out guestmount. Mounting a qcow2 image is very simple on RHEL/Centos/Fedora:





        1. First install guestmount (comes as part of libguestfs-tools in Centos6)



          yum install libguestfs-tools libguestfs



        2. Then you should be able to auto-magically mount your qcow2 image using the -i option



          guestmount -a path_to_image.qcow2 -i --ro /mount_point


          You can manually specify mount points (within the image) using the -m option.

          As always read the man page on guestmount for more details...




        Note: This only addresses the question title. Please see Peter's answer for the differences between qcow2 and ISOs...





        share















        Thanks to Gilles for pointing out guestmount. Mounting a qcow2 image is very simple on RHEL/Centos/Fedora:





        1. First install guestmount (comes as part of libguestfs-tools in Centos6)



          yum install libguestfs-tools libguestfs



        2. Then you should be able to auto-magically mount your qcow2 image using the -i option



          guestmount -a path_to_image.qcow2 -i --ro /mount_point


          You can manually specify mount points (within the image) using the -m option.

          As always read the man page on guestmount for more details...




        Note: This only addresses the question title. Please see Peter's answer for the differences between qcow2 and ISOs...






        share













        share


        share








        edited 3 mins ago

























        answered 9 mins ago









        maloomaloo

        234




        234






























            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%2f268460%2fhow-to-mount-qcow2-image%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

            Accessing regular linux commands in Huawei's Dopra Linux

            Can't connect RFCOMM socket: Host is down

            Kernel panic - not syncing: Fatal Exception in Interrupt