0

I have a Windows 7 Laptop from a friend where he wants me to install Linux for him to try. The MBR partition table is already full, so there is no option to add another partition and install Linux there. It is a Lenovo G470 ancient machine that has some strange recovery partitions -- I don't really want to mess with these if I can avoid it.

My idea is to copy a Live ISO-image, for example Ubuntu, to the Windows partition and then add Grub2 or another boot manager to directly boot into the ISO image as an additional option besides booting into Windows 7. So:

How do I configure GRUB2 when running Knoppix to write itself to the MBR or partition X of the hard disk, containing an entry for the existing Windows, and one for the loopback mounted ISO file inside the NTFS partition Y?

I know this can be done because I actually have done that on another machine -- but I cannot remember how I did it. The boot entry there looks like:

menuentry "Ubuntu ISO" {
        set isofile="/data/boot/ubuntu-19.04-desktop-amd64.iso"
        set CASPER=(hd0,1)/data/boot/casper-rw
        loopback loop (hd0,1)$isofile
        linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile noprompt noeject persistent
        initrd (loop)/casper/initrd
}

Can anyone give me a pointer how to do that? I can boot a Live CD, for example Knoppix, and I think I did it using this Live CD on the other machine, but it was some years back and I unfortunately did not write down any notes.

4
  • What are you asking for? You just showed how to set up grub to do what you want. – psusi Apr 6 at 16:01
  • The question is how to install grub to use this line and the existing Windows when booting the machine from Knoppix. I am missing the workflow how to achieve that. Do I have to write a configuration file? How does it look? – hochl Apr 7 at 10:12
  • You showed how the configuration file looks in your question. Are you just asking how to install grub on the machine so that it uses that configuration? – psusi Apr 7 at 15:35
  • Exactly! I am unsure how I installed Grub to the other machine from Knoppix. – hochl Apr 8 at 11:19
3

You will have to let Grub overwrite the boot sector, and from then on, Grub will manage all booting operations, including booting windows. I don't know if Grub can read from a NTFS formatted partition though, so you'll need to create one new primary partion to hold your boot files and ISO images. You may need to shrink the windows partition a bit in order to make some space for that new partition.

In case there are already 4 primary partitions on that disk, then you'll have to resort to cannibalizing one of those "strange" recovery partitions.

But if your friend really wants Linux "just to try", then he can do this by booting from a USB key. Then you don't need to mess with the partitions just yet.

1
  • Unfortunately all partitions are used :( One is a W95/extd partition, I think for the recovery files, so I might put GRUB there. I'm not sure what will happen, i.e. if the laptop has some special boot sector or such. I made a backup of /dev/sda with dd of the first 200MB. Using a USB Stick would be an option, but I would prefer if the machine just booted into Linux by default, and Windows could be booted only if really needed. – hochl Apr 6 at 10:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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