fdisk 分区 -l 显示分区信息
fdisk -l
![](http://support.geisnic.com/ServicesHot/uploadfile/200803/20080309122229810.jpg)
![](http://support.geisnic.com/ServicesHot/uploadfile/200803/20080309122348888.jpg)
![](http://support.geisnic.com/ServicesHot/uploadfile/200803/20080309122451183.jpg)
![](http://support.geisnic.com/ServicesHot/uploadfile/200803/20080309122534971.jpg)
![](http://support.geisnic.com/ServicesHot/uploadfile/200803/20080309010201774.jpg)
![](http://support.geisnic.com/ServicesHot/uploadfile/200803/20080309010306678.jpg)
![](http://support.geisnic.com/ServicesHot/uploadfile/200803/20080309010549141.jpg)
![](http://support.geisnic.com/ServicesHot/uploadfile/200803/20080309010800507.jpg)
fdisk -l
![](http://support.geisnic.com/ServicesHot/uploadfile/200803/20080309122229810.jpg)
如果新磁盘未分区,进入fdisk分区模式对磁盘分区:
#fdisk /dev/sdb (在该模式下按照提示分区,没法给你描述了,你自己好好看看帮助输入m查看帮助,我给你把命令列出来吧:
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)
![](http://support.geisnic.com/ServicesHot/uploadfile/200803/20080309122317588.jpg)
#fdisk /dev/sdb (在该模式下按照提示分区,没法给你描述了,你自己好好看看帮助输入m查看帮助,我给你把命令列出来吧:
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)
![](http://support.geisnic.com/ServicesHot/uploadfile/200803/20080309122317588.jpg)
进入fdisk命令,输入h可以看到该命令的帮助,按n进行分区
![](http://support.geisnic.com/ServicesHot/uploadfile/200803/20080309122348888.jpg)
这里输入e即分为逻辑分区,按p即分为主分区,我们要将这块盘分为主分区即输入p
![](http://support.geisnic.com/ServicesHot/uploadfile/200803/20080309122451183.jpg)
到这里输入该主分区为第几个主分区,由于是新盘我们输入1来分第一个主分区
![](http://support.geisnic.com/ServicesHot/uploadfile/200803/20080309122534971.jpg)
接下来是定义该分区的大小,如果按默认(按回车)即是使用全部可用存储额,也可以是用M或m单位结尾的数字(大写M是大B的意思,如果输入1M实际上是X8也就是8m的空间),这里我们先分一个1G的空间,所以输入+1024m
![](http://support.geisnic.com/ServicesHot/uploadfile/200803/20080309010201774.jpg)
w参数表示保存退出
![](http://support.geisnic.com/ServicesHot/uploadfile/200803/20080309010306678.jpg)
再输入fdisk -l 可以看到我们刚才分的一个分区,之后用mkfs -t ext3 /dev/sdb1进行格式化,如有多个分区可把sdb1改成sdb2 sdb3...以此类推,具体可用fdisk -l看到每个分区的名字
![](http://support.geisnic.com/ServicesHot/uploadfile/200803/20080309010549141.jpg)
来看一下分区大小是否和预定的一样,使用df -TH命令看一下当前挂载的分区和大小,看到我们刚分的分区了吧
![](http://support.geisnic.com/ServicesHot/uploadfile/200803/20080309010800507.jpg)
最后将分区后的硬盘挂载上
mount /dev/sda1 /work2
mount /dev/sda1 /work2
如果想每次系统重启都能自动挂载该分区可修改/etc/fstab文件,在最后加一段 /dev/sdb1 /sda1 ext3 defaults 1 2 (格式说明:/dev/sdb1 代表哪个分区 ext3是该分区的格式 defaults 是挂载时所要设定的参数(只读,读写,启用quota等),输入defaults包括的参数有(rw、dev、exec、auto、nouser、 async) ,1是使用dump是否要记录,0是不要。 2是开机时检查的顺序,是boot系统文件就为1,其他文件系统都为2,如不要检查就为0)