Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have copied an ISO file into a partition (i.e. dd if=isofile of=/dev/sdb1). How can I boot into that partition via GRUB?

When I try just with chainloader (hd1,0)+1, it says unknown executable format.

share|improve this question
3  
Looks like a duplicate of superuser.com/questions/154133/grub-boot-from-iso –  BloodPhilia Jun 18 '10 at 14:31
2  
Leave this question and close the other. This one have more info. –  Nifle Jun 18 '10 at 14:46
    
@Nifle, I agree. –  BloodPhilia Jun 18 '10 at 14:49
2  
No, I am asking a different thing. I have the content of the ISO file here in a partition and I asked how I can boot that partition. –  Albert Jun 18 '10 at 15:26
    
which version of grub? –  quack quixote Jun 18 '10 at 17:08
add comment

1 Answer

up vote 3 down vote accepted

See my answer on your boot-from-ISO-files question. Using that as a starting point, I ran some tests with an old hard-drive. I've previously configured Grub2 to boot a multi-ISO flash drive, so what I did was:

  1. Create a couple of partitions on an old hard drive. This was done using a USB-to-IDE adapter, so the drive appears as /dev/sdb.

    • Partition 1: FAT32, ~2GB in size
    • Partition 2: unformatted


  2. Mounted the first partition to /mnt and installed a copy of Grub from my system onto the drive:

    sudo grub-install --no-floppy --root-directory=/mnt /dev/sdb
    


  3. "Burned" an ISO to the second partition:

    sudo dd if=avg.iso /dev/sdb2
    


  4. This is an AVG virus-scanner ISO; on my multi-ISO flash drive, I use this to boot the ISO directly:

    menuentry "AVG Rescue CD" {
       loopback loop /iso/avg.iso
       linux (loop)/isolinux/vmlinuz max_loop=255 vga=791 init=linuxrc iso-scan/filename=/iso/avg.iso
       initrd (loop)/isolinux/initrd.lzm
    }
    

    In order to make this work from a hard drive partition, we need to nix the loopback command and set the root device and such. My attempts to have Grub2 discover the root device automagically all failed, so I pointed it at the partition directly. This works, but watch out for Grub's device enumeration; the drive you're trying to boot from may not be (hd0). Here's a working entry for the ISO partition:

    menuentry "AVG Rescue CD" {
       linux (hd0,2)/isolinux/vmlinuz max_loop=255 vga=791 init=linuxrc
       initrd (hd0,2)/isolinux/initrd.lzm
    }
    

    This results in a bootable ISO-on-partition.

This works because Grub2 can read ISO9660 filesystems, because this particular ISO is loading an OS that can cope with an ISO on a partition, and because practically everything the kernel loads is in the initrd.


If you're using Grub4DOS or Grub 1, you may be able to pull a similar trick with the chainloader. Presuming that this works to boot the Win7 ISO directly (source):

title Windows 7
  map (hd0,0)/win7.iso (hd32)
  map --hook
  chainloader (hd32)

You may have luck with this modification (assuming you "burned" the ISO to the second primary partition, (hd0,1); otherwise substitute the proper partition):

title Windows 7
  map (hd0,1) (hd32)
  map --hook
  chainloader (hd32)

You may also get away with this:

title Windows 7
  chainloader (hd0,1)

However, the ISO isn't really configured to boot from a drive, so you may run into other problems.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.