• Linux fdisk创建主分区过程详解

    本节我们实际建立一个主分区,看看过程是什么样子的。命令如下:

    [root@localhost ~]# fdisk /dev/sdb
    …省略部分输出…
    Command (m for help): p
    #显示当前硬盘的分区列表
    Disk /dev/sdb: 21.5 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 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: 0xb4b0720c
    Device Boot Start End Blocks id System
    #目前一个分区都没有
    Command (m for help): n
    #那么我们新建一个分区
    Command action
    #指定分区类型
    e extended
    #扩展分区
    p primary partition (1-4)
    #主分区
    p
    #这里选择p,建立一个主分区
    Partition number (1-4): 1
    #选择分区号,范围为1~4,这里选择1
    First cylinder (1 -2610, default 1):
    #分区的起始柱面,默认从1开始。因为要从硬盘头开始分区,所以直接回车
    Using default value 1
    #提示使用的是默认值1
    Last cylinder, +cylinders or +size{K, M, G}(1-2610, default 2610): +5G
    #指定硬盘大小。可以按照柱面指定(1-2610)。我们对柱面不熟悉,那么可以使用size{K, M, G}的方式指定硬盘大小。这里指定+5G,建立一个5GB大小的分区
    Command (m for help):
    #主分区就建立了,又回到了fdisk交互界面的提示符
    Command (m for help): p
    #查询一下新建立的分区
    Disk /dev/sdb: 21.5GB, 21474836480 bytes
    255 heads,63 sectors/track, 2610 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes 1512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0xb4b0720c
    Device Boot Start End Blocks id System
    /dev/sdb1 1 654 5253223+ 83 Linux
    #dev/sdb1已经建立了吧

    总结,建立主分区的过程就是这样的:"fdisk 硬盘名 -> n(新建)->p(建立主分区) -> 1(指定分区号) -> 回车(默认从 1 柱面开始建立分区)-> +5G(指定分区大小)"。当然,我们的分区还没有格式化和挂载,所以还不能使用。

更多...

加载中...