بوت نشدن لینوکس Installing GRUB natively
Installing GRUB natively
گراب فایلیست همانند فایل boot در ویندوز که به دلیل پاک شدن یا ایجاد مشکل در آن سیستم بالا نمی آید و برای حل مشکل میتوان با rescue mode به داد سیستم رسید در اینجا توضیحی مبنی بر این که به احیای سیستم بپردازیم پرداخته شده است . در بخش اول با تغییر روت سیستم باعت برگرداندن دستورات و مسیر ها میشویم در بخش دوم نصب فایل گراب در ابتدای هارد برای بوت شدن سیستم
بخش اول
red Hat Enterprise Linux 6 – How to restore Grub.
1. Boot from RHEL6 DVD.
2. Select “Rescue installed system”.
3. Choose -> Language, Keyboard, and Rescue Method. Select “Local CD\DVD” for the Rescue Method.
4. Setup Networking -> Yes or No, doesn’t matter for restoring Grub.
5. Next on the “Rescue Screen”, select Continue and OK twice.
6. Next on the “First Aid Kit quickstart menu”, select “shell Start shell”.
The prompt will start:
Starting shell…
bash-4.1#
7. Type: “chroot /mnt/sysimage”
8. Type: “cd /boot/grub”
9. Type: “fdisk -l” to see where hd0.
10. Restore Grub, type: “grub-install /dev/sda1”
If No error, it should display:
# this device map was generated by anaconda
(hd0) /dev/sda
بخش دوم
Caution: Installing GRUB's stage1 in this manner will erase the normal boot-sector used by an OS.
GRUB can currently boot GNU Mach, Linux, FreeBSD, NetBSD, and OpenBSD directly, so using it on a boot sector (the first sector of a partition) should be okay. But generally, it would be a good idea to back up the first sector of the partition on which you are installing GRUB's stage1. This isn't as important if you are installing GRUB on the first sector of a hard disk, since it's easy to reinitialize it (e.g. by running `FDISK /MBR' from DOS).
If you decide to install GRUB in the native environment, which is definitely desirable, you'll need to create a GRUB boot disk, and reboot your computer with it. Otherwise, see Installing GRUB using grub-install.
Once started, GRUB will show the command-line interface (see Command-line interface). First, set the GRUB's root device1 to the partition containing the boot directory, like this:
grub> root (hd0,0)
If you are not sure which partition actually holds this directory, use the commandfind(see find), like this:
grub> find /boot/grub/stage1
This will search for the file name/boot/grub/stage1and show the devices which contain the file.
Once you've set the root device correctly, run the commandsetup(see setup):
grub> setup (hd0)
This command will install the GRUB boot loader on the Master Boot Record (MBR) of the first drive. If you want to put GRUB into the boot sector of a partition instead of putting it in the MBR, specify the partition into which you want to install GRUB:
grub> setup (hd0,0)
If you install GRUB into a partition or a drive other than the first one, you must chain-load GRUB from another boot loader. Refer to the manual for the boot loader to know how to chain-load GRUB.
After using the setup command, you will boot into GRUB without the GRUB floppy. See the chapter Booting to find out how to boot your operating systems from GRUB.