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


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