#fdisk /dev/sdb
進入fdisk模式:
Command (m for help):p //查看新硬碟的分區
Command (m for help):n //建立新分區
Command action
e extended //輸入e為建立擴充分區
p primary partition (1-4) //輸入p為建立主要磁碟分割,這裡我們選擇p
Partion number(1-4):1 //第一個擴充分區,按您需求能夠最多分4個主要磁碟分割
First Cylinder(1-1014,default 1): 1 //第一個主要磁碟分割起始的磁碟塊數
Last cylindet or +siza or +sizeM or +sizeK: +1024MB //能夠是以MB為單位的數字或以
磁碟塊數,輸入+1024MB表示分區大小為1G。
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
#mkfs -t ext3 -c /dev/sdb1 //假如有多個分區,則分區修改為sdb2這樣
#mkdir www //建立/www目錄,我們將把新的分區掛到www下
#mount /dev/sdb1 /www //將/dev/sdb1掛載到/www
# df //用df命令進行查看
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda2 3771316 1388956 2190788 39% /
/dev/sda1 101089 9463 86407 10% /boot
none 62988 0 62988 0% /dev/shm
/dev/sdb1 485906 8239 452580 2% /www //
看到了,這就是剛才新掛載的分區
#vi /etc/fstab
/dev/sdb1 /www ext3 defaults 1 2