使用fdisk命令管理磁盤分區(qū)詳解
更新時間:2023年06月07日 09:09:07 作者:淡定的鑰匙扣
這篇文章主要為大家介紹了使用fdisk命令管理磁盤分區(qū)詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪
fdisk命令
fdisk命令來自于英文詞組“Partition table manipulator for Linux”的縮寫,其功能是用于管理磁盤的分區(qū)信息。如果一套幾百平米的房子內部沒有墻壁,雖然看起來會很敞亮,但是各種聲音、氣味、物品會隨意充斥在整個房子內,讓人極不舒適,因此需要用墻壁按照功能進行劃分,例如臥室、廁所、廚房、陽臺等等。
fdisk命令可以用于對磁盤進行分區(qū)操作,用戶可以根據實際情況進行合理劃分,這樣后期掛載和使用時會方便很多。
語法格式: fdisk [參數(shù)] [設備]
常用參數(shù)
-b | 指定每個分區(qū)的大小 |
---|---|
-l | 列出指定的外圍設備的分區(qū)表狀況 |
-s | 將指定的分區(qū)大小輸出到標準輸出上,單位為區(qū)塊 |
-u | 搭配”-l”參數(shù)列表,會用分區(qū)數(shù)目取代柱面數(shù)目,來表示每個分區(qū)的起始地址 |
-v | 顯示版本信息 |
參考實例
查看當前系統(tǒng)的分區(qū)情況
[root@linuxcool ~]# fdisk -l Disk /dev/sda: 20 GiB, 21474836480 bytes, 41943040 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x5f1d8ee5 Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 2099199 2097152 1G 83 Linux /dev/sda2 2099200 41943039 39843840 19G 8e Linux LVM ………………省略部分輸出信息………………
管理指定硬盤的分區(qū)
(過程省略):
[root@linuxcool ~]# fdisk /dev/sda Welcome to fdisk (util-linux 2.32.1). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): n All space for primary partitions is in use. Command (m for help): m Help: DOS (MBR) a toggle a bootable flag b edit nested BSD disklabel c toggle the dos compatibility flag Generic d delete a partition F list free unpartitioned space l list known partition types n add a new partition p print the partition table t change a partition type v verify the partition table i print information about a partition Misc m print this menu u change display/entry units x extra functionality (experts only) Script I load disk layout from sfdisk script file O dump disk layout to sfdisk script file Save & Exit w write table to disk and exit q quit without saving changes Create a new label g create a new empty GPT partition table G create a new empty SGI (IRIX) partition table o create a new empty DOS partition table s create a new empty Sun partition table ………………省略部分輸出信息………………
以上就是使用fdisk命令管理磁盤分區(qū)詳解的詳細內容,更多關于fdisk命令管理磁盤分區(qū)的資料請關注腳本之家其它相關文章!