fdisk 磁盘分区命令

fdisk

fdisk磁盘分区命令

-v
    打印 fdisk 的版本信息并退出.
-l
    列出指定设备的分区表信息并退出。 如果没有给出设备,那么使用那些在 /proc/partitions (如果存在)提到的.
-u
    以扇区数而不是以柱面数的形式显示分区表中各分区的信息. -s 分区 将分区的 大小 (单位为块)信息输出到标准输出

---------------------------------------------------------------------------------------------------------------------------------------------------------------------

例a,查看所有分区

[root@localhost ~]# fdisk -l      

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          17      136552   83  Linux
/dev/sda2              18         279     2104515   82  Linux swap / Solaris
/dev/sda3             280       60801   486142965    5  Extended
/dev/sda5             280       60801   486142964+  83  Linux

例b,fdisk分区

[root@localhost ~]# fdisk /dev/hdc    #分区时,不要加上数字
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        #可以查看帮助

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  #改变分区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): p  

Disk /dev/hdc: 41.1 GB, 41174138880 bytes        #磁盘名称和大小
255 heads, 63 sectors/track, 5005 cylinders      #磁头、磁区与磁柱数量,多少
Units = cylinders of 16065 * 512 = 8225280 bytes #每个磁柱的大小

   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

Command (m for help): q   # q是不保存退出,w不要随便输入

 

--------------------------------------------------------------------

开源是一种精神,分享是 一种美德。

 

posted @ 2018-12-28 10:50  香菜哥哥  阅读(859)  评论(0编辑  收藏  举报