2024年10月Linux利用fdisk工具建立分区的方法

发布时间:

  ⑴当Linux系统硬盘还有不少空间的时候,我们能够使用fdisk工具对系统进行分区,以满足个人需求,那么fdisk工具要如何使用呢?下面小编就给大家介绍下Linux使用fdisk建立分区的方法,感兴趣的朋友可以来了解下。

  ⑵首先查看硬盘信息

  ⑶fdisk -l 如果有硬盘有剩余空间就可以对其进行分区

  ⑷[rootbogon 桌面]# fdisk -l

  ⑸Disk /dev/sda: . GB, bytes

  ⑹ heads, sectors/track, cylinders

  ⑺Units = cylinders of * = bytes

  ⑻Sector size (logical/physical: bytes / bytes

  ⑼I/O size (minimum/optimal: bytes / bytes

  ⑽Disk identifier: xad

  ⑾Device Boot Start End Blocks Id System

  ⑿/dev/sda * Linux

  ⒀Partition does not end on cylinder boundary.

  ⒁/dev/sda Linux

  ⒂/dev/sda Linux swap / Solaris

  ⒃/dev/sda Extended

  ⒄/dev/sda Linux

  ⒅Disk /dev/sdb: . GB, bytes

  ⒆ heads, sectors/track, cylinders

  ⒇Units = cylinders of * = bytes

  ⒈Sector size (logical/physical: bytes / bytes

  ⒉I/O size (minimum/optimal: bytes / bytes

  ⒊Disk identifier: x

  ⒋#从上面看出/dev/sda空间已经用完了,/dev/sdb没有使用。

  ⒌下面我们对/dev/sdb 进行分区

  ⒍[rootbogon 桌面]# fdisk /dev/sdb

  ⒎Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

  ⒏Building a new DOS disklabel with disk identifier xfaaaa.

  ⒐Changes will remain in memory only, until you decide to write them.

  ⒑After that, of course, the previous content won‘t be recoverable.

  ⒒Warning: invalid flag x of partition table will be corrected by w(rite

  ⒓WARNING: DOS-patible mode is deprecated. It’s strongly remended to

  ⒔switch off the mode (mand ‘c’ and change display units to

  ⒕sectors (mand ‘u’。

  ⒖mand (m for help: m

  ⒗mand action

  ⒘a toggle a bootable flag

  ⒙b edit bsd disklabel

  ⒚c toggle the dos patibility 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