fdisk /dev/sdb 磁盤分區(qū)
mkfs.xfs /dev/sdb1 磁盤格式化
df -h 查看分區(qū)使用情況
lsblk 查看分區(qū)情況
mount 掛載
-a 掛載全部
二. 磁盤分區(qū)步驟:
大體步驟:添加磁盤--->磁盤分區(qū)--->磁盤格式化--->掛載
詳細(xì)步驟:
[root@localhost ~]# fdisk /dev/sdb #對磁盤sdb進(jìn)行分區(qū)
Command (m for help): m #常用的:n d p w q
a toggle a bootable flag #切換分區(qū)啟動(dòng)標(biāo)記
b edit bsd disklabel #編輯sdb磁盤標(biāo)簽
c toggle the dos compatibility flag #切換dos兼容模式
d delete a partition #刪除分區(qū)
g create a new empty GPT partition table #創(chuàng)建一個(gè)新的GPT分區(qū)表
G create an IRIX (SGI) partition table #創(chuàng)建一個(gè)IRIX (SGI)分區(qū)表
l list known partition types #顯示分區(qū)類型
m print this menu #顯示幫助菜單
n add a new partition #新建分區(qū)
o create a new empty DOS partition table #創(chuàng)建新的空白分區(qū)表
p print the partition table #顯示分區(qū)表的信息
q quit without saving changes #不保存退出
s create a new empty Sun disklabel #創(chuàng)建新的Sun磁盤標(biāo)簽
t change a partition's system id #修改分區(qū)ID,可以通過l查看id
u change display/entry units #修改容量單位,磁柱或扇區(qū)
v verify the partition table #檢驗(yàn)分區(qū)表
w write table to disk and exit #保存退出
x extra functionality (experts only) #拓展功能
Command (m for help): n #創(chuàng)建分區(qū)
Partition type:
p primary (0 primary, 0 extended, 4 free) #創(chuàng)建主分區(qū)
e extended #創(chuàng)建擴(kuò)建分區(qū)
Select (default p): p
Partition number (1-4, default 1): 1 #分區(qū)號(hào),便于區(qū)分分區(qū)
First sector (2048-2147483647, default 2048): #默認(rèn)即可
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-2147483647, default 2147483647): +10G #為分區(qū)分配空間
Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): e #創(chuàng)建一個(gè)擴(kuò)展分區(qū)
Partition number (2-4, default 2): 2
First sector (20973568-2147483647, default 20973568):
Using default value 20973568
Last sector, +sectors or +size{K,M,G} (20973568-2147483647, default 2147483647): #不輸入,默認(rèn)分配磁盤剩余所有空間
Using default value 2147483647
Partition 2 of type Extended and of size 1014 GiB is set
Command (m for help): n
Partition type:
p primary (1 primary, 1 extended, 2 free)
l logical (numbered from 5)
Select (default p): l #創(chuàng)建一個(gè)邏輯分區(qū)
Adding logical partition 5 #分區(qū)號(hào)從5開始
First sector (20975616-2147483647, default 20975616):
Using default value 20975616
Last sector, +sectors or +size{K,M,G} (20975616-2147483647, default 2147483647): #不輸入,默認(rèn)分配擴(kuò)展分區(qū)剩余所有空間
Using default value 2147483647
Partition 5 of type Linux and of size 1014 GiB is set
Command (m for help): w #保存退出
[root@localhost ~]# mkfs.xfs /dev/sdb1 格式化sdb1
[root@localhost ~]# mkfs.xfs /dev/sdb5 格式化sdb5
[root@localhost ~]# mkdir text_1 text_2 #創(chuàng)建掛載點(diǎn)
[root@localhost ~]# mount /dev/sdb1 ./text_1 把sdb1掛載到text_1
[root@localhost ~]# mount /dev/sdb5 ./text_2 把sdb5掛載到text_2