[root@localhost ~]# fdisk ~l
#列出系統分區
[root@localhost ~]# fdisk 設備文件名
#給硬盤分區
[root@localhost ~]# fdisk -l
#查詢本機可以識別的硬盤和分區
Disk /dev/sda:32.2 GB, 32212254720 bytes
#硬盤文件名和硬盤大小
255 heads, 63 sectors/track, 3916 cylinders
#共255個磁頭、63個扇區和3916個柱面
Units = cylinders of 16065 *512 = 8225280 bytes
#每個柱面的大小
Sector size (logical/physical): 512 bytes/512 bytes
#每個扇區的大小
I/O size (minimum/optimal): 512 bytes/512 bytes
Disk identifier: 0x0009e098
Device Boot Start End Blocks ld System
/dev/sda1 * 1 26 204800 83 Linux
Partition 1 does not end on cylinder boundary.
#分區1沒有占滿硬盤
/dev/sda2 26 281 2048000 82 Linux swap / Solaris
Partition 2 does not end on cylinder boundary
#分區2沒有占滿硬盤
/dev/sda3 281 3917 29203456 83 Linux
#設備文件名啟動分區 起始柱面 終止柱面容量 ID 系統
Disk /dev/sdb: 21.5 GB, 21474836480 bytes #第二個硬盤識別,這個硬盤的大小
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes/512 bytes Disk identifier: 0x00000000
[root@localhost ~]# 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)
| 命令 | 說 明 |
|---|---|
| a | 設置可引導標記 |
| b | 編輯 bsd 磁盤標簽 |
| c | 設置 DOS 操作系統兼容標記 |
| d | 刪除一個分區 |
| 1 | 顯示已知的文件系統類型。82 為 Linux swap 分區,83 為 Linux 分區 |
| m | 顯示幫助菜單 |
| n | 新建分區 |
| 0 | 建立空白 DOS 分區表 |
| P | 顯示分區列表 |
| q | 不保存退出 |
| s | 新建空白 SUN 磁盤標簽 |
| t | 改變一個分區的系統 ID |
| u | 改變顯示記錄單位 |
| V | 驗證分區表 |
| w | 保存退出 |
| X | 附加功能(僅專家) |
新聞熱點
疑難解答