一、磁盤(pán)的基本概念
可以存放資料,可以存儲(chǔ)海量照片音樂(lè)和視頻等。
二、磁盤(pán)的基本結(jié)構(gòu)
1、盤(pán)片:硬盤(pán)一般有一個(gè)或多個(gè)盤(pán)片,每個(gè)盤(pán)片可以有兩面,一個(gè)盤(pán)面的正面為0面,反面為1面。
2、磁道:負(fù)責(zé)存儲(chǔ)數(shù)據(jù)
3、扇區(qū):512字節(jié) 數(shù)據(jù)是存儲(chǔ)在哪個(gè)磁道哪個(gè)扇區(qū)
4、柱面:抽象出來(lái)的一個(gè)邏輯概念,簡(jiǎn)單來(lái)說(shuō)處于同一個(gè)垂直區(qū)域的磁道稱為柱面。
三、磁盤(pán)的預(yù)備知識(shí)
1、磁盤(pán)的接口
(1)IDE out
(2)Scsi out
(3)SATA III 6Gbps/s 750MB/s 1T 400 100MB/s
(4)SAS 8Gbps/s 1000MB/s 1T 4500
(5)SSD 純電子 抗摔
2、接口類型
(1)SATA 幾乎所有主板都兼容, 便宜 性能差
(2)PCI-E 需要看主板是否兼容, 貴, 性能高
3、傳輸通道
(1)PCI-E AHCI
(2)NVMe
4、磁盤(pán)的名詞術(shù)語(yǔ)
(1)容量 MB GB TB PB EB ......…….
(2)轉(zhuǎn)速 SATA3 ==7200 SAS 15000 (非常之高) 磁盤(pán)陣列RAID
(3)尺寸 3.5 2.5 1.8
(4)IOPS Input/Output 輸入輸出
(5)順序讀寫(xiě)
(6)隨機(jī)讀寫(xiě)
四、磁盤(pán)管理
1、磁盤(pán)的命名規(guī)則
設(shè)備名稱 | 分區(qū)信息 | 設(shè)備類型 |
---|---|---|
/dev/sda | /dev/sda1 | 第一塊物理磁盤(pán)第一分區(qū) |
/dev/sdb | /dev/sdb2 | 第二塊物理磁盤(pán)第二分區(qū) |
/dev/vdd | /dev/vdd4 | 第四塊虛擬磁盤(pán)的第四個(gè)分區(qū) |
2、添加新硬盤(pán)
在虛擬機(jī)中添加硬盤(pán)需要關(guān)閉虛擬機(jī),在真實(shí)服務(wù)器上添加硬盤(pán)不需要關(guān)機(jī)(支持熱插拔)。
一直選擇下一步即可。
3、分區(qū)
使用 “fdisk” 進(jìn)行分區(qū)。可分為主分區(qū)(P) 擴(kuò)展分區(qū)(e) 邏輯分區(qū)(l)
MBR: 只能分配4個(gè)主分區(qū) 如果足夠使用就行。
MBR: 分配7個(gè)分區(qū),怎么辦?
(1)3主分區(qū) 1擴(kuò)展分區(qū)(4個(gè)邏輯分區(qū))
(2)2主分區(qū) 1擴(kuò)展分區(qū)(5個(gè)邏輯分區(qū))
(3)1主分區(qū) 1擴(kuò)展分區(qū)6個(gè)邏輯分區(qū))
[root@oldboy ~]# fdisk -l #查看分區(qū)狀況
[root@oldboy ~]# fdisk /dev/sdb #進(jìn)入分區(qū)
Command (m for help): m #輸入m列出常用的命令
Command (m for help): n #輸入n創(chuàng)建一個(gè)新分區(qū)
?
#創(chuàng)建主分區(qū)
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free) #主分區(qū)
e extended #擴(kuò)展分區(qū)
Select (default p): p #創(chuàng)建主分區(qū)
Partition number (1-4, default 1): #默認(rèn)創(chuàng)建第一個(gè)分區(qū)
First sector (2048-2147483647, default 2048): #默認(rèn)起始扇區(qū)大小,回車
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-2147483647, default 2147483647): +10G
#結(jié)束扇區(qū)大小
Partition 1 of type Linux and of size 10 GiB is set
?
#創(chuàng)建擴(kuò)展分區(qū)
Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): e #創(chuàng)建擴(kuò)展分區(qū)
Partition number (2-4, default 2):
First sector (20973568-2147483647, default 20973568):
Using default value 20973568
Last sector, +sectors or +size{K,M,G} (20973568-2147483647, default 2147483647):
Using default value 2147483647
Partition 2 of type Extended and of size 1014 GiB is set
?
#創(chuàng)建邏輯分區(qū)
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)建邏輯分區(qū)
Adding logical partition 5
First sector (20975616-2147483647, default 20975616):
Using default value 20975616
Last sector, +sectors or +size{K,M,G} (20975616-2147483647, default 2147483647): +10G
Partition 5 of type Linux and of size 10 GiB is set
?
Command (m for help): w #保存并退出</pre>
4、格式化
[root@oldboy ~]# mkfs -t xfs /dev/sdb1 #格式分區(qū)
5、掛載
[root@oldboy ~]# mkdir /mnt/aa #創(chuàng)建掛載點(diǎn)
[root@oldboy ~]# mount /dev/sdb1 /mnt/aa #掛載
[root@oldboy ~]#df -h #查看分區(qū)狀況</pre>