fdisk命令详解

#######################################################################

#######################################################################

NAME

       fdisk - Partition table manipulator for Linux


SYNOPSIS

       fdisk  [-uc]  [-b  sectorsize]  [-C  cyls] [-H heads] [-S sects]

       device


       fdisk -l [-u] [device...] 列出指定的外围设备的分区表状况。

       [root@nginx ~]# fdisk -l


       Disk /dev/sda: 10.7 GB, 10737418240 bytes

       255 heads, 63 sectors/track, 1305 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: 0x000a87b0


       Device Boot      Start         End      Blocks   Id  System

       /dev/sda1   *           1          64      512000   83  Linux

       Partition 1 does not end on cylinder boundary.

       /dev/sda2              64         141      614400   82  Linux swap / Solaris

       Partition 2 does not end on cylinder boundary.

       /dev/sda3             141        1306     9358336   83  Linux

       [root@nginx ~]# 

       

  fdisk -s partition...  <分区编号> 将指定的分区大小输出到标准输出上,单位为区块。


       fdisk -v   显示版本信息。


       fdisk -h



一、分区要点

    (1)任意多个主分区,但要求(1<=主分区<=小于等于4。 例如,4个主分区,3个主分区 2个主分区 或一个主分区)

(2)扩展分区和主分区,  3个主分区+一个扩展分区   1<=主分区<=小于等于4  例如:3个主分区+1个扩展分区  或两个主分区+1个扩展分区 1个主+1个扩展分区 


(3)如果磁盘分成4个磁盘分区,那么一般会用: P+P+P+P  P+P+P+E


二、[root@nginx-master opt]# fdisk --help  查看分区帮助

    [root@nginx-master opt]# fdisk -l      查看分区列表

1.[root@nginx-master opt]# fdisk /dev/sda


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

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): 

    2. n   新建分区 

     e  extended

 p  primary partition(1-4)

    3.w   分区完成后w保存

4.[root@nginx-master opt]# partprobe 

5.[root@nginx-master opt]# mkfs.ext4 /dev/sda

    4.写入 fs /etc/fstab


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章