华南俳烁实业有限公司

考試首頁(yè) | 考試用書 | 培訓(xùn)課程 | 模擬考場(chǎng) | 考試論壇  
  當(dāng)前位置:Linux認(rèn)證 > 綜合輔導(dǎo) > 文章內(nèi)容
  

Linux磁盤管理教程與實(shí)例(3)

 [ 2017年1月30日 ] 【

fdisk

fdisk 是 Linux 的磁盤分區(qū)表操作工具。

語(yǔ)法:

fdisk [-l] 裝置名稱

選項(xiàng)與參數(shù):

  • -l :輸出后面接的裝置所有的分區(qū)內(nèi)容。若僅有 fdisk -l 時(shí), 則系統(tǒng)將會(huì)把整個(gè)系統(tǒng)內(nèi)能夠搜尋到的裝置的分區(qū)均列出來(lái)。

實(shí)例 1

列出所有分區(qū)信息

[root@AY120919111755c246621 tmp]# fdisk -l

Disk /dev/xvda: 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

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *           1        2550    20480000   83  Linux
/dev/xvda2            2550        2611      490496   82  Linux swap / Solaris

Disk /dev/xvdb: 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: 0x56f40944

    Device Boot      Start         End      Blocks   Id  System
/dev/xvdb2               1        2610    20964793+  83  Linux

實(shí)例 2

找出你系統(tǒng)中的根目錄所在磁盤,并查閱該硬盤內(nèi)的相關(guān)信息

[root@www ~]# df /            <==注意:重點(diǎn)在找出磁盤文件名而已
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/hdc2              9920624   3823168   5585388  41% /

[root@www ~]# fdisk /dev/hdc  <==仔細(xì)看,不要加上數(shù)字喔!
The number of cylinders for this disk is set to 5005.
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 后,就會(huì)看到底下這些命令介紹

Command (m for help): m   <== 輸入 m 后,就會(huì)看到底下這些命令介紹
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition            <==刪除一個(gè)partition
   l   list known partition types
   m   print this menu
   n   add a new partition           <==新增一個(gè)partition
   o   create a new empty DOS partition table
   p   print the partition table     <==在屏幕上顯示分割表
   q   quit without saving changes   <==不儲(chǔ)存離開fdisk程序
   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  <==將剛剛的動(dòng)作寫入分割表
   x   extra functionality (experts only)

離開 fdisk 時(shí)按下 q,那么所有的動(dòng)作都不會(huì)生效!相反的, 按下w就是動(dòng)作生效的意思。

Command (m for help): p  <== 這里可以輸出目前磁盤的狀態(tài)

Disk /dev/hdc: 41.1 GB, 41174138880 bytes        <==這個(gè)磁盤的文件名與容量
255 heads, 63 sectors/track, 5005 cylinders      <==磁頭、扇區(qū)與磁柱大小
Units = cylinders of 16065 * 512 = 8225280 bytes <==每個(gè)磁柱的大小

   Device Boot      Start         End      Blocks   Id  System
/dev/hdc1   *           1          13      104391   83  Linux
/dev/hdc2              14        1288    10241437+  83  Linux
/dev/hdc3            1289        1925     5116702+  83  Linux
/dev/hdc4            1926        5005    24740100    5  Extended
/dev/hdc5            1926        2052     1020096   82  Linux swap / Solaris
# 裝置文件名 啟動(dòng)區(qū)否 開始磁柱    結(jié)束磁柱  1K大小容量 磁盤分區(qū)槽內(nèi)的系統(tǒng)

Command (m for help): q

想要不儲(chǔ)存離開嗎?按下 q 就對(duì)了!不要隨便按 w 啊!

使用 p 可以列出目前這顆磁盤的分割表信息,這個(gè)信息的上半部在顯示整體磁盤的狀態(tài)。

本文糾錯(cuò)】【告訴好友】【打印此文】【返回頂部
將考試網(wǎng)添加到收藏夾 | 每次上網(wǎng)自動(dòng)訪問(wèn)考試網(wǎng) | 復(fù)制本頁(yè)地址,傳給QQ/MSN上的好友 | 申請(qǐng)鏈接 | 意見(jiàn)留言 TOP
關(guān)于本站  網(wǎng)站聲明  廣告服務(wù)  聯(lián)系方式  站內(nèi)導(dǎo)航  考試論壇
Copyright © 2007-2013 中華考試網(wǎng)(Examw.com) All Rights Reserved
龙州县| 澎湖县| 道孚县| 屏东市| 鄂托克旗| 盱眙县| 满城县| 屯门区| 武夷山市| 金寨县| 平山县| 安康市| 四会市| 灵寿县| 百色市| 扎赉特旗| 黎川县| 东源县| 台安县| 年辖:市辖区| 那曲县| 会宁县| 辉南县| 长乐市| 云浮市| 贵阳市| 梓潼县| 会东县| 酒泉市| 准格尔旗| 保康县| 张家界市| 平潭县| 河南省| 呼玛县| 新民市| 鄄城县| 蕉岭县| 会理县| 宜兴市| 中阳县|