天天看點

挂載硬碟

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

從查詢結果看出,多了一個/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了。

/dev/sdb116525237158+83Linux

[root@db1/]#

如果建立完之後,/proc/partitions檢視不到對應的分區,使用parprobe指令重新整理一下就可以了:

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

majorminor#blocksname

80175825944sda

811020096sda1

8230716280sda2

838193150sda3

[root@web1~]#partprobe/dev/sda

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

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

本文轉自東方之子736651CTO部落格,原文連結:http://blog.51cto.com/ecloud/1300580 ,如需轉載請自行聯系原作者

繼續閱讀