[20161125更新]
弄了块ssd硬盘,装了若干系统,加上旧硬盘的系统,引导是个问题,安装os-prober后自动生成的引导文件太乱,索性自己写了一个。
前提:主系统Gentoo安装grub就行,其他不用。
1、/etc/grub.d/40_myos(本站下载)
cat << EOF menuentry 'Ubuntu 16.10 (16.10) (on /dev/mapper/linux-ubuntu)' { insmod lvm insmod ext2 set root='lvm/linux-ubuntu' linux /boot/vmlinuz-4.8.0-27-generic root=/dev/mapper/linux-ubuntu ro quiet splash initrd /boot/initrd.img-4.8.0-27-generic } menuentry 'CentOS Linux release 7.2.1511 (Core) (on /dev/mapper/linux-centos)' { insmod lvm insmod ext2 set root='lvm/linux-centos' linux /boot/vmlinuz-3.10.0-327.36.3.el7.x86_64 root=/dev/mapper/linux-centos ro recovery nomodeset initrd /boot/initramfs-3.10.0-327.36.3.el7.x86_64.img } menuentry 'CentOS Linux release 7.2.1511 (Core) (on /dev/sdb1)' { insmod part_msdos insmod xfs set root='hd0,msdos1' linux /boot/vmlinuz-3.10.0-327.36.3.el7.x86_64 root=/dev/sdb1 initrd /boot/initramfs-3.10.0-327.36.3.el7.x86_64.img } menuentry 'Windows 10 (loader) (on /dev/sda1)' { insmod part_msdos insmod ntfs set root='hd0,msdos2' chainloader +1 } menuentry 'Windows 10 (loader) (on /dev/sdb2)' { insmod part_msdos insmod ntfs set root='hd1,msdos1' chainloader +1 } menuentry "Ubuntu 16.10 Live" { set isofile="/os/ubuntu-16.10-desktop-amd64.iso" loopback loop (hd1,6)\$isofile linux (loop)/casper/vmlinuz.efi locale=zh_CN.UTF-8 file=(loop)/preseed/ubuntu.seed boot=casper iso-scan/filename=\$isofile locale=zh_CN.UTF-8 quiet splash -- initrd (loop)/casper/initrd.lz } menuentry "Archlinux-2016.10.01-dual.iso" { set isofile="/os/archlinux-2016.10.01-dual.iso" loopback loop (hd1,6)\$isofile linux (loop)/arch/boot/i686/vmlinuz archisolabel=ARCH_201610 img_dev=/dev/sda6 img_loop=\$isofile initrd (loop)/arch/boot/i686/archiso.img } EOF
2、加上可执行权限
chmod +x /etc/grub.d/40_myos
3、更新
# grub-mkconfig -o /boot/grub/grub.cfg Generating grub configuration file ... Found linux image: /boot/vmlinuz-4.8.5-gentoo done
说明:
1、前面两个(ubuntu、centos7)是在ssh上lvm分区(sda8)上的两个系统,还打算装几个,共用1G的boot(sda7)分区添加insmod lvm后,可以不用单独挂载boot分区;
2、第三个centos7是旧硬盘(sdb1)上的;
3、第四、五是新(sda1)旧(sdb2)硬盘上分别安装的win10;
4、最后两个是ssd(sda6)上的iso文件,这个就随便加了,想加几个加几个。