How do I boot from ISO file stored on hard disk?











up vote
10
down vote

favorite
3












I know that I can create/burn bootable CD/DVD or live USB and can boot/install from it. But suppose I am currently running GNU/Linux and I've ISO file of another GNU/Linux that I want to install on my hard disk, then Can I directly boot from ISO from hard disk and try/install that GNU/Linux operating system?










share|improve this question




























    up vote
    10
    down vote

    favorite
    3












    I know that I can create/burn bootable CD/DVD or live USB and can boot/install from it. But suppose I am currently running GNU/Linux and I've ISO file of another GNU/Linux that I want to install on my hard disk, then Can I directly boot from ISO from hard disk and try/install that GNU/Linux operating system?










    share|improve this question


























      up vote
      10
      down vote

      favorite
      3









      up vote
      10
      down vote

      favorite
      3






      3





      I know that I can create/burn bootable CD/DVD or live USB and can boot/install from it. But suppose I am currently running GNU/Linux and I've ISO file of another GNU/Linux that I want to install on my hard disk, then Can I directly boot from ISO from hard disk and try/install that GNU/Linux operating system?










      share|improve this question















      I know that I can create/burn bootable CD/DVD or live USB and can boot/install from it. But suppose I am currently running GNU/Linux and I've ISO file of another GNU/Linux that I want to install on my hard disk, then Can I directly boot from ISO from hard disk and try/install that GNU/Linux operating system?







      system-installation iso bootable






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 24 '15 at 8:13









      Wildcard

      22.6k961164




      22.6k961164










      asked Dec 23 '15 at 7:31









      Pandya

      8,4841349103




      8,4841349103






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          13
          down vote



          accepted










          Yes, you can accomplish this by adding a menu entry to the GRUB boot loader menu.



          You can add a custom GRUB menu entry by editing /etc/grub.d/40_custom,



          Example of custom menuentry:



           exec tail -n +3 $0
          # This file provides an easy way to add custom menu entries. Simply type the
          # menu entries you want to add after this comment. Be careful not to change
          # the 'exec tail' line above.

          menuentry "Trisquel ISO" {
          set isofile="/Operating_Systems/Trisquel_7.0_i686/trisquel_7.0_i686.iso"
          loopback loop (hd0,5)$isofile
          linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile quiet splash
          initrd (loop)/casper/initrd
          }


          Instruction & Explanation:




          1. The command set is used for storing the path of the ISO file into a variable, here isofile.



          2. loopback is used to make a device from a file system image. In order to do that, it is necessary to specify the device and image file. Here we used (hd0,5)$isofile in which (hd0,5) represents the fifth partition of the disk.




            • Points to note: In (hd0,5) ,
              1st digit represents the device number which starts from 0 (here : 0 = 1st device) and
              2nd digit represents the partition number which starts from 1 (here 5 = 5th partition).
              That means /dev/sda5

            • And variable $isofile has the path of the ISO file. So, finally it becomes (hd0,5)/Operating_Systems/Trisquel_7.0_i686/trisquel_7.0_i686.iso.

            • For more information, visit : How to specify devices and files.






          3. linux command is used to load Linux kernel (vmlinuz) from file. Put the path of Linux kernel in the ISO.





            • Read/extract the content of ISO to get the path of kernel example:



               $ 7z l trisquel_7.0_i686.iso | grep vmlinu
              2014-10-29 21:41:43 ..... 5841680 5841680 casper/vmlinuz
              2014-11-03 00:45:09 ..... 5844176 5844176 casper/vmlinuz.netinst


              so, /casper/vmlinuz was used here.






          4. initrd command is used to load an initial ramdisk for a Linux kernel image, and set the appropriate parameters in the Linux setup area in memory.





            • initrd is a scheme for loading a temporary root file system into memory. Put the path of initrd in the ISO.


            • Read/extract the content of ISO to get the path of initrd:



              $ 7z l trisquel_7.0_i686.iso | grep initrd
              2014-11-03 00:45:19 ..... 16851900 16851900 casper/initrd
              2014-11-03 00:45:09 ..... 9398592 9398592 casper/initrd.netinst





          5. The additional parameter such as boot=casper iso-scan/filename=$isofile noprompt noeject may be specific to a GNU/Linux distribution and vary for another family of Linux. You can find some configurations for different family/distribution from here.



            Note: Some distributions use initrd.gz or initrd.lz depending upon the algorithm/compression used.




          After editing /etc/grub.d/40_custom, GRUB needs to be updated by update-grub2 command. Upon rebooting, you will find the custom menuentry you've added on the GRUB screen. And you may use the Live environment of a GNU/Linux distribution.



          In order to perform installation from ISO, installer may need to unmount any mounted partitions; i.e. say another system is mounted at /isodevice, then you can umount -l /isodevice.



          Hope this helps.






          share|improve this answer























          • Wow, I'm impressed...I would have thought it would be impossible, since installing a new OS often involves reformatting partitions, which could include the partition your ISO file is stored on.
            – Wildcard
            Dec 24 '15 at 8:15










          • Your samples uses GRUB2. Centos 6 uses GRUB1 (grub legacy) and above examples doesn't work.
            – Ikrom
            Dec 4 at 6:02











          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: 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%2f251079%2fhow-do-i-boot-from-iso-file-stored-on-hard-disk%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          13
          down vote



          accepted










          Yes, you can accomplish this by adding a menu entry to the GRUB boot loader menu.



          You can add a custom GRUB menu entry by editing /etc/grub.d/40_custom,



          Example of custom menuentry:



           exec tail -n +3 $0
          # This file provides an easy way to add custom menu entries. Simply type the
          # menu entries you want to add after this comment. Be careful not to change
          # the 'exec tail' line above.

          menuentry "Trisquel ISO" {
          set isofile="/Operating_Systems/Trisquel_7.0_i686/trisquel_7.0_i686.iso"
          loopback loop (hd0,5)$isofile
          linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile quiet splash
          initrd (loop)/casper/initrd
          }


          Instruction & Explanation:




          1. The command set is used for storing the path of the ISO file into a variable, here isofile.



          2. loopback is used to make a device from a file system image. In order to do that, it is necessary to specify the device and image file. Here we used (hd0,5)$isofile in which (hd0,5) represents the fifth partition of the disk.




            • Points to note: In (hd0,5) ,
              1st digit represents the device number which starts from 0 (here : 0 = 1st device) and
              2nd digit represents the partition number which starts from 1 (here 5 = 5th partition).
              That means /dev/sda5

            • And variable $isofile has the path of the ISO file. So, finally it becomes (hd0,5)/Operating_Systems/Trisquel_7.0_i686/trisquel_7.0_i686.iso.

            • For more information, visit : How to specify devices and files.






          3. linux command is used to load Linux kernel (vmlinuz) from file. Put the path of Linux kernel in the ISO.





            • Read/extract the content of ISO to get the path of kernel example:



               $ 7z l trisquel_7.0_i686.iso | grep vmlinu
              2014-10-29 21:41:43 ..... 5841680 5841680 casper/vmlinuz
              2014-11-03 00:45:09 ..... 5844176 5844176 casper/vmlinuz.netinst


              so, /casper/vmlinuz was used here.






          4. initrd command is used to load an initial ramdisk for a Linux kernel image, and set the appropriate parameters in the Linux setup area in memory.





            • initrd is a scheme for loading a temporary root file system into memory. Put the path of initrd in the ISO.


            • Read/extract the content of ISO to get the path of initrd:



              $ 7z l trisquel_7.0_i686.iso | grep initrd
              2014-11-03 00:45:19 ..... 16851900 16851900 casper/initrd
              2014-11-03 00:45:09 ..... 9398592 9398592 casper/initrd.netinst





          5. The additional parameter such as boot=casper iso-scan/filename=$isofile noprompt noeject may be specific to a GNU/Linux distribution and vary for another family of Linux. You can find some configurations for different family/distribution from here.



            Note: Some distributions use initrd.gz or initrd.lz depending upon the algorithm/compression used.




          After editing /etc/grub.d/40_custom, GRUB needs to be updated by update-grub2 command. Upon rebooting, you will find the custom menuentry you've added on the GRUB screen. And you may use the Live environment of a GNU/Linux distribution.



          In order to perform installation from ISO, installer may need to unmount any mounted partitions; i.e. say another system is mounted at /isodevice, then you can umount -l /isodevice.



          Hope this helps.






          share|improve this answer























          • Wow, I'm impressed...I would have thought it would be impossible, since installing a new OS often involves reformatting partitions, which could include the partition your ISO file is stored on.
            – Wildcard
            Dec 24 '15 at 8:15










          • Your samples uses GRUB2. Centos 6 uses GRUB1 (grub legacy) and above examples doesn't work.
            – Ikrom
            Dec 4 at 6:02















          up vote
          13
          down vote



          accepted










          Yes, you can accomplish this by adding a menu entry to the GRUB boot loader menu.



          You can add a custom GRUB menu entry by editing /etc/grub.d/40_custom,



          Example of custom menuentry:



           exec tail -n +3 $0
          # This file provides an easy way to add custom menu entries. Simply type the
          # menu entries you want to add after this comment. Be careful not to change
          # the 'exec tail' line above.

          menuentry "Trisquel ISO" {
          set isofile="/Operating_Systems/Trisquel_7.0_i686/trisquel_7.0_i686.iso"
          loopback loop (hd0,5)$isofile
          linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile quiet splash
          initrd (loop)/casper/initrd
          }


          Instruction & Explanation:




          1. The command set is used for storing the path of the ISO file into a variable, here isofile.



          2. loopback is used to make a device from a file system image. In order to do that, it is necessary to specify the device and image file. Here we used (hd0,5)$isofile in which (hd0,5) represents the fifth partition of the disk.




            • Points to note: In (hd0,5) ,
              1st digit represents the device number which starts from 0 (here : 0 = 1st device) and
              2nd digit represents the partition number which starts from 1 (here 5 = 5th partition).
              That means /dev/sda5

            • And variable $isofile has the path of the ISO file. So, finally it becomes (hd0,5)/Operating_Systems/Trisquel_7.0_i686/trisquel_7.0_i686.iso.

            • For more information, visit : How to specify devices and files.






          3. linux command is used to load Linux kernel (vmlinuz) from file. Put the path of Linux kernel in the ISO.





            • Read/extract the content of ISO to get the path of kernel example:



               $ 7z l trisquel_7.0_i686.iso | grep vmlinu
              2014-10-29 21:41:43 ..... 5841680 5841680 casper/vmlinuz
              2014-11-03 00:45:09 ..... 5844176 5844176 casper/vmlinuz.netinst


              so, /casper/vmlinuz was used here.






          4. initrd command is used to load an initial ramdisk for a Linux kernel image, and set the appropriate parameters in the Linux setup area in memory.





            • initrd is a scheme for loading a temporary root file system into memory. Put the path of initrd in the ISO.


            • Read/extract the content of ISO to get the path of initrd:



              $ 7z l trisquel_7.0_i686.iso | grep initrd
              2014-11-03 00:45:19 ..... 16851900 16851900 casper/initrd
              2014-11-03 00:45:09 ..... 9398592 9398592 casper/initrd.netinst





          5. The additional parameter such as boot=casper iso-scan/filename=$isofile noprompt noeject may be specific to a GNU/Linux distribution and vary for another family of Linux. You can find some configurations for different family/distribution from here.



            Note: Some distributions use initrd.gz or initrd.lz depending upon the algorithm/compression used.




          After editing /etc/grub.d/40_custom, GRUB needs to be updated by update-grub2 command. Upon rebooting, you will find the custom menuentry you've added on the GRUB screen. And you may use the Live environment of a GNU/Linux distribution.



          In order to perform installation from ISO, installer may need to unmount any mounted partitions; i.e. say another system is mounted at /isodevice, then you can umount -l /isodevice.



          Hope this helps.






          share|improve this answer























          • Wow, I'm impressed...I would have thought it would be impossible, since installing a new OS often involves reformatting partitions, which could include the partition your ISO file is stored on.
            – Wildcard
            Dec 24 '15 at 8:15










          • Your samples uses GRUB2. Centos 6 uses GRUB1 (grub legacy) and above examples doesn't work.
            – Ikrom
            Dec 4 at 6:02













          up vote
          13
          down vote



          accepted







          up vote
          13
          down vote



          accepted






          Yes, you can accomplish this by adding a menu entry to the GRUB boot loader menu.



          You can add a custom GRUB menu entry by editing /etc/grub.d/40_custom,



          Example of custom menuentry:



           exec tail -n +3 $0
          # This file provides an easy way to add custom menu entries. Simply type the
          # menu entries you want to add after this comment. Be careful not to change
          # the 'exec tail' line above.

          menuentry "Trisquel ISO" {
          set isofile="/Operating_Systems/Trisquel_7.0_i686/trisquel_7.0_i686.iso"
          loopback loop (hd0,5)$isofile
          linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile quiet splash
          initrd (loop)/casper/initrd
          }


          Instruction & Explanation:




          1. The command set is used for storing the path of the ISO file into a variable, here isofile.



          2. loopback is used to make a device from a file system image. In order to do that, it is necessary to specify the device and image file. Here we used (hd0,5)$isofile in which (hd0,5) represents the fifth partition of the disk.




            • Points to note: In (hd0,5) ,
              1st digit represents the device number which starts from 0 (here : 0 = 1st device) and
              2nd digit represents the partition number which starts from 1 (here 5 = 5th partition).
              That means /dev/sda5

            • And variable $isofile has the path of the ISO file. So, finally it becomes (hd0,5)/Operating_Systems/Trisquel_7.0_i686/trisquel_7.0_i686.iso.

            • For more information, visit : How to specify devices and files.






          3. linux command is used to load Linux kernel (vmlinuz) from file. Put the path of Linux kernel in the ISO.





            • Read/extract the content of ISO to get the path of kernel example:



               $ 7z l trisquel_7.0_i686.iso | grep vmlinu
              2014-10-29 21:41:43 ..... 5841680 5841680 casper/vmlinuz
              2014-11-03 00:45:09 ..... 5844176 5844176 casper/vmlinuz.netinst


              so, /casper/vmlinuz was used here.






          4. initrd command is used to load an initial ramdisk for a Linux kernel image, and set the appropriate parameters in the Linux setup area in memory.





            • initrd is a scheme for loading a temporary root file system into memory. Put the path of initrd in the ISO.


            • Read/extract the content of ISO to get the path of initrd:



              $ 7z l trisquel_7.0_i686.iso | grep initrd
              2014-11-03 00:45:19 ..... 16851900 16851900 casper/initrd
              2014-11-03 00:45:09 ..... 9398592 9398592 casper/initrd.netinst





          5. The additional parameter such as boot=casper iso-scan/filename=$isofile noprompt noeject may be specific to a GNU/Linux distribution and vary for another family of Linux. You can find some configurations for different family/distribution from here.



            Note: Some distributions use initrd.gz or initrd.lz depending upon the algorithm/compression used.




          After editing /etc/grub.d/40_custom, GRUB needs to be updated by update-grub2 command. Upon rebooting, you will find the custom menuentry you've added on the GRUB screen. And you may use the Live environment of a GNU/Linux distribution.



          In order to perform installation from ISO, installer may need to unmount any mounted partitions; i.e. say another system is mounted at /isodevice, then you can umount -l /isodevice.



          Hope this helps.






          share|improve this answer














          Yes, you can accomplish this by adding a menu entry to the GRUB boot loader menu.



          You can add a custom GRUB menu entry by editing /etc/grub.d/40_custom,



          Example of custom menuentry:



           exec tail -n +3 $0
          # This file provides an easy way to add custom menu entries. Simply type the
          # menu entries you want to add after this comment. Be careful not to change
          # the 'exec tail' line above.

          menuentry "Trisquel ISO" {
          set isofile="/Operating_Systems/Trisquel_7.0_i686/trisquel_7.0_i686.iso"
          loopback loop (hd0,5)$isofile
          linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile quiet splash
          initrd (loop)/casper/initrd
          }


          Instruction & Explanation:




          1. The command set is used for storing the path of the ISO file into a variable, here isofile.



          2. loopback is used to make a device from a file system image. In order to do that, it is necessary to specify the device and image file. Here we used (hd0,5)$isofile in which (hd0,5) represents the fifth partition of the disk.




            • Points to note: In (hd0,5) ,
              1st digit represents the device number which starts from 0 (here : 0 = 1st device) and
              2nd digit represents the partition number which starts from 1 (here 5 = 5th partition).
              That means /dev/sda5

            • And variable $isofile has the path of the ISO file. So, finally it becomes (hd0,5)/Operating_Systems/Trisquel_7.0_i686/trisquel_7.0_i686.iso.

            • For more information, visit : How to specify devices and files.






          3. linux command is used to load Linux kernel (vmlinuz) from file. Put the path of Linux kernel in the ISO.





            • Read/extract the content of ISO to get the path of kernel example:



               $ 7z l trisquel_7.0_i686.iso | grep vmlinu
              2014-10-29 21:41:43 ..... 5841680 5841680 casper/vmlinuz
              2014-11-03 00:45:09 ..... 5844176 5844176 casper/vmlinuz.netinst


              so, /casper/vmlinuz was used here.






          4. initrd command is used to load an initial ramdisk for a Linux kernel image, and set the appropriate parameters in the Linux setup area in memory.





            • initrd is a scheme for loading a temporary root file system into memory. Put the path of initrd in the ISO.


            • Read/extract the content of ISO to get the path of initrd:



              $ 7z l trisquel_7.0_i686.iso | grep initrd
              2014-11-03 00:45:19 ..... 16851900 16851900 casper/initrd
              2014-11-03 00:45:09 ..... 9398592 9398592 casper/initrd.netinst





          5. The additional parameter such as boot=casper iso-scan/filename=$isofile noprompt noeject may be specific to a GNU/Linux distribution and vary for another family of Linux. You can find some configurations for different family/distribution from here.



            Note: Some distributions use initrd.gz or initrd.lz depending upon the algorithm/compression used.




          After editing /etc/grub.d/40_custom, GRUB needs to be updated by update-grub2 command. Upon rebooting, you will find the custom menuentry you've added on the GRUB screen. And you may use the Live environment of a GNU/Linux distribution.



          In order to perform installation from ISO, installer may need to unmount any mounted partitions; i.e. say another system is mounted at /isodevice, then you can umount -l /isodevice.



          Hope this helps.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Sep 6 at 13:38

























          answered Dec 23 '15 at 7:31









          Pandya

          8,4841349103




          8,4841349103












          • Wow, I'm impressed...I would have thought it would be impossible, since installing a new OS often involves reformatting partitions, which could include the partition your ISO file is stored on.
            – Wildcard
            Dec 24 '15 at 8:15










          • Your samples uses GRUB2. Centos 6 uses GRUB1 (grub legacy) and above examples doesn't work.
            – Ikrom
            Dec 4 at 6:02


















          • Wow, I'm impressed...I would have thought it would be impossible, since installing a new OS often involves reformatting partitions, which could include the partition your ISO file is stored on.
            – Wildcard
            Dec 24 '15 at 8:15










          • Your samples uses GRUB2. Centos 6 uses GRUB1 (grub legacy) and above examples doesn't work.
            – Ikrom
            Dec 4 at 6:02
















          Wow, I'm impressed...I would have thought it would be impossible, since installing a new OS often involves reformatting partitions, which could include the partition your ISO file is stored on.
          – Wildcard
          Dec 24 '15 at 8:15




          Wow, I'm impressed...I would have thought it would be impossible, since installing a new OS often involves reformatting partitions, which could include the partition your ISO file is stored on.
          – Wildcard
          Dec 24 '15 at 8:15












          Your samples uses GRUB2. Centos 6 uses GRUB1 (grub legacy) and above examples doesn't work.
          – Ikrom
          Dec 4 at 6:02




          Your samples uses GRUB2. Centos 6 uses GRUB1 (grub legacy) and above examples doesn't work.
          – Ikrom
          Dec 4 at 6:02


















          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.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • 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%2f251079%2fhow-do-i-boot-from-iso-file-stored-on-hard-disk%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