300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > 【Grub Grub2】万能优盘启动盘 (WinPE LinuxPE)-- 方法1 U盘三分区法(不推荐 供参考)

【Grub Grub2】万能优盘启动盘 (WinPE LinuxPE)-- 方法1 U盘三分区法(不推荐 供参考)

时间:2024-06-24 00:56:47

相关推荐

【Grub  Grub2】万能优盘启动盘 (WinPE LinuxPE)-- 方法1 U盘三分区法(不推荐 供参考)

由于工作需要,经常使用Windows和Linux双系统,系统使用过程中,个人涉及到的开发软件过多(光基于Eclipse的IDE就有好几个),经常过度安装软件,有时会越来越庞大,越来越不稳定,定期要重新安装配置,但是又不想重头安装,基本软件最好先配置好备份一下,然后直接恢复。

Windows下使用Ghost即可,Linux下之前使用dd以及tar备份过,前者磁盘限制较大,后者效果很不好,后来使用了CloneZilla做备份,注意恢复时需要修改引导,所以为了避免引导被破坏,可以参考以下方式分配硬盘。

以上属于题外话,下面讲述U盘万能启动盘的制作,万能启动盘有以下特性

同时使用GRUB和GRUB2(因为GRUB2不支持UD分区)支持UD分区支持BIOS和UEFI含WinPE(含aomei无损windows分区)含LinuxPE如Slitaz及Ubuntu Live CD(含gparted无损Linux分区)含CloneZilla(支持Linux系统备份)

整个优盘的分区分布如下:

制作需要原料(由于文件太大,我就不上传一键制作软件了)

1、U盘三分区一键制作软件(例如天意优盘三分区,我们在这个基础上改就好了)

2、制作好的BIOS及UEFI版本的GRUB2

3、Ubuntu镜像

4、CloneZilla镜像

5、UltraISO以及FbinstTool两个编辑软件

6、U盘一个(2G以上,若Ubuntu较大,则需更大优盘)

解压已有的U盘三分区压缩包,会发现三个文件,ty.fba、ty.exe、ty.iso,fba对应UD分区,ISO对应EFI分区。

一、制作步骤

1、解压CloneZilla,提取 live、syslinux文件夹以及CloneZilla-Live-Version和GPL文件

2、使用UltraISO编辑ty.iso,将live、syslinux文件夹以及CloneZilla-Live-Version和GPL文件添加到根目录

3、将BIOS和UEFI的GRUB2添加到ty.iso的对应目录(根据制作是参数确定)

3、编辑GRUB2的配置菜单(提取CloneZilla下EFI/boot/grub.conf的menuentry菜单,集成进入我们的菜单),GRUB2原生支持UEFI,所以部分BIOS菜单也可添加到UEFI版本GRUB2菜单。

BIOS版GRUB2菜单范例(grub.cfg)

注意:XUbuntu镜像的路径为/OS/Linux下,所以我们后面要将镜像放到对应的可见区域内,名称一定要确保完全一致。

insmod echoinsmod part_msdosinsmod fat#backgroundinsmod jpeginsmod gfxmenuinsmod gfxterminsmod gfxterm_backgroundinsmod gfxterm_menuinsmod true#adjust the screen resolutionterminal_output gfxtermset background_image=$prefix/background.jpg# set menu_color_normal=white/black# set menu_color_highlight=black/light-gray# background_color 255,255,155,0; then#default select menu indexset default=0#timeoutset timeout_style=menuset timeout=5menuentry "Win7" --class windows --class os {insmod ntfsinsmod chaininsmod echoset root=(hd1,msdos2)echo "Start Windows"chainloader +1}menuentry "Install XUbuntu18.04" --class ubuntu --class os {insmod ext2insmod linuxinsmod loopbackinsmod ntfsinsmod echosearch.file /OS/Linux/xubuntu-18.04-desktop-amd64.iso rootloopback loop0 /OS/Linux/xubuntu-18.04-desktop-amd64.isolinux (loop0)/casper/vmlinuz ro boot=casper iso-scan/filename=/OS/Linux/xubuntu-18.04-desktop-amd64.iso ro splashinitrd (loop0)/casper/initrd.lzecho "Install XUbuntu 18.04"}menuentry "Clonezilla live (Default settings, VGA 800x600)"{insmod linuxsearch --set -f /live/vmlinuzlinux /live/vmlinuz boot=live union=overlay username=user hostname=bionic config quiet components noswap edd=on nomodeset locales= keyboard-layouts= ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_batch="no" vga=788 ip= net.ifnames=0 splash i915.blacklist=yes radeonhd.blacklist=yes nouveau.blacklist=yes vmwgfx.enable_fbdev=1initrd /live/initrd.img}menuentry "Clonezilla live (Default settings, VGA 1024x768)"{insmod linuxsearch --set -f /live/vmlinuzlinux /live/vmlinuz boot=live union=overlay username=user hostname=bionic config quiet components noswap edd=on nomodeset locales= keyboard-layouts= ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_batch="no" vga=791 ip= net.ifnames=0 splash i915.blacklist=yes radeonhd.blacklist=yes nouveau.blacklist=yes vmwgfx.enable_fbdev=1initrd /live/initrd.img}menuentry "Clonezilla live (Default settings, VGA 640x480)"{insmod linuxsearch --set -f /live/vmlinuzlinux /live/vmlinuz boot=live union=overlay username=user hostname=bionic config quiet components noswap edd=on nomodeset locales= keyboard-layouts= ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_batch="no" vga=785 ip= net.ifnames=0 splash i915.blacklist=yes radeonhd.blacklist=yes nouveau.blacklist=yes vmwgfx.enable_fbdev=1initrd /live/initrd.img}menuentry "Clonezilla live (Default settings, KMS)"{insmod linuxsearch --set -f /live/vmlinuzlinux /live/vmlinuz boot=live union=overlay username=user hostname=bionic config quiet components noswap edd=on locales= keyboard-layouts= ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_batch="no" vga=791 ip= net.ifnames=0 splashinitrd /live/initrd.img}menuentry "Clonezilla live (To RAM, boot media can be removed later)"{insmod linuxsearch --set -f /live/vmlinuzlinux /live/vmlinuz boot=live union=overlay username=user hostname=bionic config quiet components noswap edd=on nomodeset locales= keyboard-layouts= ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_batch="no" vga=788 toram=live,syslinux ip= net.ifnames=0 splash i915.blacklist=yes radeonhd.blacklist=yes nouveau.blacklist=yes vmwgfx.enable_fbdev=1initrd /live/initrd.img}menuentry "Clonezilla live Safe graphic settings (vga=normal)"{insmod linuxsearch --set -f /live/vmlinuzlinux /live/vmlinuz boot=live union=overlay username=user hostname=bionic config quiet components noswap edd=on nomodeset locales= keyboard-layouts= ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_batch="no" ip= net.ifnames=0 nomodeset vga=normal nosplashinitrd /live/initrd.img}menuentry "Clonezilla live (Failsafe mode)"{insmod linuxsearch --set -f /live/vmlinuzlinux /live/vmlinuz boot=live union=overlay username=user hostname=bionic config quiet components noswap edd=on nomodeset locales= keyboard-layouts= ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_batch="no" acpi=off irqpoll noapic noapm nodma nomce nolapic nosmp ip= net.ifnames=0 nomodeset vga=normal nosplashinitrd /live/initrd.img}menuentry --hotkey=s "Clonezilla live (speech synthesis)"{insmod linuxsearch --set -f /live/vmlinuzlinux /live/vmlinuz boot=live union=overlay username=user hostname=bionic config quiet components noswap edd=on nomodeset locales= keyboard-layouts= ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_batch="no" vga=788 ip= net.ifnames=0 splash i915.blacklist=yes radeonhd.blacklist=yes nouveau.blacklist=yes vmwgfx.enable_fbdev=1 speakup.synth=soft ---initrd /live/initrd.img}#menuentry "memtest"{# search --set -f /live/memtest# linux16 /live/memtest#}#menuentry "FreeDOS"{# linux16 memdisk# initrd /live/freedos.img#}menuentry "iPXE"{search --no-floppy --set=root -f /live/ipxe.efichainloader /live/ipxe.efi + 1}menuentry "-------------------" --class ubuntu --class os{set root=(hd0,gpt1)}menuentry "reboot" --class windows --class os{insmod rebootreboot}menuentry "halt" --class windows --class os{insmod halthalt}

UEFI版GRUB2,菜单

function load_video {if [ x$feature_all_video_module = xy ]; theninsmod all_videoelseinsmod efi_gopinsmod efi_ugainsmod ieee1275_fbinsmod vbeinsmod vgainsmod video_bochsinsmod video_cirrusfi}insmod part_msdosinsmod fat#set fontfont="$prefix/unicode.pf2"if loadfont $font ; thenset gfxmode=autoload_videoinsmod gfxtermset locale_dir=$prefix/localeset lang=zh_CNinsmod gettextfi#adjust the screen resolutionterminal_output gfxterm#backgroundinsmod jpegif background_image $prefix/background.jpg; thentrueelseset menu_color_normal=white/blackset menu_color_highlight=black/light-grayif background_color 255,255,155,0; thenclearfifi#default select menu indexset default=0#timeoutset timeout_style=menuset timeout=5menuentry "start win8 pe" --class windows --class os {set efifile=/EFI/Boot/win8pe.efisearch.file $efifile rootecho "Start Windows"chainloader $efifile}menuentry "start windows" --class windows --class os {insmod ntfsset efifile=/EFI/Microsoft/Boot/bootmgfw.efisearch.file $efifile rootecho "Start Windows"chainloader $efifile}menuentry "start ubuntu" --class ubuntu --class os {insmod ext2set kernelfile=/vmlinuzset initrdfile=/initrd.imgsearch.file $kernelfile rootlinux $kernelfile ro root=/dev/sda2initrd $initrdfileecho "Start Ubuntu"}menuentry "-------------------" --class ubuntu --class os{set root=(hd0,gpt1)}menuentry "install ubuntu" --class ubuntu --class os {insmod ext2insmod loopbackset isofile=/OS/Linux/xubuntu-16.04.3-desktop-amd64.isosearch.file $isofile rootloopback loop $isofilelinux(loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=$isofileinitrd(loop)/casper/initrd.lz}menuentry "-------------------" --class ubuntu --class os{set root=(hd0,gpt1)}menuentry "reboot" --class windows --class os{insmod rebootreboot}menuentry "halt" --class windows --class os{insmod halthalt}

4、使用FbinstTool修改UD分区grub菜单,增加启动grub2菜单(grub2不支持ud分区,所以bios版本grub2放到了EFI分区镜像)。

从grub启动grub2。

title GRUB2 Menufind --set-root /efi/grub/z_g2ldrkernel /efi/grub/z_g2ldr

至此,定制版万能启动优盘制作完毕,插入U盘,使用ty.exe开始制作,制作完毕后,将Ubuntu镜像放到可见区菜单中设置的目录中,开机从U盘启动即可。

二、相关文件修改

1、GRUB菜单修改,使用FbinstTool工具即可

2、GRUB2菜单修改,使用由于EFI分区是隐藏的,所以需要使用工具(例如Bootice的分区管理)显示分区,然后使用记事本修改菜单即可,若是在Linux下则更简单,直接挂载分区,然后修改。

3、若是觉得Ubuntu放在外部麻烦,可以下载精简版的将其打包进ISO中,然后重新制作U盘即可隐藏。一般来说太大会不方便更换。

4、升级CloneZilla和Ubuntu,替换文件夹及文件即可,若是有菜单修改需求,修改菜单。

5、若是不希望使用grub,可以不用UD分区,将所有文件制作到一个ISO中,然后写入U盘,写完之后将grub2的BIOS引导使用扇区工具(BootIce)写入mbr,这里使用UD分区目的就是直接使用ty.exe工具一键制作而已。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。