1.添加磁盘,查看磁盘状况

[root@db1/]#fdisk-l

Disk/dev/sda:10.7GB,10737418240bytes

255heads,63sectors/track,1305cylinders

Units=cylindersof16065*512=8225280bytes

DeviceBootStartEndBlocksIdSystem

/dev/sda1*15113059277537+83Linux

/dev/sda211501204843+82Linuxswap

Partitiontableentriesarenotindiskorder

Disk/dev/sdb:5368MB,5368709120bytes

255heads,63sectors/track,652cylinders

Units=cylindersof16065*512=8225280bytes

DeviceBootStartEndBlocksIdSystem

从查询结果看出,多了一个/dev/sdb的盘

2.fdisk/dev/sdb进行分区

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

Command(mforhelp):n

Commandaction

eextended

pprimarypartition(1-4)

p

Partitionnumber(1-4):1

Firstcylinder(1-652,default1):

Usingdefaultvalue1

Lastcylinderor+sizeor+sizeMor+sizeK(1-652,default652):

Usingdefaultvalue652

Command(mforhelp):w

Thepartitiontablehasbeenaltered!

Callingioctl()tore-readpartitiontable.

Syncingdisks.

再次查看分区情况,多出来一个/dev/sdb1的区,这个1是我们在前面指定的,如果我们指定2,就变成sdb2了。

[root@db1/]#fdisk-l

Disk/dev/sda:10.7GB,10737418240bytes

255heads,63sectors/track,1305cylinders

Units=cylindersof16065*512=8225280bytes

DeviceBootStartEndBlocksIdSystem

/dev/sda1*15113059277537+83Linux

/dev/sda211501204843+82Linuxswap

Partitiontableentriesarenotindiskorder

Disk/dev/sdb:5368MB,5368709120bytes

255heads,63sectors/track,652cylinders

Units=cylindersof16065*512=8225280bytes

DeviceBootStartEndBlocksIdSystem

/dev/sdb116525237158+83Linux

[root@db1/]#

如果创建完之后,/proc/partitions查看不到对应的分区,使用parprobe命令刷新一下就可以了:

[root@web1~]#cat/proc/partitions
majorminor#blocksname


80175825944sda
811020096sda1
8230716280sda2
838193150sda3
[root@web1~]#partprobe/dev/sda
[root@web1~]#cat/proc/partitions
majorminor#blocksname


80175825944sda
811020096sda1
8230716280sda2
838193150sda3
84135893835sda4
[root@web1~]#



3.格式化/dev/sdb1分区

[root@db1/]#mkfs-text3/dev/sdb1

mke2fs1.35(28-Feb-2004)

Filesystemlabel=

OStype:Linux

Blocksize=4096(log=2)

Fragmentsize=4096(log=2)

655360inodes,1309289blocks

65464blocks(5.00%)reservedforthesuperuser

Firstdatablock=0

Maximumfilesystemblocks=1342177280

40blockgroups

32768blockspergroup,32768fragmentspergroup

16384inodespergroup

Superblockbackupsstoredonblocks:

32768,98304,163840,229376,294912,819200,884736

Writinginodetables:done

Creatingjournal(8192blocks):done

Writingsuperblocksandfilesystemaccountinginformation:done

Thisfilesystemwillbeautomaticallycheckedevery30mountsor

180days,whichevercomesfirst.Usetune2fs-cor-itooverride.

4.创建目录并将/dev/sdb1挂在到该目录下

[root@db1/]#ls

backupdevinitrdmediaoptsbinsysusr

binetclibmiscprocselinuxtftpbootvar

boothomelost+foundmntrootsrvtmp

[root@db1/]#mkdir/u01

[root@db1/]#ls

backupdevinitrdmediaoptsbinsysu01

binetclibmiscprocselinuxtftpbootusr

boothomelost+foundmntrootsrvtmpvar

[root@db1/]#mount/dev/sdb1/u01

5.验证挂载是否成功

[root@db1/]#df-k

Filesystem1K-blocksUsedAvailableUse%Mountedon

/dev/sda191317727066884160101282%/

none45425604542560%/dev/shm

/dev/sdb151548524304048499561%/backup

6.设置开机自动挂载

[root@db1/]#vi/etc/fstab

#Thisfileiseditedbyfstab-sync-see'manfstab-sync'fordetails

LABEL=//ext3defaults11

none/dev/ptsdevptsgid=5,mode=62000

none/dev/shmtmpfsdefaults00

none/procprocdefaults00

none/syssysfsdefaults00

LABEL=SWAP-sda2swapswapdefaults00

/dev/sdb1/u01ext3defaults00

/dev/hdc/media/cdromautopamconsole,exec,noauto,m

anaged00

/dev/fd0/media/floppyautopamconsole,exec,noauto,m

anaged00