制作用U盘启动的LINUX系统
- 格式:doc
- 大小:3.87 KB
- 文档页数:5
如何用u盘制作linux和windows公用启动盘1、准备工具Windows系统的电脑一台、DiskCenius软件、UltraISO软件、ubuntu系统镜像(ISO)、pe系统(ISO)、8G U盘1个我使用的是老毛桃的iso、ubuntu1504的iso和windows7(64位)系统2、先打开UltraISO 制作一个PE启动盘,单击文件->打开选择老毛桃PE工具的ISO文件,然后如图选择写入硬盘映像如下图,选择默认写入方式USB-HDD+(老机器的可以择USB-ZIP,不行的话就在更换其它的写入方式,一般默认的方式可以满足绝大多数电脑),隐藏启动盘分区:高端隐藏(不隐藏的话容易误删启动盘里面的文件),选择写入就会完成启动盘的制作了,制作完成后记下启动盘分区大小,我的为300.9M(后面需要用这个大小确定新建分区的大小)3、打开DiskCenius软件,新建固定大小分区(我建的为1.1GB)用来安装另外一个ubutnut系统,新建多大规格的分区后面会进行说明如图,选中空白(无启动系统)的分区,右键单击,选中新建分区,当然可以用上面的新建分区了手动调整分区大小,我的后面一个调整为 1.1GB,如果拖动不精确的话就在下面输入1.1GB即可;一般u盘的可移动磁盘放在前面,因此后面一个设为固定大小的分区,设定后开始即可,分区成功后就多了一个分区了4、备份这个u盘的分区表选中整个u盘,右键单击选择备份分区表,备份为Lmt(自定义为方便记忆的英文即可),格式默认即可如图:5、备份完整的老毛桃PE系统选中老毛桃启动盘分区,右键选择备份分区到镜像文件,如图选择路径,命名为Laomaotao,格式为pmf,单击开始就会生成pmf镜像文件了6、再次用该u盘制作一个linux(ubuntu)启动盘,方法同步骤27、Ubuntu启动盘制作好之后,再次使用步骤3的方法,新建一个分区用于还原老毛桃PE系统,分区大小为300.9MB(前面已经说了需要记下的,现在可以使用了吧),分区大小不能比这小,小了就还原不了老毛桃系统8、将新建的分区格式化,然后保存,然后再设置为主分区如图中的1、2、39、备份这个u盘的分区表,方法如步骤4,命名为Ubuntu,格式默认10、还原之前的老毛桃PE系统pmf文件到刚刚新建的300.9MB大小的分区右键选择从镜像文件还原分区,单击开始即可完成还原如图还原后u盘就有3个分区了,分别为可移动磁盘,老毛桃PE和ubuntu1504,如下图若还原后老毛桃pe分区没有显示活动,则ubuntu分区一定为活动(即可以引导u盘启动),此时右键ubuntu,选择取消分区激活状态,然后右键老毛桃pe选择激活当前分区,设为活动,此时保存更改,重启电脑就可以进入老毛桃pe系统了11、再次备份包含两个启动系统的u盘分区表,方法如步骤4,命名为LaomaotaoUbuntu即可12、启动盘切换方法如果需要切换为ubuntu启动盘,只需要打开DiskCenius软件还原u盘分区表,选择上面备份的Ubuntu分区表还原即可,还原方法同上面的备份方法差不多,不多赘述了;同样,要再次切换为老毛桃PE,则用上面的LaomaotoUbuntu进行还原即可(不到一分钟就可以搞定很方便的!!)13、原理总概:此原理是在一个u盘上面建多个分区,每一个分区装不同的启动系统,每次需要使用的时候用DiskCenius软件将对应的分区激活,从而引导对应的系统注意1:极少数u盘不支持linux系统启动盘,因此要选择一个可以单独启动windowsPE和linux的启动盘,如何测试呢?当然是分别制作对应的启动盘啦,两个都行就可以制作公用启动盘了注意2:ubuntu1410之前不会出现输入not a COM32R image提示,可以直接安装,但是,安装ubuntu1410及之后的版本时候,进入启动系统前通常有黑屏(需要输入命令)提示,在boot处输入live 按enter键即可进入启动盘,如图:注意3:网上有人用u盘量产工具,将u盘分为两个启动盘,这个方法的确有人成功过,但是容易把u盘量产报废,而且很多u盘非正规厂商生产,找不到对应型号的量产工具,因此不建议使用。
2009年04月14日星期二 10:55本文出处:一、概述U盘的价格越来越便宜,容量也越来越大,携带也方便,在工作中可以把一些自己常用的工具整和到里面,在电脑维护方面使用比较方便。
二、系统的选择1、dos系统目前在dos工具盘比较多,常见有MS-DOS ,深山红叶DOS工具盘、MaxDos、矮人dos工具盘、超普DOS工具盘等,在制作中可以根据自己喜欢,选择相应的dos系统工具盘,我选择的MaxDos ,里面有许多有用的工具,比如ghost 、pq、windows密码破解等。
2、WinPE系统网上提供WinPE系统基本都是修改至老毛桃的WinPE,主要有老九WinPE 老毛桃修改之撒手不管版、深山红叶WINPE工具箱、、金手指快速装机U盘版、通用PE工具箱、完美者U盘WinPE维护系统、晨枫U盘维护等,为了使集成时修改最少,这里选择晨枫U盘维护版。
3、Windows 故障恢复控制台Windows 故障恢复控制台的功能是帮助基于 Windows 的计算机在未正确启动或根本无法启动时进行恢复操作。
这里选择网上的光盘上运行的基于Ramdisk 的恢复控制台。
4、LinuxU盘上的Linux比较多,比如Damn Small Linux、Slax Linux、puppy linux、Ubuntu等选择体积比较小的,功能比较完备的,这里选择Slax。
5、口袋操作系统主要有ceedo、mojopac和PortableApps Suite,根据自己的爱好去选择,我从使用习惯和功能上在这里选了ceedo。
三、u盘启动引导程序的选择任何一个操作系统在任何一个硬件平台上运行都需要一个引导的过程,起着初始化软件环境、把内核从存储介质放到内存当中去,并开始运行的作用。
引导程序上承 BIOS,下接内核的初始化代码,虽然开一次机只运行一次后就不留痕迹了,但相当的重要。
可对u 盘引导的引导程序主要有IO、NTLDR、syslinux、Grub等,她们各有特点,从兼容性考虑,我选择了syslinux。
Linux系统写入U盘方法教程之前我们介绍过怎么把Windows系统放进U盘备份,那么对于Linux系统方法也一样吗?有一些地方不同的,需要注意,所以下面我们就来教大家如何在U盘中安装Linux系统,把Linux系统写入U盘。
操作步骤第一步:首先插入u盘到电脑主机usb接口处(建议插入到主机箱后置的usb接口),然后打开UltraISO软件,再打开选择需要写入u 盘的Ubuntu 10.04或者其他版本的Linux系统的iso镜像包3 第二步:点击“启动光盘”,然后鼠标移动选择到“写入硬盘映像”并点击鼠标左键弹出一个写入硬盘映像的窗口,值得注意的是:硬盘驱动器那里我们要看清楚,是我们刚才插入usb接口的那个u盘,也就是我们需要写入的u盘,千万别搞错了。
写入方式我们默认即可,然后点击“便捷启动”,选择到“写入新的驱动器引导区”,再鼠标右移选择到“Syslinux”项,点击鼠标!u启动温馨提示:“Syslinux”这一项选择很重要,网络上流传的很多关于此类的教程由于都忽略了这一步,导致最终制作失败。
点击“是(Y)”继续接下来会弹出一个“写入引导扇区成功”的提示窗口第三步:也就是继续上一步的操作,我们点击“写入”继续,意思是把整个iso镜像包写入到我们的u盘里面点击了“写入”按钮以后将会弹出一个确定窗口,其表达的意思是让您进一步确认是否将iso镜像包写入到该u盘里面,我们只要点击“是(Y)”按钮即可,如下图:现在开始写入Linux系统的iso镜像包到u盘在写入u盘的时候我们要注意的是:尽量不要去做其他操作,建议耐心等待其写入成功!OK,大功告成,u盘写入Ubuntu Linux系统就完成了,我们接下来可以做的就是利用这个制作好引导的u盘来安装Ubuntu系统了。
补充:系统常用维护技巧1,在“开始” 菜单中选择“控制面板” 选项,打开“控制面板” 窗口,单击“管理工具” 链接2,在打开的“管理工具” 窗口中双击“事件查看器” 图标3,接着会打开“事件查看器” 窗口4,在右侧窗格中的树状目录中选择需要查看的日志类型,如“事件查看器本地--Win日志--系统日志,在接着在中间的“系统” 列表中即查看到关于系统的事件日志5,双击日志名称,可以打开“事件属性” 对话框,切换到“常规” 选项卡,可以查看该日志的常规描述信息6,切换到“详细信息” 选项卡,可以查看该日志的详细信息7,打开“控制面板” 窗口,单击“操作中心” 链接,打开“操作中心” 窗口,展开“维护” 区域8,单击“查看可靠性历史记录” 链接,打开“可靠性监视程序” 主界面,如图所示,用户可以选择按天或者按周为时间单位来查看系统的稳定性曲线表,如果系统近日没出过什么状况,那么按周来查看会比较合适。
研究测试了一个早上。
终于成功了!!1、准备redhat iso包2、制作启动U盘使用UltraISO 软件将boot.iso 制作成启动U盘(1)、用ULtraISO打开CentOS-5.6-i386-bin-DVD.iso镜像文件,找到boot.iso文件并将其提取出来,如图(2)、用ULtraISO打开boot.iso镜像文件并写入U盘(在写入文件前请记得把U盘里面的数据备份出来,否则数据将会全部丢失)。
点击启动->写入硬盘镜像,选择硬盘驱动器为u盘(可以通过打开我的电脑来看看,哪个才是U盘),写入方式为:usb-hdd,最后点击"写入" 。
如图(3)、写入完成后即可(可以测试一下,看是否能成功引导,如果可以引导,再把镜像文件拷贝到U盘根目录下)。
3、将redhat iso拷贝到U盘根目录4、启动服务器将启动项首选USB启动5、在一系列的程序运行之后,出现了安装对话框,选择安装的源为硬盘(也就是U盘),通常为以sd开头(通常:sda的是硬盘sdb的是U盘)在选择源这一步可以拔掉U盘在插上确认U盘挂载的设备名称,在选择的挂载的设备后,下面输入路径的对话框是输入iso 所在的目录,如在根目录则输入:/6、按照提示操作到“分区”时选择“在选定磁盘上删除所有分区并创建默认分区结构”在下面的“选择" 本次安装中使用的驱动程序”列表中将U盘去掉通常:sda的是硬盘sdb 的是U盘7、操作到GRUB引导装载程序这一步则需要注意,我们需要将GRUB引导装在硬盘上,而不是U盘。
如果Grub的引导器如果安装在/dev/sdb上,那么,在拔出u盘之后,就无法引导系统。
!!按下面的来操作:改变grub引导顺序,把”配置高级引导装载程序选项”选上.按下一步。
继续,直到安装完成,拔掉U盘后重起。
制作一个linux的u盘最小系统最近在学习linux了,为了了解linux系统的机制,花了一个月时间研究,走了很多弯路,看了很多老资料终于做成功了,现在看起来真简单的一个东西竟然花了那么长时间去做真是浪费啊!主机环境:ubuntu 11.04 (我用XP下的的虚拟机)u盘: 金士顿 2G下载内容:最新内核linux-3.3最新制作内核文件工具: busybox-1.9.2过程如下:1.u盘分区1)将优盘分成3个区,两个主分区,一个扩展分区。
用到的终端命令是fdiskfdisk /dev/sdb 进入u盘操作-p查看分区-d删除分区-n创建分区-a激活分区-w保存分区表并退出-q退出不保存分区表这些都是我用到的命令。
至于分区的大小,就随意了,你看着那个block自己划分吧,错了也没关系,回到上面继续改就是了。
2)格式化分区先卸载u盘上的所有分区才能格式化的。
mkfs.ext2 /dev/sdb1 格式化你的主分区mkfs.vfat /dev/sdb3 格式化你的扩展分区你可也用df -lh查看你的mount关系。
2.grub/grub2安装先要把安装的分区挂载在一个地方才能安装成功的,这是我试了好多次,失败了好多次才知道的。
mount /dev/sdb1 /tmpgrub-install --root-directory=/tmp/boot /dev/sdb将grub安装到/dev/sdb u盘的mbr上这个时候你会发现在你的/dev/sdb1分区下出现一个boot目录,里面有grub目录和很多文件。
3)在系统根目录下/boot/grub/下将grub.cfg拷贝到你的U盘分区/boot/grub下面吧,进去修改grub.cfg就可以启动u盘了。
只修改两个地方就行了,一个是UUID,一个是root。
至于uuid你把u盘插拔一下,用df查看你的分区挂载在哪个上面的uuid,复制下来修改。
至于root,你用u盘启动,进入grub命令行,用ls命令查看一下,哪个盘符下面有个boot目录,哪个盘符就是你的分区,记住它,出去改一下root里面的名字就行了。
使⽤Linux系统安装grub2到u盘并启动系统或者iso镜像⽂件⼀、使⽤fdisk命令对u盘进⾏分区1、fdisk -l 查看那个设备时u盘(现在以/dev/sdc为例)2、fdisk /dev/sdc 对u盘分区 p:查看当前分区 d:删除当前分区 n:新建分区 w:保存⼆、使⽤mkfs 将u盘格式化为fat32格式,fat32 通⽤性⽐较好mkfs.vfat -F 32 /dev/sdc1 或者 mkfs -t vfat /dev/sdc1三、将grub2安装到u盘1、sudo grub-install --boot-directory=/media/u /dev/sdc 问题:--boot-dircetory 和 --root-dircetory 的区别或:grub-install --no-floppy --boot-directory=/mnt/img /dev/sdc2、 sudo update-grub3、sudo grub-mkconfig -o /media/u/boot/grub/grub.cfg以上代码中的/dev/sdc是U盘对应设备,/media/u是U盘的挂载点。
经过上⾯的操作,grub2被安装到u盘的mbr上了,⽣成了默认的启动菜单/grub/grub.cfg,通过u盘启动就能看到grub2的引导界⾯了,完全可以引导电脑硬盘上的操作系统了。
四、使⽤grub命令⾏启动系统启动linux系统(本⽂的grub指的全部是grub2)1、set root=(hd1,msdos1) (hd1,msdos1)是启动分区。
(在输到"("之后,按⼀下tab,我的能⾃动填充hd1,之后,再按⼀下tab键,可以显⽰出磁盘分区,在我的电脑上显⽰出了2个ext分区,以及这些分区的基本信息,我的安装在hd1,msdos1)2、linux /boot/vmlinux-xxx-xxx root=UUID=xxxxxxxxx 或者 linux /boot/vmlinuz-***** -generic root=UUID=****** (root=后可以使⽤uuid也可使⽤ /dev/sda1 挂载分区,但是本⼈个⼈暂时⽆法获取是sda1还是sdb1,所以⽤UUID,第⼀步tab补全显⽰磁盘分区详情时会显⽰分区的uuid号)3、initrd /boot/initdxxx(按tab补全)4、boot 启动五、grub可以直接启动grub4dos2、配置 grub.cfgmenuentry "Grub4dos"{set root='hd0,msdos1'linux16 /grub/grub4dos/grub.exe boot}六、grub启动winpe1、消灾镜像⽂件到u盘2、配置grub.cfgmenuentry 'winpe'{ set root='hd0,msdos1' insmod lvm insmod xfs insmod memdisk insmod part_msdos echo 'loading memdisk...' linux16 /grub/memdisk iso raw echo 'loading iso...' initrd16 /grub/dabaicai.iso}七、grub4dos启动winpe(grub启动winpe有时候会失败所以使⽤grub4dos启动)修改grub4dos下的menu.lst⽂件(menu.lst⽂件最好拷贝到根⽬录或者boot⽬录,要不然系统可能找不到)title find and boot dabaicai.ISOfallback 6root (hd0,0) (系统默认是在当前磁盘,如果iso和grub4dos在同⼀个磁盘分区可以不⽤写这⼀句)find --set-root /grub/dabaicai.isomap /grub/dabaicai.iso (0xff) || map --mem /grub/dabaicai.iso (0xff)map --hookchainloader (0xff)savedefault --wait=2命令解释set: 设置环境变量,如果不带参数,则是显⽰当前所有的环境变量。
Scientific linux to usb# dd if=/dev/sdb of=/tmp/mbr_sdb.bin bs=512 count=1 # fdisk /dev/sdb Command(m for help):d 1 … (删除分区,当删除完后) Command(m for help): w (保存更改) (如果显示信息不正确,拔出 U 盘重新插入,并找到新的正确的 U 盘标识) # mkfs.vfat /dev/sdb –I (fat 格式化 U 盘)CreateaWindows95/98MBRonUSBmemorystick,usingms-sys(). Ms-sys is available on recent SL LiveCD/DVDs or you can take the rpm for el4 from /packages/ms-sys/.# ms-sys --mbr95b /dev/sdb Create a new partition (enter n): Choose Primary partition (enter p), Partition number (enter 1). The size of the partition should be at least as larger as the LiveCD/DVD you want to install on the USB device. Afterwards, change the type (enter t) of first partition (enter 1) to W95 FAT16 LBA (enter e), and make first partition active (enter a and select 1). Before writing the partition table to the USB flash drive (enter w), you can print the changed settings (enter p).# fdisk /dev/sdb Command(m for help): n (新分区) p1 1 (必须为 1)60 (启动盘空间大小,跟距实际需要填) t (改变分区格式) e a 1 w (保存修改) (FAT16 格式) (做为启动盘)Now format the first partition (/dev/sdb1) as FAT16. If you like, you can set a label with option -n # mkdosfs -n SL-LiveCD /dev/sdb1 下载 syslinux : /pub/linux/utils/boot/syslinux/# wget/pub/linux/utils/boot/syslinux/3.xx/syslinux-3.8 2.tar.gz# tar xfvz syslinux-3.82.tar.gz # cd syslinux-3.82 # make # cd linux # ./syslinux /dev/sdb1此时重启从 USB 启动应该会出现(不出现就要重做上一步,出现拔出 U 盘重新开机进生下 一步):SYSLINUX 3.11 2005-09-02 EBIOS Copyright (C) 1994-2005 H. Peter Anvin Could not find kernel image: linux boot:# mkdir -p /mnt/usbdisk # mount /dev/sdb1 /mnt/usbdisk# ll /mnt/usbdisk total 12 -r-xr-xr-x 1 root root 8236 Apr 27 21:23 ldlinux.sys下载 livecd_sl54_gome_***.iso (只能是 5.x 版本) 地址:http://www.livecd.ethz.ch/download.html# mkdir -p /mnt/iso # mount -o loop livecd_SL54_gnome_2009-11-20.iso /mnt/iso# cp -rv /mnt/iso/* /mnt/usbdisk/# cd /mnt/usbdisk/ # mv boot/* . Rename isolinux.cfg to syslinux.cfg and delete the path "boot/" in syslinux.cfg, splash.cfg and help*.txt: Sed 命今替换,这里用于删除 “boot/”# mv isolinux.cfg syslinux.cfg # sed -i "s|boot/||" syslinux.cfg # sed -i "s|boot/||" splash.cfg # sed -i "s|boot/||" help*.txt # rm isolinux.* -rfFinally, unmount the USB flash drive and the LiveCD iso image Umount U 盘 # cd # umount /mnt/usbdisk # umount /mnt/isoCreate a writable partition on the USB flash drive to store changes permanently创建可写空间(这种 U 盘系统是重启动会恢复原来状态,无没保存更改的,所以要创建可 创建可写空间 写空间)# ls /dev/sd* (先用上面命令看看有没有找到 USB 设备,并确认 USB 设备是 sd*, 一般为 sdb ,也有 sdc 等等 )# umount -a (如果提示有什么 # parted /dev/sdb ... Using /dev/sdb (parted) resize Partition number? 1 Start? End? ... (parted) quit [0.0308]?(直接回车)unmount 等 error 时执行这句)[1983.9995]? 1890(小于前面的数一点点就行了)(如果有警告就输入下面:) i n (如果没警告就会直接 OK,进入下一步) If you get errors during the use of parted, just type "i" for Ignore and do not change the file system to FAT32 - leave it as FAT. Create new partition (n): Primary partition (p), Partition number (2) and choose an appropriate size for the partition. Format /dev/sdb2:# fdisk /dev/sdbn p 2 (回车) (回车) w格式化 sdb2 为 ext3 系统# ls /dev/sd* (如果没有 sdb2 就拔出 U 盘重新插入找到正确的 U 盘标识并执行 umount –a) # mkfs.ext3 /dev/sdb2 ( 等待…… 完毕后 )# tune2fs -c 0 /dev/sdb2# mkdir -p /mnt/usbdisk2 # mount /dev/sdb2 /mnt/usbdisk2 # mkdir /mnt/usbdisk2/my_changes # mount /dev/sdb1 /mnt/usbdisk # cd /mnt/usbdisk # vi syslinux.cfg在 label linux 的append changes=my_changes max_loop=32 initrd=initrd.gz ..... 那句加上changes=my_changes kb=us pw=password……append changes=my_changes kb=us pw=password nox nonet nosound max_loop=32 initrd=initrd.gz ..... ……接下来就可以从 U 盘启动了,然后可以做自己的修改 U 盘 linux 系统制作结束,最下面有参考资料原版和网址系统制作, 前面是可以通用的 U 盘 linux 系统制作,下面是 ibox 项目生产盘制作1,把 ibox 系统打包 打包详细暂不知道 ,打为 tar.gz 包 有打包好的 2.进入 u 盘系统,把 PoweriBox***.tar.gz 两个包 copy 到 /home/sluser/ 下 把 usb_fdisk.sh copy 到 /usr/bin 下,vi /etc/rc.local ,在后面加下 /usr/bin/usb_fdisk.sh &(加 “&” 表示后台运行,不加“&”会直接进入 usb_fdisk.sh )/////////////////////////////////////////////////下面为参考资料原版 下面为参考资料原版//////////////////////////////////////////////////////// 下面为参考资料原版http://www.livecd.ethz.ch/usbdisk_sl4_sl5.htmlScientific Linux Live CD and DVD - Live USB - Diskless ClientOverview Download Usage Software Install Locally Create Live USB Create own LiveCD Boot Parameters Troubleshooting Diskless Client Persistent LiveCD ChangelogFeedbackSL4 and SL5: Live System on USB flash driveIMPORTANT: This description is valid for SL4 and SL5 only. For SL6 see Create Live USB.In order to boot from a USB drive your BIOS has to support booting from an USB device and you need to install a bootloader like grub or syslinux on it. The following description uses syslinux as bootloader and assumes that the USB memory stick is on /dev/sdb. A similar setup can also be done with grub as bootloader. Please note, you must be root to execute most of the following commands. If you don't have a running Linux system, you can do the whole procedure out of a running SL LiveCD/DVD. WARNING: If you change the wrong MBR or if you format the wrong partition, you can destroy your system, which can leave to complete data loss! Please make sure that you know which device corresponds to your USB memory stick (e.g. /dev/sda or /dev/sdb) !!! The following description assumes that the usb stick is on /dev/sdb. To boot from USB memory is not a trivial task. Whether it works or not can depend on the MBR and on the partition of your stick, on the USB memory stick itself and on the BIOS of your PC.Format the USB stickOn Windows There is a useful tool from HP which allows you to format your USB memory stick. Unfortunately it runs only under Windows. Download the HP USB Disk Storage Format Tool from ftp:///pub/softpaq/sp27001-27500/SP27213.exe. Choose as file system FAT (not FAT32) and format the stick. I have to admit that I had more success using the HP tool than doing it under Linux.On Linux Check on which device (dev/sd?) your USB memory stick is recognized by the system. If you have only IDE disks, it will be most probably appear on /dev/sda otherwise it can be on /dev/sdb or higher. See # tail -f /var/log/message while you plug in the USB memory stick. The USB device should also be visible by the command # fdisk -l First you have to overwrite the master boot record (MBR) of your USB flash drive. Caution: Overwriting the wrong MBR (for example the one of your hard disk) can leave to complete data loss! If you are unsure, please back up your MBR(s) to a file and copy this file to a safe place (floppy disk, other USB memory stick, ...). For example to write the MBR of the first SATA disk (/dev/sdb) to a file mbr_sdb.bin, run: # dd if=/dev/sdb of=/tmp/mbr_sdb.bin bs=512 count=1 Create a Windows 95/98 MBR on USB memory stick, using ms-sys (). Ms-sys is available on recent SL LiveCD/DVDs or you can take the rpm for el4 from /packages/ms-sys/. # ms-sys --mbr95b /dev/sdb Windows 95B/98/98SE/ME master boot record successfully written to /dev/sdbThen create a FAT16 partition on the USB flash drive: # fdisk /dev/sdb Create a new partition (enter n): Choose Primary partition (enter p), Partition number (enter 1). The size of the partition should be at least as larger as the LiveCD/DVD you want to install on the USB device. Afterwards, change the type (enter t) of first partition (enter 1) to W95 FAT16 LBA (enter e), and make first partition active (enter a and select 1). Before writing the partition table to the USB flash drive (enter w), you can print the changed settings (enter p). Now format the first partition (/dev/sdb1) as FAT16. If you like, you can set a label with option -n # mkdosfs -n SL-LiveCD /dev/sdb1 Note, this is all done without mounting the partition.Make the USB memory stick bootable using syslinuxYou should have now something like: # fdisk -l /dev/sdbDisk /dev/sdb: 1006 MB, 1006632960 bytes 31 heads, 62 sectors/track, 1022 cylinders Units = cylinders of 1922 * 512 = 984064 bytes Disk identifier: 0x00000000Device Boot /dev/sdb1 *Start 1End 747Blocks 717836IdSystem e W95 FAT16 (LBA)Important: The first partition is active (marked with *) and is a FAT16 partition: ID "e". Now the syslinux boot loader has to be installed on the first FAT partition: # syslinux /dev/sdb1 If you get the error "Cluster sizes larger than 16K not supported", try to use a more recent version of syslinux. Syslinux can be downloaded from :/pub/linux/utils/boot/syslinux/. I have successfully used syslinux > 3.11. Download, unpack and compile syslinux by executing "make". You will find the syslinux binary in the folder unix: # wget /pub/linux/utils/boot/syslinux/syslinux-3.11.tar.gz # tar xfvz syslinux-3.11.tar.gz # cd syslinux-3.11 # make # cd unix # ./syslinux /dev/sdb1 This should create a file "ldlinux.sys" in the sdb1 partition. Now try to boot from the USB memory stick. If this works you should see someting like: SYSLINUX 3.11 2005-09-02 EBIOS Copyright (C) 1994-2005 H. Peter Anvin Could not find kernel image: linux boot: Congratulation, you USB stick is no bootable! If you get "boot failed", "Missing operation system", "Boot error" or just nothing, try to redo the above steps - also try to format the stick under Windows as described above.Copy LiveCD dataFirst mount the partition. Under Scientific Linux /dev/sdb1 will be mountable under /media/"something". or do it manually: # mkdir -p /mnt/usbdisk # mount /dev/sdb1 /mnt/usbdisk Since your have already installed syslinux on the USB memory stick before, you should see # ll /mnt/usbdisk total 12 -r-xr-xr-x 1 root root 8236 Apr 27 21:23 ldlinux.sys Either mount the LiveCD/DVD directly or just mount the ISO image of the LiveCD/DVD: # mkdir -p /mnt/iso # mount -o loop livecd_SL54_gnome_2009-11-20.iso /mnt/iso By the way, if you are doing this on a running LiveCD system, the CD is already mounted under /livecd/live/livecd/hdc, assuming your CD-ROM is the third IDE device (hdc). Now copy everything from the CD/DVD to the USB flash drive: # cp -rv /mnt/iso/* /mnt/usbdisk/ In contrast to grub, syslinux can not access the kernel and the initial RAM disk in the "boot" folder. Therefore you have to move the "boot"-files to the root folder of the USB flash drive: # cd /mnt/usbdisk/ # mv boot/* . Rename isolinux.cfg to syslinux.cfg and delete the path "boot/" in syslinux.cfg, splash.cfg and help*.txt: # mv isolinux.cfg syslinux.cfg # sed -i "s|boot/||" syslinux.cfg # sed -i "s|boot/||" splash.cfg # sed -i "s|boot/||" help*.txt You can also remove the isolinux.bi_, isolinux.bin and isolinux.boot files:# rm isolinux.* Now everything should be ready for booting the USB flash drive. The most important files on the USB flash drive are: |-- base | | | |-- bin.mo |-- etc.mo |-- ....|-- ... |-- help1.txt |-- help2.txt |-- ... |-- initrd.gz |-- ldlinux.sys |-- livecd.sgn |-- memtest |-- splash.cfg |-- splash.lss |-- syslinux.cfg |-- vmlinuz Finally, unmount the USB flash drive and the LiveCD iso image # cd # umount /mnt/usbdisk # umount /mnt/isoCreate a writable partition on the USB flash drive to store changes permanentlyNormally all data that you have created or any software you have installed since the LiveCD was booted, are lost when you shutdown the system, even if the LiveCD is running from USBkey. To save the changes permanently use the "changes=" boot parameter. For information about persistent LiveCD see also Persistent LiveCD. Please note: The following procedure only works for LiveCD/DVD's created after 2008-08-01 ! Please make sure that you know which device corresponds to your USB memory stick (e.g. /dev/sda or /dev/sdb) !!! First you need some free space on your USB memory stick which is not used by the first partition (/dev/sdb1). Either you have already taking this into account when you created the first partition or you can try to resize your first partition with parted. # parted /dev/sdb ... Using /dev/sdb (parted) resize Partition number? 1 Start? End? ... (parted) quit If you get errors during the use of parted, just type "i" for Ignore and do not change the file system to FAT32 - leave it as FAT. Now create a ext3 partition on /dev/sdb: # fdisk /dev/sdb Create new partition (n): Primary partition (p), Partition number (2) and choose an appropriate size for the partition. Format /dev/sdb2: # mkfs.ext3 /dev/sdb2 Maybe you want to disable automatic filesystem check for this partition: # tune2fs -c 0 /dev/sdb2 To create the directory "my_changes" on /dev/sdb2: # mkdir -p /mnt/usbdisk2 # mount /dev/sdb2 /mnt/usbdisk2 # mkdir /mnt/usbdisk2/my_changes [0.0308]? [1983.9995]? 1890The folder name "my_changes" has to be defined in syslinux.cfg using the boot parameter "changes=my_changes". If not yet done, mount the first partion of the USB stick again: # mount /dev/sdb1 /mnt/usbdisk Edit syslinux.cfg in /mnt/usdisk and add changes=my_changes to the append line(s) # cd /mnt/usbdisk # emacs syslinux.cfg ... append changes=my_changes max_loop=32 initrd=initrd.gz ..... Or even more advanced # emacs syslinux.cfg ... append changes=my_changes kb=sg-latin1 pw=mypassword max_loop=32 initrd=initrd.gz ..... See boot parameters for more options.Last modified: Friday, 18-Mar-2011 13:11:09 CET by Urs Beyerle。
u盘安装linux系统u盘安装linux系统我的⽬的是在u盘上⽤efi的⽅式启动linux,并留相应的空间⽤于数据交换分区建⽴⽂件系统1 使⽤fdisk分区u盘挂载点为/dev/sdbDevice Start End Sectors Size Type/dev/sdb1 2048 16779263 16777216 8G Linux filesystem/dev/sdb2 16779264 17803263 1024000 500M EFI System/dev/sdb3 17803264 28289023 10485760 5G Linux filesystem以上是我的分区结果,这⾥划分了三个分区,sdb1是⽤来存储数据的,sdb2是efi分区,sdb3是存放linux的分区2 建⽴⽂件分区sdb1根据需要来建⽴⽂件系统,sdb2为fat格式,sdb3为ext4格式mkfs -t ext4 /dev/sdb3mkfs -t vfat /dev/sdb2linux内核准备1 挂载分区mount -o sync /dev/sdb3 /usb2 这⾥还是使⽤当前系统上已经编译的内核还有initramfs,⼀般位于/boot⽬录下mkdir /usb/bootcp /boot/vmlinuz-5.4.0-81-generic /usb/bootcp /boot/initrd.img-5.4.0-81-generic /usb/boot引导程序引导程序使⽤grub来创建1 挂载分区mount -o sync /dev/sdb2 /efi2 编写grub.cfggrub.cfg位于/efi/grub⾥grub.cfgmenuentry 'Linux(USB)' {insmod ext2search --no-floppy --fs-uuid --set=root b77cc5ce-4cf9-4190-ac65-e6d30e8956falinux /boot/vmlinuz-5.4.0-81-generic root=UUID=b77cc5ce-4cf9-4190-ac65-e6d30e8956fa roinitrd /boot/initrd.img-5.4.0-81-generic}注:1 ⼀般grub.cfg是使⽤grub-mkconfig来创建的,但该命令⽆法扫描到u盘,所以选择⼿动创建2 b77cc5ce-4cf9-4190-ac65-e6d30e8956fa这个/dev/sdb3的uuid可以使⽤以下命令查看ls -l /dev/disk/by-uuid3 创建引导程序grub-install --efi-directory=/efi --boot-directory=/efi --removable创建成功后/efi⾥会多出⼀个EFI⽬录,之后如果修改了grub.cfg需要重新运⾏命令创建模拟启动此时使⽤qemu来模拟电脑的启动来测试引导程序是否正常运⾏qemu-system-x86_64 /dev/sdb如果qemu卡死在booting from hard disk或cannot allocate kernel buffer可以参考以下⽅案apt-get install ovmf qemu-efiqemu-system-x86_64 -m 512M --bios /usr/share/qemu/OVMF.fd /dev/sdb -boot menu=on--bios /usr/share/qemu/OVMF.fd可以解决booting from hard disk卡死问题-m 512M 可以解决cannot allocate kernel buffer这个问题-boot menu on这个选项不会影响解决⽅案,只是留作备忘正常流程内核启动进⼊ramfs会由于没有init进程⽽⽆法完成启动,⾄于init的问题就可以通过安装busybox来解决,具体可以参考之前的⽂章启动在bios配置相应选项进⾏启动即可附录查看挂载点cat /proc/mounts。
制作U盘启动CDlinux0.9.7.1.系统 准备工具1.CDlinux0.9.7.1.ISO文件(134M)2.LinuxLive USB Creator 2.8.18.exe3.Grub4dos-0.4.4-4.BOOTICE(选x86.exe)制作步骤:1.用LinuxLive USB Creator写入CDlinux ISO文件到优盘。
之前可在Windows系统下用FAT32格式化优盘,也可用USB Creator格式化优盘。
U盘文件写入完成后,将U盘名字改为CDlinux,也就是卷标。
2.将U盘根目录文件删除部分,保留CDlinux文件夹、syslinux文件夹、mkisofs.sh文件,将Grub4dos文件夹里的grldr、menu.lst 拷入U盘根目录下。
将syslinux文件夹复制到CDlinux/boot/文件夹下,打开syslinux文件夹,复制syslinux.cfg到CDlinux/boot/文件下。
3.用记事本打开U盘根目录里的menu.lst文件写入如下内容:timeout 3default 0title CDlinuxfind --set-root /CDlinux/bzImagekernel /CDlinux/bzImage CDL_DEV=LABEL=CDlinux CDL_LANG=zh_CN.UTF-8initrd /CDlinux/initrdboot保存。
4.打开BOOTICEx86.exe,点分区引导记录,选第二个项目:Grub4DOS……,点安装/配置,OK。
5.在Bios里设置启动顺序项,USB不要放在第一启动项,第一启动项可设为CDrom,第二启动项设为USB,硬盘启动在USB之后,OK,重启,就可以进入CDlinux系统了。
总结:搞了3、4天才终于搞好了,网上的资料太多,但都没有成功。
我把我的经验分享给大家,可能并不适合每个人。
我的是联想的笔记本,用虚拟机是用不了内置无线网卡的,听说用虚拟机要用USB的外置无线网卡,希望大家注意,少走弯路。
制作iso镜像U盘⾃动化安装linux系统⾃制光盘引导⾃动化安装⾸先我们要明⽩都需要哪些⽂件,我们列举下①需要⼀个⽂件夹来存放⽂件,将来把这个⽬录打包成iso②准备kickstart⽂件(ks.cfg)③准备启动⽂件启动菜单差不多也就这些下⾯开始制作制作流程1)创建⽂件夹mkdir data###2)为了⽅便管理我们在data⽬录下创建个存放kickstart⽂件的⽬录并把ks.cfg⽂件复制到该⽬录mkdir data/ksdir#创建⽬录cd data/ksdir#进⼊改⽬录cp -a /root/ks.cfg .#复制root⽬录下的ks.cfg⽂件到当前⽬录备注:因为我这有现成的ks.cfg⽂件,就拿来⽤了,上篇介绍了怎么制作kickstart⽂件3)复制isolinux⽬录到data⽬录下(光盘镜像⽂件⾥⾯有这个⽬录,所有要从光盘⾥⾯复制)cp -r /misc/cd/isolinux/ .#复制的整个⽬录所有加 r备注:这⾥misc/cd是光盘⽬录,⼀个神奇的⽂件夹,需要开启autofs服务4)更改isolinux.cfg⽂件(显⽰的菜单)default vesamenu.c32#这个是显⽰的菜单背景插件timeout 600#这个是倒计时时间menu title CentOS 7#主标题label linuxmenu label ^Auto Install CentOS 7kernel vmlinuzappend initrd=initrd.img ks=cdrom:/ksdir/ks.cfg#上⾯这⾏ks=是我们刚刚存放kickstart⽂件的路径,因为是iso光盘,所有这⾥是cdromlabel checkmenu label Test this ^Maedia install CentOS 7kernel vmlinuzappend initrd=initrd.img repo=http://192.168.1.116/centos/7/os/x86_64/#上⾯这个repo=是我们⾃⼰挂载的yum源地址安装包label localmenu label Boot from ^local drivelocalboot 0xffff5)把data⽬录打包成iso⽂件mkisofs -R -J -T -v --no-emul-boot --boot-load-size 4 --boot-info-table -V "CentOS 7 x86_64 boot" -b isolinux/isolinux.bin -c isolinux/boot.cat -o /root/cebtos7.boot.iso /root/data/ #上⾯路径都是相对路径6)完成,sz命令传送到win就可使⽤了。
制作用U盘启动的Linux系统的简单步骤:
一、对U盘进行处理
1.分区:(插上U盘)
# fdisk /dev/sdb
d Enter 删除原有分区
n Enter 新建一个主分区
w Enter 保存设置
# partprobe /dev/sdb 刷新U盘
2.设定U盘分区为活动分区
# fdisk /dev/sdb
a Enter 设定为活动分区
1 Enter 选择分区
3.对硬盘分区进行格式化,格式化成ext3格式
# mkfs.ext3 /dev/sdb1
二、装filesystem包(目的:生成根下的root,usr,var 。
.等目录)
1.配置好yum
2.加载U盘到/net下
# mount /dev/sdb1 /net
3.安装
# yum -y install --installrot=/net filesystem
安装完成后,可查看/net下生成了多个目录
三、加载系统启动项
1.# cp /boot/vmlinuz-
2.6.18-128.el5 /net/boot/
2.生成initrd.img `uname -r`为取系统版本号
# mkinitrd --with=usb-storage /net/boot/initrd-usb.img `uname -r`
3.查看/net/boot/下是否有vmlinuz和initrd
四、制作boot loader(grub)
1.# yum -y install --installroot=/net grub
2.grub.conf不成自动生成,要手工创建
# cp /boot/grub/grub.conf /net/boot/grub/grub.conf 并作修改
# cat /net/boot/grub.conf
default = 0
timeout = 5
title redhat-usb-linux
root(hd0,0)
kernel /boot/vmlinuz-2.6.18-128.el5 ro root=/dev/sdb1 init=/dev/bash
initrd /boot/initrd-usb.img
此处填写的内容要与/net/boot/grub/下的文件名一致
五、安装命令库文件
# yum -y install --installroot=/net bash coreutils pam setup vim-enhanced vim-minimal util-
linux net-tools SysVinit passwd shadow-utils authconfig
可通过rpm -qf /bin/mount 查看包名
此时chroot /net下可使用刚才安装的命令了
六、创建磁盘分区
# mknod /net/dev/sdb b 8 16
# mknod /net/dev/sdb1 b 8 17
b表示块设备,8为主设备号,16、17为次设备号
--------------------------
| 有关设备号的解释:
| 1.对于一块SCSI/SATA硬盘(格式为sd*),主设备号为8,
| 第一块硬盘的次设备号为0-15,第二块硬盘的次设备号为16-31,依次类推。
因为对于硬盘来说,主分区最多为4个,可以3个主分区1个扩展分区,扩展分
| 区仍然可以再分区,但是分区的总数最多为16个,所以每一块硬盘的次设备号为16个(0-15,16-31)。
| 2.对于一块IDE硬盘(格式为hd*),主设备号为3,次设备号第一块为0-63,第二块为64-127。
| 3.# ls -l /dev/sd*
| brw-r----- 1 root disk 8, 0 10-16 14:53 /dev/sda
| brw-r----- 1 root disk 8, 1 10-16 14:54 /dev/sda1
| brw-r----- 1 root disk 8, 2 10-16 14:53 /dev/sda2
| brw-r----- 1 root disk 8, 3 10-16 14:54 /dev/sda3
| brw-r----- 1 root disk 8, 16 10-16 15:50 /dev/sdb
| brw-r----- 1 root disk 8, 17 10-16 15:50 /dev/sdb1
| brw-r----- 1 root disk 8, 32 10-16 15:50 /dev/sdc
| brw-r----- 1 root disk 8, 36 10-16 15:50 /dev/sdc4
| 以上是我一台主机上插了1个硬盘,两个U盘的显示情况,我们可以看到设备号的显示情况。
| 4.在linux中一切皆文件,硬件也是通过文件体现出来的,所有硬件设备都在/dev/有所显示。
| 5.更具体的设备号研究可以查看下面的文件。
| # yum install kernel-doc
| # /usr/share/doc/kernel-doc-2.6.18/Documentation/devices.txt
---------------------------
七、创建挂载
1.创建mtab
# cat /net/etc/mtab
/dev/sdb1 / ext3 rw 0 0
2.创建fstab
# cat /net/etc/fstab
/dev/sdb1 / ext3 default 1 1
八、安装grub
# chroot /net
# grub-install /dev/sdb1
注:
1.如果创建硬盘分区的时候没有配置正确,在第八步会报错:
the file /boot/grub/stage1 not read correctly
2.在用U盘启动后,进入到U盘中的系统,此时我们可以用已经
安装过的命令集,但是此时的文件系统是只读的,我们不能vim,
mount等的操作,此时必须用下面这个命令,进行重新读写挂载:
# mount -o remount,rw /
重挂载后,就可以了。
至此,U盘Linux系统启动盘的制作就完成了,通过以上方法,用户就可以用U盘来启动Linux系统,再也不用担心误删文件进不来系统,也不用这么麻烦拆下硬盘进行拷贝。