---
title: "在windows下制作Ubuntu的USB启动盘和Grub的修复 "
author: "feel"
date: "2010-11-01T21:16:03Z"
tags: []
categories: ["操作系统"]
slug: "windows-ubuntu-usb-grub"
draft: false
lastmod: "2010-11-01T21:16:03Z"
id: 800033
url: "https://feel.iteye.com/blog/800033"
---

每次安装完Windows 都会把Grub给冲掉，这也是微软霸道的一面吧。  
Ubuntu升级很快，所以也懒得刻CD了，就是搞个U盘，每次要用的时候就花个20分钟重搞一下，不管是做安装还是其他用途都很方便。

\[url]http://www.pendrivelinux.com/\[/url]  
上有很多做启动U盘的选择，随便贴一个在Windows下的

**从Windows下安装 Pendrivelinux 2008 :**

1. 用Fat16或者Fat32的格式格式化U盘
2. [下载](http://www.pendrivelinux.com/downloads/Ub8convert2.exe "Download") 运行 **Ub8convert2.exe** , 它将在硬盘上创建一个 **Ubuntu8** 目录
3. [下载](http://releases.ubuntu.com/releases/8.04/ubuntu-8.04.1-desktop-i386.iso "Ubuntu") **Ubuntu 8.04.1 ISO** 光盘映像， 并保存在 **Ubuntu8** 目录下
4. 在 **Ubuntu8** 文件夹里面, 点击 **fixu8.bat** 然后根据提示一步一步完成
5. 上述脚本运行完毕后即可重启然后在Bios里面设置U盘启动。

注意事项：  
我使用的时候**fixu8.bat有个Bug,** 就是读不到盘符，不过修改Bat文件即可，修改时要小心，不要把不该格的盘格了 修改后的bat文件见附录（H是U盘）。

**修复Grub:**

用U盘启动后运行：

%&gt; sudo grub  
gurb&gt; find /boot/grub/stage1  
(hd0,4)  
gurb&gt; root (hd0,4)  
grub&gt; setup (hd0)  
grub&gt; quit

**附录**  
**+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++**  
**rem This batch script was created by ?2007 Lance \[url]http://pendrivelinux.com\[/url]**  
**rem The included syslinux.cfg file was modified by Lance @ \[url]http://pendrivelinux.com\[/url] as well**  
**rem 7-Zip Copyright (C) 1999-2007 Igor Pavlovis \[url]http://7-zip.org\[/url] is being redistributed with written permission**  
**rem Ubuntu is a registered trademark of Canonical Ltd. ?2007 Canonical Ltd. \[url]http://ubuntu.com\[/url]**  
**@echo off**  
**cls**  
**echo.**  
**echo ===========================================================================**  
**echo \\\\\\ Pendrivelinux.com USB Linux file preparation script for Ubuntu 8.04 ///**  
**echo ===========================================================================**  
**echo.**  
**echo.**  
**echo   This script will extract your Ubuntu 8.04 ISO to you USB flash drive**  
**echo   using 7-Zip. It will then prepare the filesystem for USB usage.**  
**echo   Once finished, you should have a ready to run Ubuntu 8 flash drive**  
**echo.**  
**echo.**  
**echo   Please note that this batch file and any included software is being**  
**echo   provided as is without warranty,in hopes that it will be useful.**  
**echo   USE AT YOUR OWN RISK!!**  
**echo.**  
**echo.**

**set /p drive=H**

**:proceed**  
**cls**  
**echo.**  
**echo Would you like to format flash drive %drive%:?**  
**echo.**  
**echo Type y or n and press Enter**  
**set /p ok=**  
**if ?ok%?== ‘y?goto yes**  
**if ?ok%?== ‘Y?goto yes**  
**if ?ok%?== ‘n?goto no**  
**if ?ok%?== ‘N?goto no**  
**cls**

**:yes**  
**cls**  
**echo Pre-Stage Format:**  
**echo First, let's ensure that the flash drive is inserted**  
**echo.**  
**format H: /FS:fat32 /V:Ubuntu8 /Q**  
**cls**

**:no**  
**cls**  
**echo Stage 1:**  
**7-Zip\\7z x \*.iso -x!bin -x!programs -x!isolinux\\isolinux.txt -x!\[BOOT] -oH:**  
**cls**  
**echo Stage 2:**  
**echo Please wait while we prepare the files and copy them to your flash drive...**  
**echo.**  
**mkdir H:\\syslinux\\win32**  
**copy syslinux\\win32\\\*.* H:\\syslinux\\win32**  
**copy backg.png H:**  
**copy syslinux.cfg H:**  
**copy vesamenu.c32 H:**  
**copy makeboot.bat H:**  
**H:**  
**copy isolinux\\\*.\***  
**rd isolinux /s/q**  
**del isolinux.bin**  
**call h:\\makeboot.bat**