红联Linux门户
Linux帮助

在主板RAID 0上安装Ubuntu 11.04最后grub出现的问题及解决办法

发布时间:2015-01-06 15:30:27来源:linux网站作者:ffbp89

我安装的是Ubuntu 11.04 64位桌面版本,主板是880G。

两块500G硬盘已经在主板bios里面设置成raid0,先安装了win7。

硬盘目前结构,100M win7隐藏分区,另外还有c,d,e盘各100G。

经过改进的步骤:

先试用Ubuntu,然后开始安装。边安装,还可以一边上网,两不耽搁。

开始的安装很顺利,到最后一步grub无法安装,出现致命错误。

这个时候是关键了,不要慌张。

在附件程序组里面打开一个终端

以下是步骤:

$ sudo -i

先挂根目录

# mount /dev/mapper/pdc_XXXXXXXXXXn /target

pdc_XXXXXXXXXX在安装过程中应该有,没有记住的话,ls -l /dev/mapper/ 命令可以列出来。

再挂 /home

# mount /dev/mapper/pdc_XXXXXXXXXXn /target/home

n是和你分区时候的代码一致。

其他的挂载点根据自己安装的情况定,如果需要共享win分区,可以考虑把win目录也mount到 /media/c ,/media/d

然后是系统相关的。

# mount -o bind /proc /target/proc

# mount -o bind /sys /target/sys

# mount --rbind /dev /target/dev

然后chroot进入我们已经安装好的系统,就在target目录里面,(Now we do a chroot to the mount system.)
# chroot /target /bin/bash

创建device.map给grub(Now create the file device.map, used by GRUB.)

# echo "(hd0) /dev/mapper/pdc_XXXXXXXXX" > /boot/device.map
这里的pdc_XXXXXXXXXXXX 是raid0阵列的代号,后面不要加数字
# cp /boot/device.map /boot/grub/

然后安装grub。

# grub-setup /dev/mapper/pdc_XXXXXXXXXXXX
这里的pdc_XXXXXXXXXXXX 是raid0阵列的代号,后面不要加数字
# update-grub
grub会自动找到并且配置好ubuntu和win7启动选项,生成/boot/grub/grub.cfg文件。

这样就大功告成了。
重启就可以。


Install Ununtu 11.04 on an OCZ RevoDrive 120G SSD with RAID0, part two: The solution

Installing Ubuntu 11.04 (Natty Narwhal) on a (fake) RAID0 SSD is not easy or straight-forward. This post describes how I got it all to work!

All changes I made was done through a terminal running from the Live media (USB or CD doesn't matter.)

My hard-drives were set up as follows:

/dev/mapper/sil_bhafabbhfgah2    /
/dev/mapper/sil_bhafabbhfgah1    /boot
/dev/sda1                        /var
/dev/sdb2                        /home
tmpfs                            /tmp
First we mount all hard-drives of the computer, in their own places:

$ sudo mount /dev/mapper/sil_bhafabbhfgah2  /target
$ sudo mount /dev/mapper/sil_bhafabbhfgah1  /target/boot
$ sudo mount /dev/sda1 /target/var
$ sudo mount /dev/sdb2 /target/home
$ sudo mount -o bind /proc /target/proc
$ sudo mount -o bind /sys /target/sys
$ sudo mount --rbind /dev /target/devIt is important that all target partitions are mounted.

Now we do a chroot to the mount system.

$ sudo chroot /target /bin/bash
From here we need to install the dmraid package:

$ apt-get install dmraid
Now create the file device.map, used by GRUB.

$ echo "(hd0) /dev/mapper/sil_bhafabbhfgah" > /boot/device.map
$ cp /boot/device.map /boot/grub/Change the device name (sil_bhafabbhfgah) to the appropriate for your system.

Now make sure GRUB is installed properly on the device:

$ grub-setup /dev/mapper/sil_bhafabbhfgah
$ update-grub
Now we might need to edit the GRUB configuration file: /boot/grub/grub.cfg. All lines looking something like:

set root='(hd6,msdos2)'should be changed to:

set root='(hd0,msdos2)'The actual line (the parts containing hd6 and msdos2) may of course be different.

The final thing to do is edit the /etc/fstab file, replacing all partion-references with UUIDs. Here is my fstab as example:

UUID=7e9f38de-b0b3-4eaf-8f5b-2f83b1a0674c /                  ext4    errors=remount-ro,noatime,nodiratime           0       1
none            /tmp            tmpfs   rw,nodev,nosuid,noatime,nodiratime,size=1024m,auto 0 2
none            /var/tmp        tmpfs   rw,nodev,nosuid,noatime,nodiratime,size=1024m,auto 0 2
# /var was on /dev/sda1 during installation
UUID=f1abaa31-25a9-414e-a7fa-f05ab492d5a0 /var               ext4    rw,noatime,auto,nodev,nodiratime               0       2
# /boot was on /dev/mapper/sil_bhafabbhfgah1 during installation
UUID=55a9024e-7806-4ec5-b68e-8e6065cf3587 /boot              ext4    rw,nodev,noexec,noatime,nodiratime,auto        0       2
# /home was on /dev/sdb2 during installation
UUID=2e0f5ff4-146d-492f-a6e7-cad460db79ee /home              ext4    rw,noatime,nodiratime,auto,nodev,nosuid        0       2
# /home/arrow/extra1 was on /dev/sdc2 during installation
UUID=4867268a-b6d1-469f-9190-b2807695b09e /home/arrow/extra1 ext4    rw,noatime,nodiratime,auto,nodev,nosuid        0       2
# /home/arrow/extra2 was on /dev/sdc2 during installation
UUID=73430b1a-91df-4908-bd16-4b1ed07876e4 /home/arrow/extra2 ext4    rw,noatime,nodiratime,auto,nodev,nosuid        0       2
# swap was on /dev/sdc1 during installation
UUID=68a20ae0-12e0-413d-b80f-b39fd42e3153 none            swap    sw              0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0

Now reboot, and keep your fingers crossed!