Fedora使用LiveCD或USB修複GRUB2引導

來源:互聯網
上載者:User

Fedora使用LiveCD或USB修複GRUB2引導 用 LiveCD 或 USB 啟動之後,首先應該明確的是你的 Fedora 裝在哪個分區,現在的硬碟都應該是 SATA 的吧,那麼就對應 /dev/sda#,#是個數字,1~4表示主要磁碟分割,5開始是邏輯分區。如果你在可伶的用著 IDE 硬碟,那麼就對應/dev/hda#。  www.2cto.com  開啟你的磁碟工具 + 生產力,或者叫 Disk unity,找到 Fedora 安裝所在分區,我的在 sda10,所以下面就拿這個說明了。 1su2mount-t ext4 -o rw/dev/sda10/media 把 Fedora 的安裝分區掛載到當前的 LiveCD 檔案系統下,當然如果你比較偷懶的話,比如我:),直接在檔案管理工具裡面雙擊一下那個分區,然後就會在/media/_FEDORA_*** 下掛載了。  www.2cto.com   原來安裝在硬碟上的 Fedora只是把檔案目錄掛上來了,一點硬體資源也木有,啥事也幹不了,只能用來 copy/paste 一下資料,現在把當前系統的資源給他: 1su2mount-t proc none/media/proc3mount-o bind/dev/media/dev4mount-o bind/sys/media/sys5mount-t devpts devpts/media/dev/pts特別看清楚上面的指令,千萬別把 /dev 寫成了 /dev/,如果這樣就會出現:/dev is not a block device 了。 掛完後用 chroot 命令切換到原來的 Fedora 中去:  1su2chroot/media3grub2-install/dev/sda當然上述指令是講 grub2 安裝到硬碟 MBR 上恢複引導,如果你想裝在當前分區中讓其他軟體來引導就應該是: grub2-install /dev/sda10 OK,做下掃尾工作: 1exit2umount/media/proc3umount/media/dev/pts4umount/media/sys5umount/media/dev6umount/media7reboot 當然,上述修複的 grub 是原來的 grub,其實grub2很強大,能自動識別 N 多系統,只需重建配置 檔案即可: 1su2grub2-mkconfig  -o /boot/grub2/grub.cfg3reboot Congratulations! 今天在幫別人修複的時候,又遇到一些問題,寫下來分享: 首先,這台電腦的分區並不是我上面寫的簡單的一個 / 分區,用的 LVM 和一個 boot 分區 sda8,那麼在掛載的時候就要分別掛載了。在 LVM 裡有一個 root 的邏輯卷組和一個 swap 卷組,位於 /dev/mapper/vg_fedora_root,和 /dev/mapper/vg_fedora_swap(這個的取名是自己定義的,如果採用系統自己預設的分區安裝,不是手動的話,名字不同) 1su2mount-o rw /dev/mapper/vg_fedora_root/media3mount-o rw/dev/sda8/media/boot然後掛載上述寫的資源。 其次,在執行grub2-install 的時候,遇到錯誤: 1[root@localhost]# grub2-install /dev/sda2/sbin/grub2-setup: warn: Your embedding area is unusually small.  core.img won't fitinit..3/sbin/grub2-setup: warn: Embedding is not possible.  GRUB can only be installedinthis setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..4/sbin/grub2-setup: error: will not proceed with blocklists.網上查的是 MBR 和 sda1 之間的那塊 embedding area 太小了,應該是預設的 63,如果是 32 的話會出現這個問題,但是我執行 fdisk  -lu,顯示這電腦已經是 63 了,不明原因。 google了一把,沒找到解決方案還是安裝不上去,後來我在wiki上面,看到了這個用法,強制安裝。 1grub2-install--force /dev/sda竟然可以裝上去,並且成功啟動~ 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.