想制作一个centos5.9-X86_64 的U盘启动安装盘,
以下是把16G U盘挂载到vmware workstation的虚拟下操作:
检查当前磁盘情况
fdisk -l
分区
fdisk /dev/sdb
d # delete existing partition - repeat as necessary
n # new partition
p # primary
1 # partition number
<enter> # take the default
+100M # add 100 MB
t # change the type
1 # partition number
b # VFAT
n # new partition
p # primary
2 # partition number
<enter> # take the default
+5G
n # new partition
e # primary
3 # partition number
<enter> # take the default
<enter> # take the default
n # new partition
l #逻辑分区
<enter> # take the default
+3G
t # change the type
5 # partition number
b # VFAT
n # new partition
l #逻辑分区
<enter> # take the default
+3G
t # change the type
6 # partition number
b # VFAT
n # new partition
l #逻辑分区
<enter> # take the default
<enter> # take the default
t # change the type
7 # partition number
b # VFAT
p
w
格式化
mkfs.vfat -n BOOT /dev/sdb1
mkfs.ext2 -m 0 -b 4096 -L DATA /dev/sdb2
mkfs.vfat -n do /dev/sdb5
mkfs.vfat -n do /dev/sdb6
mkfs.vfat -n wolf /dev/sdb7
重新插拔u盘,mount DATA分区,mount第一个iso,复制一些数据到DATA分区,再把iso都复制到DATA分区,然后umount 分区
mkdir -p /media/BOOT
mount /dev/sdb1 /media/BOOT
mkdir -p /media/DATA
mount /dev/sdb2 /media/DATA
mount -o loop /path/to/CentOS-6.0-x86_64-bin-DVD1.iso /media/iso/
cp -rv /media/iso/images /media/DATA
cp -rv /path/to/CentOS-6.0-x86_64-bin-DVD*.iso /media/DATA
umount /media/DATA
安装syslinux,用syslinux在u盘的/dev/sdb1分区制作linux启动盘,覆盖u盘的mbr
yum -y install syslinux
syslinux --stupid /dev/sdb1
dd if=/usr/share/syslinux/mbr.bin of=/dev/sdb
cp /media/iso/isolinux/isolinux.bin /media/BOOT/syslinux.bin
cp /media/iso/isolinux/isolinux.cfg /media/BOOT/syslinux.cfg
cp /media/iso/isolinux/vmlinuz /media/BOOT
cp /media/iso/isolinux/initrd.img /media/BOOT
编辑/media/BOOT/syslinux.cfg
default CentOS(注意这项和下面的label CentOS一定要对应)
prompt 0
label CentOS
kernel vmlinuz
append initrd=initrd.img method=hd:sdb2:/
#内容片段end
umount /media/BOOT
断开与虚拟机连接:
测试用U盘启动,正常;
不过在win7 “我的电脑”里只看到了第一个分区,5、6、7没有显示 ,磁盘管理中有:
原文地址:http://dodowolf.blog.51cto.com/793581/1430857