最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Linux使用fdisk進行磁盤的相關操作

 更新時間:2025年01月23日 10:13:11   作者:唐青楓  
fdisk?命令是?Linux?中用于管理磁盤分區(qū)的強大文本實用程序,這篇文章主要為大家詳細介紹了如何使用fdisk進行磁盤的相關操作,需要的可以了解下

簡介

fdisk 命令是 Linux 中用于管理磁盤分區(qū)的強大文本實用程序。它可以創(chuàng)建、刪除、調整大小和修改硬盤上的分區(qū)。

基本語法

fdisk [options] <device>

<device>:要管理的磁盤,例如 /dev/sda、/dev/nvme0n1 或 /dev/vda

示例用法

列出所有分區(qū)

將顯示所有可用的磁盤及其分區(qū),包括它們的大小和文件系統(tǒng)

fdisk -l

示例輸出

Disk /dev/sda: 500 GB
Sector size (logical/physical): 512B/512B
Device     Boot   Start       End   Sectors  Size Id Type
/dev/sda1  *       2048   1050623  1048576  512M 83 Linux
/dev/sda2       1050624 976773167 975722544 465G 83 Linux

查看指定磁盤的區(qū)分

fdisk -l /dev/sda

管理指定的磁盤

這將打開一個交互式會話來管理磁盤 /dev/sda

fdisk /dev/sda

進入交互式模式

fdisk /dev/sda

示例輸出

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
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   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):

示例

Command (m for help):

常用的交互式命令有

  • m:顯示幫助(顯示所有可用的命令)
  • p:打印所選磁盤的分區(qū)表
  • n:添加一個新分區(qū)
  • d:刪除一個存在的分區(qū)
  • t:變更分區(qū)類型,如:Linux、swap
  • a:切換分區(qū)的可啟動標志
  • w:將更改寫入磁盤并退出
  • q:退出而不保存更改

創(chuàng)建一個新的分區(qū)

指定目標磁盤

fdisk /dev/sda

輸入 n 來創(chuàng)建一個新分區(qū)

  • 選擇主分區(qū)(p)或 擴展分區(qū)(e
  • 指定分區(qū)號、起始扇區(qū)和結束扇區(qū)(或大?。?/li>

輸入 w 來保存變更然后退出

刪除一個存在的分區(qū)

指定目標磁盤

fdisk /dev/sda

輸入 d 接分區(qū)編號來刪除一個分區(qū)

輸入 w 來保存變更然后退出

變更分區(qū)類型

指定目標磁盤

fdisk /dev/sda

輸入 t 來變更分區(qū)類型

  • 輸入分區(qū)編號
  • 輸入類型代碼,例如:82 表示 Linux swap83 表示 Linux,7 表示 NTFS

輸入 w 來保存變更然后退出

將分區(qū)標記為可引導

指定目標磁盤

fdisk /dev/sda
  • 輸入 a 來切換可引導標志
  • 輸入 w 來保存變更然后退出

檢查分區(qū)大小

fdisk -s /dev/sda2

設置磁盤的扇區(qū)大小

fdisk -b 2048 /dev/sda

列出分區(qū)表時,給出扇區(qū)大小,而不是柱面大小

fdisk -u /dev/sda

設置磁盤的磁頭數

fdisk -H 16 /dev/sda

設置磁盤的柱面數

fdisk -C 100 /dev/sda

設置磁盤每個磁道的扇區(qū)數

fdisk -S 63 /dev/sda

檢查分區(qū)變化

partprobe

使用場景

管理基于 MBR 的分區(qū)(針對 ≤ 2 TB 的磁盤)

對于更大的磁盤或 GPT 分區(qū),需要使用 gdiskparted

到此這篇關于Linux使用fdisk進行磁盤的相關操作的文章就介紹到這了,更多相關Linux fdisk磁盤操作內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!

相關文章

最新評論

绥化市| 濮阳市| 时尚| 扎鲁特旗| 巴彦淖尔市| 嘉祥县| 营口市| 兰州市| 永新县| 屯门区| 凤山县| 翁牛特旗| 丽江市| 玛多县| 成安县| 黑龙江省| 武安市| 英德市| 临汾市| 巴彦县| 任丘市| 鄂托克旗| 正定县| 绥棱县| 台湾省| 巨鹿县| 温泉县| 乐陵市| 新乡市| 苗栗市| 西和县| 安岳县| 肇源县| 宁武县| 澄迈县| 罗田县| 齐齐哈尔市| 荃湾区| 奉贤区| 元谋县| 章丘市|