linux分割槽
- IT科技
- 關注:2.49W次
產品型號:Thinkpad E15
系統版本:centos8
案例:在sdb盤上建一個分割槽,大小為1G
在虛擬機器上新增一塊硬碟
例:對sdb這塊盤劃分一個100M的分割槽出來
[root@xuegod63 ~]# fdisk /dev/sdb
...
Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition 刪除分割槽
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types 顯示分割槽型別
m print this menu 列印幫助選單
n add a new partition 新增新的分割槽
o create a new empty DOS partition table
p print the partition table 顯示分割槽表
q quit without saving changes 不儲存,退出
s create a new empty Sun disklabel
t change a partition's system id 改變分割槽型別
u change display/entry units
v verify the partition table
w write table to disk and exit 寫分割槽表資訊到硬碟,儲存操作並退出
x extra functionality (experts only)
Command (m for help): p -----列印分割槽表
Command (m for help): n ----新建一個分割槽
Partition type:
p primary (2 primary, 0 extended, 2 free) p:主分割槽
e extended e:擴充套件分割槽
Select (default p): --#直接預設
Using default response p
Partition number (1,4, default 1): ---#直接預設
First sector (1230848-41943039, default 1230848): ---#直接預設
Using default value 1230848
Last sector, +sectors or +size{K,M,G} (1230848-41943039, default 41943039): +1G
#輸入分割槽大小
Partition 3 of type Linux and of size 1 GiB is set
Command (m for help): w #儲存退出
格式化並建立檔案系統
[root@xuegod63 ~]# mkfs.xfs /dev/sdb1
注:-f 引數可以對已經存在檔案系統的分割槽,強制格式化
[root@xuegod63 ~]# mkdir /sdb1 #建立掛載點
[root@xuegod63 ~]# mount /dev/sdb1 /sdb1/#掛載
[root@xuegod63 ~]# df -h #檢視
總結:
1. 新增硬碟
2. fdisk /dev/sdb建立分割槽
3. mkfs.xfs /dev/sdb1格式化並建立檔案系統
4. 建立掛載目錄/sdb1
5. 掛載/dev/sdb1到/sdb1
- 文章版權屬於文章作者所有,轉載請註明 https://shqsg.com/dianzi/6q234.html