其中 fdisk 指令較為常用,但不支援大于 2TB 的分區;如果需要支援大于 2TB 的分區,則需要使用 parted 指令,當然 parted 指令也能配置設定較小的分區。我們先來看看如何使用 fdisk 指令進行分區。
fdisk 指令的格式如下:
[[email protected] ~]# fdisk ~l
#列出系統分區
[[email protected] ~]# fdisk 裝置檔案名
#給硬碟分區
注意,千萬不要在目前的硬碟上嘗試使用 fdisk,這會完整删除整個系統,一定要再找一塊硬碟,或者使用虛拟機。
以硬碟 /dev/sdb 為例做練習,指令如下:
[[email protected] ~]# fdisk /dev/sdb
#給/dev/sdb分區
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xed7e8bc7.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated.it's strongly recommended to switch off the mode (command 'c') and change display units to sectors (command 'u').
Command (m for help):m
#互動界面的等待輸入指令的位置,輸入 m 得到幫助
Command action
#可用指令
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
I 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 verity the partition table
w write table to disk and exit
x extra functionality (experts only)
注意這裡的分區指令是 “fdisk /dev/sdb”,這是因為硬碟并沒有分區,使用 fdisk 指令的目的就是建立分區。
https://www.west.cn/cloudhost/
聲明:本網站釋出的内容(圖檔、視訊和文字)以使用者投稿、使用者轉載内容為主,如果涉及侵權請盡快告知,我們将會在第一時間删除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-62778877-8261;郵箱:[email protected]。本站原創内容未經允許不得轉載,或轉載時需注明出處::西部數位資訊門戶 » 雲伺服器硬碟如何分區