Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 128 512000 82 Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/sda3 128 3264 25189376 83 Linux
[root@model ~]# fdisk /dev/sdb -----/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) 注:扩展应用,专家功能;
Command (m for help): p ---打印分区情况 ,如果没有分区,则不会显示任何分区信息
Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 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: 0x8c30c419
Device Boot Start End Blocks Id System
Command (m for help): n ----添加分区
Command action
e extended
p primary partition (1-4)
p ---输入P 创建主分区 ,主分区可以创建4个
Partition number (1-4): 1
First cylinder (1-1305, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1305, default 1305):
Using default value 1305
Command (m for help): w ----将分区写入磁盘
The partition table has been altered!
Device Boot Start End Blocks Id System
/dev/sdb1 1 1305 10482381 83 Linux
[root@model ~]# mount /dev/sdb1 /mnt/sdb1 ---如果没有对分区进行格式化,挂载失败
mount: you must specify the filesystem type
[root@model ~]# mkfs.ext3 /dev/sdb1 ----格式化磁盘系统为ext3
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
655360 inodes, 2620595 blocks
131029 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2684354560
80 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
This filesystem will be automatically checked every 35 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@model ~]# mkdir /mnt/sdb1 ---创建磁盘挂载点
[root@model ~]# mount /dev/sdb1 /mnt/sdb1 --- 成功挂载磁盘