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

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不要随便输入

评论(1)

    • 576786031@qq.com
      -c 以柱面显示
      [root@server7 ~]# fdisk -cl /dev/vdb

      Disk /dev/vdb: 8589 MB, 8589934592 bytes
      16 heads, 63 sectors/track, 16644 cylinders
      Units = cylinders of 1008 * 512 = 516096 bytes
      Sector size (logical/physical): 512 bytes / 512 bytes
      I/O size (minimum/optimal): 512 bytes / 512 bytes
      Disk identifier: 0xce720981

      Device Boot Start End Blocks Id System
      /dev/vdb1 3 206 102400 83 Linux
      /dev/vdb2 206 409 102400 83 Linux
      /dev/vdb3 409 612 102400 83 Linux
      [root@server7 ~]# fdisk -ul /dev/vdb

      Disk /dev/vdb: 8589 MB, 8589934592 bytes
      16 heads, 63 sectors/track, 16644 cylinders, total 16777216 sectors
      Units = sectors of 1 * 512 = 512 bytes
      Sector size (logical/physical): 512 bytes / 512 bytes
      I/O size (minimum/optimal): 512 bytes / 512 bytes
      Disk identifier: 0xce720981

      Device Boot Start End Blocks Id System
      /dev/vdb1 2048 206847 102400 83 Linux
      Partition 1 does not end on cylinder boundary.
      /dev/vdb2 206848 411647 102400 83 Linux
      Partition 2 does not end on cylinder boundary.
      /dev/vdb3 411648 616447 102400 83 Linux
      Partition 3 does not end on cylinder boundary.
      [回复]

评论

名字:
验证码:
获取验证码
内容: