在U盘上安装grub,之前是fat32的,格式化成exfat再安装grub,U盘设置文件为/dev/sdc4, 挂载于/media/c0f80392-62db-4156-a4f5-c64fc7515795/,但在运行grub-install时却出错了,如下:
[root@fsc feng]# grub-install –root-directory=/media/c0f80392-62db-4156-a4f5-c64fc7515795/ /dev/sdc4
The file /media/c0f80392-62db-4156-a4f5-c64fc7515795//boot/grub/stage1 not read correctly.
印象中以前都是这样安装grub的,检查没发现问题,于是google,说是/etc/fstab 里作过配置,刚才确实改过但没有重启机器,于是重启。再运行grub-install,还是照例出错,消息完全一样。于是继续google,啃英文文章,一时间没有找到方案。又尝试了N多其它方式:再次格式化U盘、直接拷/boot/grub 到U盘再grub-install等,都不行。
准备把U盘上分区重新删掉,重建分区再尝试。突然想到分区格式与分区表中不一致,使用“磁盘实用工具”查看时,该分区/dev/sdc4是w95 fat32(0x0b),删掉,再建ext2分区,设置为可启动(可以通过磁盘实用工具设置,或fdisk修改都可以),为/dev/sdc1,格式化为ext2,再次运行grub-install,成功
[root@fsc feng]# grub-install --root-directory=/media/287801d6-91aa-4563-a45e-d34073af2ff9 /dev/sdc1 Probing devices to guess BIOS drives. This may take a long time. Installation finished. No error reported. This is the contents of the device map /media/287801d6-91aa-4563-a45e-d34073af2ff9/boot/grub/device.map. Check if this is correct or not. If any of the lines is incorrect, fix it and re-run the script `grub-install'. (fd0) /dev/fd0 (hd0) /dev/sda (hd1) /dev/sdb (hd2) /dev/sdc [root@fsc feng]#
0 条评论。