Chinaunix首页 | 论坛 | 博客
  • 博客访问: 120925
  • 博文数量: 35
  • 博客积分: 1672
  • 博客等级: 上尉
  • 技术积分: 412
  • 用 户 组: 普通用户
  • 注册时间: 2010-04-19 15:16
文章分类

全部博文(35)

文章存档

2012年(5)

2011年(9)

2010年(21)

我的朋友

分类: LINUX

2010-06-05 01:37:08

1.如果u盘8G或者以上,最好先给u盘分区,只留出4G来安装linux。分区当然是使用fdisk。具体的就研究fdisk去吧。分区后一定要让u盘可启动,就是在fdisk 中的 a 命令。然后给u盘创建文件系统。如下:
[root@localhost ~]# fdisk /dev/sda

The number of cylinders for this disk is set to 30584.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): p

Disk /dev/sda: 8017 MB, 8017412096 bytes
16 heads, 32 sectors/track, 30584 cylinders
Units = cylinders of 512 * 512 = 262144 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       30590     7831024    6  FAT16

Command (m for help): d
Selected partition 1

Command (m for help): p

Disk /dev/sda: 8017 MB, 8017412096 bytes
16 heads, 32 sectors/track, 30584 cylinders
Units = cylinders of 512 * 512 = 262144 bytes

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-30584, default 1): 回车
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-30584, default 30584): 14000

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (14001-30584, default 14001): 回车
Using default value 14001
Last cylinder or +size or +sizeM or +sizeK (14001-30584, default 30584): 回车
Using default value 30584

Command (m for help): p

Disk /dev/sda: 8017 MB, 8017412096 bytes
16 heads, 32 sectors/track, 30584 cylinders
Units = cylinders of 512 * 512 = 262144 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1       14000     3583984   83  Linux
/dev/sda2           14001       30584     4245504   83  Linux

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

Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): b
Changed system type of partition 1 to b (W95 FAT32)

Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): b
Changed system type of partition 2 to b (W95 FAT32)

Command (m for help): p

Disk /dev/sda: 8017 MB, 8017412096 bytes
16 heads, 32 sectors/track, 30584 cylinders
Units = cylinders of 512 * 512 = 262144 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1       14000     3583984    b  W95 FAT32
/dev/sda2   *       14001       30584     4245504    b  W95 FAT32

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: 设备或资源忙.
The kernel still uses the old table.
The new table will be used at the next reboot.

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 ~]#

[root@localhost ~]# mkfs.vfat /dev/sda1
        (将分区一格式化为FAT32)
mkfs.vfat 2.11 (12 Mar 2005)
[root@localhost ~]# mkfs.vfat /dev/sda2
        (将分区二格式化为FAT32)
mkfs.vfat 2.11 (12 Mar 2005)
[root@localhost ~]#

2.在Linux下,在
U盘第二个分区根目录创建boot文件夹,然后将(硬盘中) /boot中的 grub文件夹 整个 复制 到U盘的boot文件夹;从网上下载 CentOS-5.4-i386-bin-DVD.iso,将其放在U盘第二个分区根目录中;将CentOS-5.4-i386-bin-DVD.iso中的isolinux文件夹提取出来,放在U盘第二个分区根目录中(如果是Fefora 10/11/12,则需要将Fefora*.iso中的images文件夹 也 提取出来,放在U盘第二个分区根目录中

[root@localhost disk-1]# tree (列出
U盘第二个分区根目录中的内容)
.
|-- CentOS-5.4-i386-bin-DVD.iso
|-- boot
|   `-- grub
|       |-- device.map
|       |-- e2fs_stage1_5
|       |-- fat_stage1_5
|       |-- ffs_stage1_5
|       |-- grub.conf
|       |-- grub.conf~
|       |-- iso9660_stage1_5
|       |-- jfs_stage1_5
|       |-- minix_stage1_5
|       |-- reiserfs_stage1_5
|       |-- splash.xpm.gz
|       |-- stage1
|       |-- stage2
|       |-- ufs2_stage1_5
|       |-- vstafs_stage1_5
|       `-- xfs_stage1_5
`-- isolinux
    |-- boot.cat
    |-- boot.msg
    |-- general.msg
    |-- initrd.img
    |-- isolinux.bin
    |-- isolinux.cfg
    |-- memtest
    |-- options.msg
    |-- param.msg
    |-- rescue.msg
    |-- splash.lss
    `-- vmlinuz

3 directories, 29 files
[root@localhost disk-1]#
3.  编辑U盘中的 /boot/grub/grub.conf 文件,内容如下:

#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,10)
#          kernel /vmlinuz-version ro root=/dev/hda3
#          initrd /initrd-version.img
#boot=/dev/hda
default=0
timeout=10
splashimage=(hd0,1)/grub/splash.xpm.gz

title Install CentOS 5.4
    kernel (hd0,1)/
isolinux/vmlinuz
    initrd (hd0,1)/
isolinux/initrd.img




4. 
在Linux下,依次执行如下命令:

[root@localhost ~]# grub

grub> root (hd
<敲TAB键>
 Possible disks are:  hd0 hd1
  注:hd0是硬盘,hd1是U盘

grub> root (hd1,
<敲TAB键>
 Possible partitions are:
   Partition num: 0,  Filesystem type is fat, partition type 0xb
   Partition num: 1,  Filesystem type is fat, partition type 0xb

grub> root (hd1,1)
            注:(hd1,1)是U盘的第2个分区
 Filesystem type is fat, partition type 0xb

grub> setup (hd1)
             注:安装 GRUB 的引导程序的stage1到U盘的MBR
 Checking if "/boot/grub/stage1" exists... yes
 Checking if "/boot/grub/stage2" exists... yes
 Checking if "/boot/grub/fat_stage1_5" exists... yes
 Running "embed /boot/grub/fat_stage1_5 (hd1)"...  15 sectors are embedded.
succeeded
 Running "install /boot/grub/stage1 (hd1) (hd1)1+15 p (hd1,1)/boot/grub/stage2 /boot/grub/grub.conf
"... succeeded
Done.

grub> quit


5.  OK,设置BIOS,U盘启动,进行安装。
阅读(2274) | 评论(0) | 转发(0) |
0

上一篇:fdisk 分区

下一篇:Linux SCP文件拷贝

给主人留下些什么吧!~~