linux命令行制作u盘启动盘,linux下用fdisk命令制作U盘启动盘

FDISK进行硬盘分区从实质上说就是对硬盘的一种格式化。当我们创建分区时,就已经设置好了硬盘的各项物理参数,指定了硬盘主引导记录(即MasterBootRecord,MBR)和引导记录备份的存放位置。而对于文件系统以及其他操作系统管理硬盘所需要的信息则是通过之后的高级格式化,即Format命令来实现。用一个形象的比喻,分区就好比在一张白纸上画一个大方框。而格式化好比在方框里打上格子。安装各种软件就好比在格子里写上字。分区和格式化就相当于为安装软件打基础,实际上它们为电脑在硬盘上存储数据起到标记定位的作用。

语 法

fdisk [-b ][-uv][外围设备代号] 或 fdisk [-l][-b ][-uv][外围设备代号...] 或 fdisk [-s ]

补充说明

fdisk是用来磁盘分区的程序,它采用传统的问答式界面,而非类似DOS fdisk的cfdisk互动式操作界面,因此在使用上较为不便,但功能却丝毫不打折扣。

参数

-b 指定每个分区的大小。

-l 列出指定的外围设备的分区表状况。

-s 将指定的分区大小输出到标准输出上,单位为区块。

-u 搭配"-l"参数列表,会用分区数目取代柱面数目,来表示每个分区的起始地址。

-v 显示版本信息。

[bill@bill ~]$ su

密码:

[root@bill bill]# fdisk /dev/sdb

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 注:l是列出分区类型,以供我们设置相应分区的类型;

m print this menu 注:m 是列出帮助信息;

n add a new partition 注:添加一个分区;

o create a new empty DOS partition table

p print the partition table 注:p列出分区表;

q quit without saving changes 注:不保存退出;

s create a new empty Sun disklabel

t change a partition's system id 注:t 改变分区类型;

u change display/entry units

v verify the partition table

w write table to disk and exit 注:把分区表写入硬盘并退出;

x extra functionality (experts only) 注:扩展应用,专家功能;

[root@bill bill]

[root@bill bill]$ fdisk -l

Disk /dev/sda: 238.7 GB, 238712811008 bytes

255 heads, 63 sectors/track, 29021 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: 0x00064225

Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1        6528    52428800    7  HPFS/NTFS

/dev/sda2            6528       11749    41943040    7  HPFS/NTFS

/dev/sda3           11749       26109   115343360    7  HPFS/NTFS

/dev/sda4           26109       29022    23401472   83  Linux

Disk /dev/sdb: 16.0 GB, 16008609792 bytes

255 heads, 63 sectors/track, 1946 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: 0x00000000

Device Boot      Start         End      Blocks   Id  System

/dev/sdb1   *           1        1947    15632384    c  W95 FAT32 (LBA)

[root@bill bill]# 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 1

Command (m for help): p

Disk /dev/sdb: 16.0 GB, 16008609792 bytes

255 heads, 63 sectors/track, 1946 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: 0x00000000

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-1946, default 1):

Using default value 1

Last cylinder, +cylinders or +size{K,M,G} (1-1946, default 1946): +2G

Command (m for help): n

Command action

e   extended

p   primary partition (1-4)

p

Partition number (1-4): 2

First cylinder (263-1946, default 263):

Using default value 263

Last cylinder, +cylinders or +size{K,M,G} (263-1946, default 1946):

Using default value 1946

Command (m for help): a

Partition number (1-4): 2       将第二个分区作为启动分区,因为在Windows中只能识别第一个分区

Command (m for help): p

Disk /dev/sdb: 16.0 GB, 16008609792 bytes

255 heads, 63 sectors/track, 1946 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: 0x00000000

Device Boot      Start         End      Blocks   Id  System

/dev/sdb1              1         1683    13526730   83  Linux

/dev/sdb2   *          1684        1946    2104483+   83  Linux

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

[root@bill grub4dos-0.4.4]# mkfs.ntfs /dev/sdb1

Cluster size has been automatically set to 4096 bytes.

Initializing device with zeroes: 100% - Done.

Creating NTFS volume structures.

mkntfs completed successfully. Have a nice day.

[root@bill grub4dos-0.4.4]# ./bootlace.com /dev/sdb

Disk geometry calculated according to the partition table:

Sectors per track = 63, Number of heads = 255

Success.

[root@bill grub4dos-0.4.4]# mount -t ntfs-3g /dev/sdb1 /media

[root@bill grub4dos-0.4.4]# exit

exit

[bill@bill ~]$ cd Downloads/grub4dos-0.4.4

[bill@bill grub4dos-0.4.4]$ cp grldr /media

然后编辑menu.lst文件,将需要启动的系统列表添加进去

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值