歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> Linux資訊 >> 更多Linux >> 硬盤改變位置之後重新安裝GRUB以及修改相應文件的方法

硬盤改變位置之後重新安裝GRUB以及修改相應文件的方法

日期:2017/2/27 9:22:31   编辑:更多Linux
  摘要 修改GRUB(2003-09-22 09:50:49) By seraphim Author:Seraphim(張樂奕) Mail:[email protected] Date:2003-08 問題描述: 原來系統是裝在計算機第二個IDE口上(hdc),mount了另外一塊hda到/u01下面。 現在想把這兩塊硬盤的位置對調一下,hda->hdc,原來的hdc->hda,請問我該如何修改GRUB的配置? 當前硬盤配置和GRUB配置如下所示: Linux:/home/zhangleyi # fdisk -l Disk /dev/hdc: 10.2 GB, 10262568960 bytes 16 heads, 63 sectors/track, 19885 cylinders Units = cylinders of 1008 * 512 = 516096 bytes Device Boot Start End Blocks Id System /dev/hdc1 * 1 25 12568+ 83 Linux /dev/hdc2 26 2522 1258488 82 Linux swap /dev/hdc3 2523 19885 8750952 83 Linux Disk /dev/hda: 20.5 GB, 20576747520 bytes 255 heads, 63 sectors/track, 2501 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/hda1 * 1 2501 20089251 83 Linux linux:/home/zhangleyi # more /etc/grub.conf root (hd0,0) install --stage2=/boot/grub/stage2 /grub/stage1 d (hd0) /grub/stage2 0x8000 (hd0,0)/grub/menu.lst quit linux:/home/zhangleyi # more /boot/grub/menu.lst # Modified by YaST2. Last modification on Sat Aug 2 09:56:00 2003 gfxmenu (hd1,0)/message color white/blue black/light-gray default 0 timeout 8 title linux kernel (hd1,0)/vmlinuz root=/dev/hdc3 vga=791 splash=silent initrd (hd1,0)/initrd title floppy root (fd0) chainloader +1 title failsafe kernel (hd1,0)/vmlinuz.shipped root=/dev/hdc3 ide=nodma apm=off acpi=off vga=normal nosmp maxcpus=0 disableapic 3 initrd (hd1,0)/initrd.shipped linux:/home/zhangleyi # 首先感謝www.linuxsir.com的beyond_2000斑竹的耐心解釋,才有了這篇東西的誕生。 其次,對於GRUB的詳細解釋,可以用info grub得到。 目的: 本來系統安裝在hdc上(也就是第二個IDE接口的primary位置上),GRUB裝在另一塊硬盤hda上,現在想把這兩塊硬盤位置對調一下。 方法: 首先more /etc/fstab,確認當前有幾個獨立的文件系統,我的機器情況如下: /dev/hdc3是/,/dev/hdc1是/boot,/dev/hdc2是swap。 1. 關機,把硬盤的連線從hdc改成hda 2. 用SuSE安裝盤的CD1啟動計算機 3. 在啟動菜單中選擇rescue 4. 輸入root,不需要密碼,進入rescue命令行 5. pwd,可以看到當前目錄為/root,退回到/ 5. 鍵入grub,進入grub命令狀態 6. find /boot/grub/stage1,該命令用於確認包含boot所需文件的目錄,顯示hd0,0 7. root (hd0,0) 8. setup (hd0) 顯示成功安裝GRUB 9. quit,退出grub命令行狀態 10. mount /dev/hda1 /tmp (備注:沒有該硬盤連線之前是hdc,現在是hda了,該命令將mount原先的/boot分區)


11. mount /dev/hda3 /usr (備注:該命令將mount原先的/分區) 12. vi /tmp/grub/menu.lst,將所有的hd1改為hd0,hdc改成hda,存盤退出 13. vi /usr/etc/fstab, 將所有的hdc改成hda,hda改成hdc,存盤退出 14. 重啟計算機,OK



Copyright © Linux教程網 All Rights Reserved