Fedora Linux Support Community & Resources Center
  #1  
Old 3rd November 2012, 04:19 AM
badwithnames Offline
Registered User
 
Join Date: Aug 2012
Location: Texas
Posts: 5
linuxchrome
How to move /boot between partitions, under GRUB2

Hi everyone. I have an 80 MB /boot partition, which is obviously a problem. I'd like to move the contents of that partition into the /boot directory on my root partition, and change my boot process to no longer mount the /boot partition and instead boot from my root partition. I would say I'm an intermediate Linux user, but I also learned most of what I know about GRUB when they were still in what they now call legacy GRUB. Since I am currently using GRUB2 I was hoping I could get a bit of help, seeing as my boot configuration is not the kind of thing I want to muck up while learning how to configure GRUB2 properly. Any help would be tremendous.
Reply With Quote
  #2  
Old 3rd November 2012, 06:45 AM
weitjong Offline
Registered User
 
Join Date: Oct 2006
Location: Singapore, 新加坡
Posts: 948
macossafari
Re: How to move /boot between partitions, under GRUB2

I think you need to boot into your system in rescue/recovery mode using Fedora installation media. Once you are in chroot shell, do this:

0. Before everything, backup.

1. Determine which partition has the current /boot mountpoint.
# lsblk

Let's just assume that /boot is mounted from, say, /dev/sda1 partition. Change this according to your own output.

2. Unmount the existing /boot partition.
# umount /boot

3. Mount partition temporarily to other mount point
# mount /dev/sda1 /mnt

4. Copy the content of "/boot partition" to "/boot directory".
# cp -a /mnt/* /boot

5. Tell the system not to automatically mount from /dev/sda1 partition to /boot mountpoint again.
# perl -pi.bak -e 's/(^.+\s+\/boot\s+)/#$1/g' /etc/fstab

Actually, it is easier to open /etc/fstab in vi (or using your favorite editor) and add a "#' to comment out the line that have "/boot" keyword.

6. Fix the grub2 menu entries. This will modify the grub.cfg in the new "/boot directory", which is exactly what we want.
# grub2-mkconfig -o /boot/grub2/grub.cfg

7. Reboot. If everything goes well, you should now boot from /boot directory. Double check that by using lsblk command again. You should not see /boot mountpoint anymore.

Note that we have not reclaimed the space of the "old" /boot partition yet. So, if the above does not work for you, you can still revert back easily. Good luck.
__________________
YaoWT - Leave no window unbroken ♪ (^。^) 

Last edited by weitjong; 4th November 2012 at 03:15 AM.
Reply With Quote
  #3  
Old 3rd November 2012, 07:24 AM
DBelton Offline
Administrator
 
Join Date: Aug 2009
Posts: 7,334
linuxfirefox
Re: How to move /boot between partitions, under GRUB2

Good instructions weitjong...

But, just to be certain, I would add a step to reinstall the bootloader as well..

In your step # 6 above, add the command to install the bootloader...

grub2-install /dev/sda
(The above assumes the bootloader was installed to the boot sector of the first hard drive.. adjust as necessary to match where yours is installed)

The grub2 bootloader will be looking for the grub.cfg file in the old /boot partition, and you need to reinstall it so it points to the new location.

Edit:

One other thing you should do BEFORE trying any of this...

Get you either a LiveCD or the install DVD. If something goes wrong, you can then boot from the LiveCD or DVD into recovery mode and fix the problems.

Last edited by DBelton; 3rd November 2012 at 07:31 AM.
Reply With Quote
  #4  
Old 3rd November 2012, 08:36 AM
weitjong Offline
Registered User
 
Join Date: Oct 2006
Location: Singapore, 新加坡
Posts: 948
macossafari
Re: How to move /boot between partitions, under GRUB2

Quote:
Originally Posted by DBelton View Post
One other thing you should do BEFORE trying any of this...

Get you either a LiveCD or the install DVD. If something goes wrong, you can then boot from the LiveCD or DVD into recovery mode and fix the problems.
Which is exactly why I ask him to do the steps in the rescue/recovery mode in my post earlier. All the steps that I mentioned above are actually doable in a normal system boot. I agree with you that any small wrong move then one would have to recover the system using the rescue/recovery mode anyway. So I reason it is good to get familiar with the recovery environment at the beginning of the steps.
__________________
YaoWT - Leave no window unbroken ♪ (^。^) 

Last edited by weitjong; 3rd November 2012 at 08:38 AM.
Reply With Quote
  #5  
Old 3rd November 2012, 10:21 PM
badwithnames Offline
Registered User
 
Join Date: Aug 2012
Location: Texas
Posts: 5
linuxchrome
Re: How to move /boot between partitions, under GRUB2

Thanks, weitjong and DBelton! It worked! I actually did it without recovery mode, and afterward I ran `yum install kernel` to get myself the latest kernel and allow yum to do the normal cleanup it does when I've deleted kernels in the past (to make more room for newer ones).
Reply With Quote
  #6  
Old 4th November 2012, 07:58 AM
weitjong Offline
Registered User
 
Join Date: Oct 2006
Location: Singapore, 新加坡
Posts: 948
macossafari
Re: How to move /boot between partitions, under GRUB2

You are welcome.

Quote:
Originally Posted by badwithnames View Post
... and afterward I ran `yum install kernel` to get myself the latest kernel ...
Lucky you .
__________________
YaoWT - Leave no window unbroken ♪ (^。^) 
Reply With Quote
Reply

Tags
grub2, or boot, partitions

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Grub2 boot menu F/16 KDE rich52 Using Fedora 2 8th February 2013 05:48 AM
[SOLVED] F17 upgrade does not boot with grub2 janvlug Installation, Upgrades and Live Media 0 19th June 2012 08:27 AM
[SOLVED] How do I fix grub2 boot? splatt Using Fedora 0 8th December 2011 01:22 AM
can move partitions in Fedora 5? knot2afrayed Using Fedora 9 24th September 2006 03:53 AM


Current GMT-time: 01:20 (Monday, 24-11-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat
Bellaire Photos - Luziania Photos on Instagram - East Brainerd Photos