Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 09-13-2013, 02:11 AM   #1
Senior Member
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,283

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
GRUB2: How to change partition that it loads from?

From an older install, I have /dev/sda1 which was previously mounted as /boot. sda1 contains legacy GRUB along with menu.lst and stage 2 files. I used to manually copy kernels for various installations to sda1 and manually edit menu.lst to allow booting of different distros in different partitions.

Now on to current times: I still have the original sda1, but other partitions have been cleared and new partitions created. I created sda2 to be mounted as /home, sda3 to be mounted as swap, and then installed LinuxMint into the first logical partition sda5. Mint (13 - Maya) uses GRUB2, and all the GRUB2 files, including it's generated grub.cfg file are there on sda5 with the rest of Mint. Now two more distros have been installed on sda6 and sda7. update-grub picked up the one on sda6 and correctly added it to grub.cfg when I ran update-grub. I manually added the distro on sda7 (System RescueCD) by editing /etc/grub.d/40_custom, then a few minor changes in /etc/default/grub, and finally re-ran update-grub.

Everything is fine. I can choose the distro to run when the system boots. Everything works as expected.

But I am concerned that the bootloader is now tied into the Mint installation on sda5. If I were to nuke sda5 and kill Mint to reclaim sda5 for some other use, then obviously the GRUB2 files would be gone and I'd have a broken bootloader situation I'd need to fix.

Enough backgound, here's the question:

How do I rework GRUB2 so that it runs out of sda1 so that it is not tied into a specific distro install (as it is currently tied to the Mint install in sda5)? I think I would have to run some grub installation command to change the location of grub.cfg to sda1 (and other grub files to there as well). And that command would also have to modify the startup code in the MBR and probably some code that (I assume) GRUB2 would have previously installed in track0 of the harddisk.

p.s. - this is an older system that does NOT support GPT so that route of making GRUB2 independent of a "master" distro install is not available to me. I don't know much about GPT, but I believe it allows a seperate "special" boot partition - doesn't matter though, as this system does not support GPT.

Last edited by haertig; 09-13-2013 at 02:13 AM.
Old 09-13-2013, 02:53 AM   #2
Senior Member
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Checkout grub-install command. It got the option --boot-directory which installs grub to non default location /boot.

So you would mount sda1 somewhere and then run grub-install. Also you would have to do this after every kernel upgrade, new initramfs due to your system using the default location. Maybe just use your sda1 as the real /boot mount partition. And this for every distro you have installed. So you have to check on duplicate names of kernel and a like. Or just have a super minimal distro installed into sda1 and always but it up after kernel changes on any distro. Maybe Tinycore or something alike.

Just for sports GPT is just another partition schema. (U)EFI goes for the extra boot partition.
Old 09-13-2013, 07:26 AM   #3
Registered: Jul 2013
Distribution: Mint KDE
Posts: 74

Rep: Reputation: Disabled
Be glad you're not using EFI. Grub2 appears to be using three partitions on my system right now. EFI passes it to Ubuntu installation which then passes to Mint. And since Grub's config files are on a different distro's root partition they're not even mounted. What a @#$%ing kludge! They really screwed it up.
Old 09-13-2013, 08:00 AM   #4
Senior Member
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Also you could directly boot a kernel through the UEFI model. Not sure how but I read some about it. That seems quite need. Come to thinking about it I recall coreboot has some info about this.
Old 09-13-2013, 10:54 AM   #5
LQ Guru
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 8,906

Rep: Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859Reputation: 1859
You make sda1 a separate boot partition the way you originally had it with Grub Legacy. Take a look at the last post in the link below for an example of how another member did it:

You should also put an entry in the /etc/fstab for the boot partition.

If you still have Grub Legacy and whichever distro you used with that, you can continue using a separate boot partition for Grub Legacy. I use Grub Legacy as the primary bootloader. When I install to test a system using Grub2, I use the entry below and install them on sda5 and don't have to make any change to the menu entry of menu.lst. I've installed a number of distributions using Grub2 and don't need to change the entry as they all boot:

title Ubuntu-12.04 on sda5
root (hd0,4)
kernel /boot/grub/core.img
You could also use the chainload method. The last two lines in the entry are usually not necessary so are commented out. I needed them for one of the installations but don't recall which.
Old 09-14-2013, 12:55 PM   #6
Senior Member
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,283

Original Poster
Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
SOLVED (ended up leaving it as-is)

Thanks for the replies and suggestions.

When I started this thread, I was in a place far from home helping with anothers computer (redo-ing it from scratch basically). While there I did not have the time to play with the GRUB2 thing too much. So I ended up just leaving it as it was - with GRUB2 files in the sda5 partition and dependent on the LinuxMint install. It boots fine this way. Moving all the bootloader stuff to sda1 was not a critical issue, just something I had hoped to do while there given enough time. Now I'm back at my home and messing with the bootloader remotely is something more than I really want to do! Even though I left a bootable LiveCD that gives me SSH access, the person left on the remote end is not computer savvy at all and it would be a nightmare asking them to "Insert the LiveCD, reboot, wait for me to make changes, remove the CD, reboot, tell me what is happening now". So I just left things as they were with the boot being directed from sda5.

Thanks again for the help and suggestions. I just ran out of time to explore them far enough to implement something different than sda5.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
grub2 can't see my win 7 partition and yast2 bootloader can't reinstall grub2 jjrojaspy SUSE / openSUSE 5 07-07-2013 11:38 PM
change to grub legacy from grub2 houndhen Linux - Software 1 03-22-2013 11:16 AM
Dual monitors- change where display window loads dlemas Linux - Newbie 9 09-13-2009 02:50 PM
how do I change the firmware that wi loads into the card mike105105 *BSD 1 04-16-2006 05:15 AM
I have XP/redhat dualboot, how can i change it so that windows loads by default? chanceK Linux - Newbie 4 07-08-2003 12:39 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:30 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration