`

U盘安装CentOS6.4

 
阅读更多

本次使用的U盘为Kingston16G,/dev/sdb,默认已有分区为/dev/sdb4
下面将对U盘进行分区第一个分区为FAT32,引导计算机进行系统安装,第二个分区为EXT2,存放我们的系统ISO文件。
删除原有分区


[root@localhost ~]# fdisk /dev/sdb

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').

Command (m for help): d
Selected partition 4

Command (m for help): p

Disk /dev/sdb: 15.5 GB, 15479597056 bytes
255 heads, 63 sectors/track, 1881 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xcad4ebea

Device Boot Start End Blocks IdSystem

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1881, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1881, default 1881): +250M

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): l

0Empty 24NEC DOS 81Minix / old Lin bfSolaris
1FAT12 39Plan 9 82Linux swap / So c1DRDOS/sec (FAT-
2XENIX root 3cPartitionMagic83Linux c4DRDOS/sec (FAT-
3XENIX usr 40Venix 80286 84OS/2 hidden C:c6DRDOS/sec (FAT-
4FAT16 <32M 41PPC PReP Boot 85Linux extendedc7Syrinx
5Extended 42SFS 86NTFS volume set daNon-FS data
6FAT16 4dQNX4.x 87NTFS volume set dbCP/M / CTOS / .
7HPFS/NTFS 4eQNX4.x 2nd part 88Linux plaintext deDell Utility
8AIX 4fQNX4.x 3rd part 8eLinux LVM dfBootIt
9AIX bootable 50OnTrack DM 93Amoeba e1DOS access
aOS/2 Boot Manag 51OnTrack DM6 Aux 94Amoeba BBT e3DOS R/O
bW95 FAT32 52CP/M 9fBSD/OS e4SpeedStor
cW95 FAT32 (LBA) 53OnTrack DM6 Aux a0IBM Thinkpad hi ebBeOS fs
eW95 FAT16 (LBA) 54OnTrackDM6 a5FreeBSD eeGPT
fW95 Ext'd (LBA) 55EZ-Drive a6OpenBSD efEFI (FAT-12/16/
10OPUS 56Golden Bow a7NeXTSTEP f0Linux/PA-RISC b
11Hidden FAT12 5cPriam Edisk a8Darwin UFS f1SpeedStor
12Compaq diagnost 61SpeedStor a9NetBSD f4SpeedStor
14Hidden FAT16 <3 63GNU HURD or Sys abDarwin boot f2DOS secondary
16Hidden FAT16 64Novell NetwareafHFS / HFS+ fbVMware VMFS
17Hidden HPFS/NTF 65Novell Netwareb7BSDI fs fcVMware VMKCORE
18AST SmartSleep70DiskSecure Mult b8BSDI swap fdLinux raid auto
1bHidden W95 FAT3 75PC/IX bbBoot Wizard hid feLANstep
1cHidden W95 FAT3 80Old Minix beSolaris boot ffBBT
1eHidden W95 FAT1
Hex code (type L to list codes): b
Changed system type of partition 1 to b (W95 FAT32)

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (34-1881, default 34):
Using default value 34
Last cylinder, +cylinders or +size{K,M,G} (34-1881, default 1881):
Using default value 1881

Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 83

Command (m for help): p

Disk /dev/sdb: 15.5 GB, 15479597056 bytes
255 heads, 63 sectors/track, 1881 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xcad4ebea

Device Boot Start End Blocks IdSystem
/dev/sdb1 1 33 265041 bW95 FAT32
/dev/sdb2 34 1881 14844060 83Linux

Command (m for help): a
Partition number (1-4): 1

Command (m for help): p

Disk /dev/sdb: 15.5 GB, 15479597056 bytes
255 heads, 63 sectors/track, 1881 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xcad4ebea

Device Boot Start End Blocks IdSystem
/dev/sdb1 * 1 33 265041 bW95 FAT32
/dev/sdb2 34 1881 14844060 83Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.
[root@localhost ~]#

格式化U盘的两个分区,并命名第一个分区卷名为boot,FAT32格式,第二个卷名为data,ext2格式,这个卷名大家随便起,各人习惯而已。

挂载boot分区和data分区到/mnt目录下

拷贝CentOS6.4第一张光盘CentOS-6.4-x86_64-bin-DVD1.iso中isolinux目录到U盘boot分区中并改名为syslinux目录,然后重命名isolinux.cfg文件为syslinux.cfg。

如果系统中没有安装syslinux工具,yum install syslinux安装一下。

使用syslinux工具将U盘的/dev/sdb1分区制作成启动盘,拷贝光盘中image目录到boot分区。

这样CentOS的U盘启动盘就OK了,接着我们将CentOS的两个DVDISO文件拷贝到U盘的data分区。CENTOS6.4 x86_64的ISO文件拷贝时间比较长,大约半小时到1小时之间。

因实体机截图不方便,所以在虚拟机VM测试,效果一样。
虚拟机要U盘启动要做一下设置。将U盘加载成虚拟硬盘。

NEXT,选择使用物理磁盘。

一般为最后一个,如果只有一个的话,关掉VMWARE,重新插拔U盘再开VMWARE。

如果有多个或自己不确认的话,下面看一下加载的硬盘空间大小就行了,我的是16G的U盘,加载后容量为14.4G

虚拟机开机后按F2,进入BIOS,启动U盘启动,F10保存。

下面就熟悉了,也没什么说的。

系统引导中

到这里,选择Hard drive

选择/dev/sdb1,sda是虚拟机硬盘,sdb1是U盘boot分区,sdb2为data分区。

OK继续

因为是测试机,所以随便分下区


这里要将boot loader从/dev/sdb改为/dev/sda2


下面按CTRL+ALT+F2,这一步挂载U盘的data分区到/mnt/isodir目录下。


按CTRL+ALT+F6回到安装界面。Retry.

PS:如果不想手动加载指定CENTOS的ISO文件位置,我们制作U盘时可以将image文件夹拷贝到U盘data根目录下。



快好了


重启电脑设置硬盘启动。



下面启动项为root (hd1,1),U盘第二个分区

可以按E后修改成(hd0,1)临时引导linux.









CentOS重启后还是会找不到硬盘分区,一般为下面三张错误信息。





这样电脑重启后还不能正常启动,有时需要重装下GRUB并改/boot/grub/grub.conf.指定正确的linux分区。
U盘启动时选择Rescue Installed System.

下面和上面安装时一样选择U盘













hd1被map到/dev/sda上面去了

下面修改下/boot/grub/grub.conf

三处地方更改为(hd0,1)

保存退出重启计算机。

启动后这里Relabeling会花一点时间。




That's all!
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics