LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices


Reply
  Search this Thread
Old 10-23-2006, 07:58 AM   #1
144419855310001
Member
 
Registered: Apr 2006
Distribution: ubuntu 7.04
Posts: 219

Rep: Reputation: 30
Unhappy Repartioned with gparted, now nothing will boot...


I just resized and moved the partitions on my hard drive as my linux partition (FC5 x86_64) needed more space, and now startup stops with GRUB.

I'd only just completed about 1GB of updates with "yum update" as well!... sob...

When I switch on my computer, instead of the grub menu appearing, everything stops at a black screen with just the word

Quote:
GRUB
I'm guessing Grub may have been rearranged/is lost. Does Grub need reinstalling? How would I go about rescuing it? I know FC6 is about to come out, but I don't really have the time to reinstall everything, and am happy at the moment with FC5 (I was planning on waiting for FC7, which is why I'd just done a yum update)

The linux-rescue (on the fc cd) was having problems too... although typing "chroot" behaved as normal (outputting chroot --help), "chroot /mnt/sysimage" failed, saying

Quote:
$chroot /mnt/sysimage
chroot: cannot execute /bin/sh: Exec format error
Grub-install also failed; this time it couldn't find it, becuase chroot /mnt/sysimage failed, I guess. I can still browse my linux partition with cd /mnt/hda2 and ls, etc. though, so it is definitely mounted.

I don't know whether this is related, as it may be to do with the install-cd. I'm using FC5 i386 disc1. I've also tried the FC5 x86_64 dvd, but that wouldn't even enter rescue mode! As soon as the Fedora partition had been automatically mounted by anaconda, it unmounted everything and powered off!

(Fortunately I had a knoppix boot disc lying around, which is why I'm online at LQ now.)


All help appreciated, I need my computer working ASAP!

Last edited by 144419855310001; 10-23-2006 at 08:45 AM.
 
Old 10-23-2006, 08:43 AM   #2
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
Rearranging the partitions on the disk does not move the physical location of the files. This means that if you change the starting point of a partition it will not have the file structure beginning at the start of the partition. If you keep the same starting point but change the end point then GRUB can find the its menu and boot files. You did't say how your partitions are laid out. In general the first partition should be bootable because whether you increase or decrease the size of the partition it will still keep the same starting location on the disk. The following partitions will probably not survive a partition resizing if you change the starting point of the partition on the disk.

If GRUB has its configuration and boot files on any partition except the first partition then it has no way to find its configuration and boot files.

If the first parition was used for Windows then you should be able to recover that operating system using the Windows rescue cd and running the fixboot utility. That will overwrite grub with a Windows boot loader. When you boot Windows for the first time it will automatically run chkdsk and fix the endpoint of the file system.

If the first partition had Linux and the GRUB boot files then you should be able to boot the operating system on the first partition.

Recovery is only possible if you can put the partitions back the way that they were before the resizing. You probably cannot manually restore the partitions to start on the exact block that they had started on before the resizing. There is a free utility that is designed to restore disk partitions. It is called Test Disk and it is available at the following location.
http://www.cgsecurity.org/wiki/TestDisk_Download

One thing that you should do before resizing partitions is to back up the partition table on another disk. It's very easy. If you only have primary partitions then you use the dd command to back up the MBR of the disk that you are going to resize. If you have extended partitions then you use both dd to back up the MBR and sfdisk to back up the extended partition structure. If you wanted to resize /dev/hda1 and you wanted to back up to /dev/sda1 then you could do the following.
Code:
mount /dev/sda1 /mnt
dd if=/dev/hda of=/mnt/mbr-hda.dd bs=512 count=1 conv=notrunc,noerror
sfdisk -d /dev/hda > /mnt/mbr-hda.sfdisk
When you resize partitions you should generally expect to reformat the file system on each partition and restore data from backups.

Last edited by stress_junkie; 10-23-2006 at 08:52 AM.
 
Old 10-23-2006, 08:46 AM   #3
144419855310001
Member
 
Registered: Apr 2006
Distribution: ubuntu 7.04
Posts: 219

Original Poster
Rep: Reputation: 30
just made an edit to the first post by the way

...back soon
 
Old 10-23-2006, 10:21 AM   #4
oneandoneis2
Senior Member
 
Registered: Nov 2003
Location: London, England
Distribution: Ubuntu
Posts: 1,460

Rep: Reputation: 48
If you move your partitions, grub will loose its config file. Because grub has a command-line, this is only a minor inconvenience if you know how to use grub.

At the grub prompt, type in "root (hd" and then press tab once or twice (I'm not near a PC that has grub installed, so this is all from memory) and grub's command-completion will helpfully show you all the possible hard drives & partitions it can use as root.

If your Linux install was on /dev/hda1, grub will find it on hd0,0 - so you would type "root (hd0,0)"

This will then mount your Linux root partition from grub. You should now find your grub menu config file in /boot/grub, and you can tell grub to use that config file with (IIRC) the "menu" command

This will give you your usual bootup menu, which should work fine if all you did was resize the partitions. If you re-arranged them, you'll have to tell grub manually where to find your kernel and what boot-time options it needs in order to boot.

Any good online guide to grub will tell you what you need to know to boot your Linux system using nothing but the grub prompt - Google for a few of them!
 
Old 10-23-2006, 11:38 AM   #5
144419855310001
Member
 
Registered: Apr 2006
Distribution: ubuntu 7.04
Posts: 219

Original Poster
Rep: Reputation: 30
Quote:
At the grub prompt
Sorry. I don't know why I said "prompt"; it just freezes with the word "GRUB" in the top left hand corner.

Basically, I shrunk my windows partition (hda1) by 10GB, moved my linux partition 10GB to the left, and then expanded it to fill up all the remaining space. Grub was on the MBR on hda1 I think (the standard for the dual boot system, perhaps?).

Quote:
If the first parition was used for Windows then you should be able to recover that operating system using the Windows rescue cd and running the fixboot utility. That will overwrite grub with a Windows boot loader. When you boot Windows for the first time it will automatically run chkdsk and fix the endpoint of the file system.
...This will only fix things for windows though? Will this aid the repair of GRUB?

Quote:
When you resize partitions you should generally expect to reformat the file system on each partition and restore data from backups.
Hmmm... I thought the point of the latest gparted release was that it enabled you to resize and move partitions *without* messing everything up, as with fdisk, etc...

Quote:
Recovery is only possible if you can put the partitions back the way that they were before the resizing.
So there's no possible way of fixing GRUB given the description I've written of the way I have altered the partitions? The movement descriptions I have above are only approximations; I cannot remember how much I displaced the linux partition precisely! (So I doubt that I'd be able to move them back to their original positions).


...I really don't want to have to reinstall linux (not after all those yum updates). I am a bit stumped as to what I should do. Do you think the problem with "chroot /mnt/sysimage" is just to do with the live cds? Because of this the suggestions I've tried from google don't seem to be working (i.e. grub-install).

Last edited by 144419855310001; 10-23-2006 at 11:40 AM.
 
Old 10-23-2006, 12:06 PM   #6
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
I just read the on line user manual for GNU parted. The manual does not specifically state that the resize command will move the file structure to fit the new start point of a resized partition. Therefore I would not expect it to do so. The main difference between using gparted and fdisk to resize a partition is that if you make a partition smaller and keep the beginning of the partition in the same place then gparted will safely shrink the partition. You can also increase the size of a file system for some file system types by moving the partition end point further from the start point. However, if you move the start point of a partition then the file system structure starts in the wrong place on the disk.

http://www.gnu.org/software/parted/m...ed.html#resize
 
Old 10-23-2006, 12:22 PM   #7
144419855310001
Member
 
Registered: Apr 2006
Distribution: ubuntu 7.04
Posts: 219

Original Poster
Rep: Reputation: 30
Fixed it! I tried downloading the rescue cd from the website rather than using the rescue modes from the various fc5 install cds I have, which I managed to use to fix the problem.

Quote:
chroot /mnt/sysimage
grub-install /dev/hda
Pretty easy, really. It was just those strange errors I was recieving to do with "chroot /mnt/sysimage" using those what I now realise to be *corrupted* install cds that had me a little worried.

Quote:
However, if you move the start point of a partition then the file system structure starts in the wrong place on the disk.
Another thing... perhaps the gparted documentation, and notices when you're using the CD (of the "are you sure you're sure you want to do this?" variety should make it clearer that if you're going to be moving partitions around that you might need to reinstall grub?

...I personally didn't realise this (not knowing anything much about hardware).
 
  


Reply


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
gParted Help carlosinfl Linux - Software 6 09-26-2006 09:41 PM
LXer: Partitioning with GParted LXer Syndicated Linux News 0 08-07-2006 12:03 PM
After using Gparted tombiz Ubuntu 5 07-13-2006 05:38 PM
gParted tutorial Infernolinux Linux - Software 0 12-09-2005 12:04 AM
GParted mtecknology Linux - Software 1 07-25-2005 11:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora

All times are GMT -5. The time now is 12:28 AM.

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