歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> linux系統硬盤分區工具之fdisk

linux系統硬盤分區工具之fdisk

日期:2017/3/1 16:17:21   编辑:關於Linux
linux系統硬盤分區工具之fdisk fdisk是linux下的一個硬盤分區工具硬盤分區原理一樣,但工具格式等等都不一樣,一個是在裝系統時的分區,一個是裝好系統後的分區 裝系統時的分區,裝好系統後一般是沒法修改也不好調整的,在裝系統時未分區的硬盤空間,裝好系統後是可以操作或分區加載的 這裡主要是說這種情況,一個是對未分區的空閒硬盤的操作,又或是對新加的硬盤操作 這裡就要用到fdisk了,不過這個只能在2T以內的硬盤操作,大於2T的,就沒法用了,得用到另一個parted的工具 還有一點,Linux對於硬盤的理解是以 /dev/hd|sd(a|b|xxx)這樣方式的 hd主要是對於IDE的硬盤,這個已經很少見了 大部分都是sd開頭的,包括stata,sas,scsi等接口的硬盤,比如 hda是第一塊硬盤 hdb是第二塊硬盤 sda是第一塊硬盤 sdb是第二塊硬盤 這裡的順序,還和一個因素有關,就是接口順序或是跳線,大家應該知道,硬盤接口裡是有一個跳線什麼的,也就是一個主硬盤等 下面介紹fdisk的用法 fdisk -l是列表所有的硬盤,如下 [root@hnwt ~]# fdisk -l Disk /dev/sda: 320.0 GB, 320071851520 bytes 255 heads, 63 sectors/track, 38913 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 13 104391 83 Linux /dev/sda2 14 38913 312464250 8e Linux LVM fdisk /dev/sda表示操作硬盤,運行這個後會進入fdisk的交互狀態,如下 [root@hnwt ~]# fdisk /dev/sda The number of cylinders for this disk is set to 38913. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Command (m for help): 這裡提示你,按m會提示一個幫助,如 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): 上面這裡就列出了所有的參數 根據上面的提示,可以繼續操作,如下簡單說明 新加分區 1 按n新加 2 選擇主分區/擴展分區 3 起始值,默認回車就可以 4 分區大小值 完成 刪除分區 1 按d 2 選擇相應的分區號,回車即可 改變分區類型 1 按t 2 選擇分區 3 選擇分區類型(按l可列表所有分區及ID) linux下主要是一個交換分區裡需要在此操作 一般的操作,有如上的三個 在所有操作完時,也確保正確時,可以按w保存並退出 如果有操作有誤,按q直接退出就可以
Copyright © Linux教程網 All Rights Reserved