扩展SCSI数据盘的分区和文件系统(Linux) fdisk /dev/sda Welcome to fdisk (utillinux 2.23.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): 步骤4 输入“n”,按“Enter”,开始新建分区。 回显类似如下信息: plaintext Command (m for help): n Partition type: p primary (1 primary, 0 extended, 3 free) e extended Select (default p): 表示磁盘有两种分区类型: “p”表示主分区。 “e”表示扩展分区。 说明 磁盘使用MBR分区形式,最多可以创建4个主分区,或者3个主分区加1个扩展分区,扩展分区不可以直接使用,需要划分成若干个逻辑分区才可以使用。 磁盘使用GPT分区形式时,没有主分区、扩展分区以及逻辑分区之分。 步骤5 以创建一个主分区为例,输入“p”,按“Enter”。 回显类似如下信息: plaintext Select (default p): p Partition number (24, default 2): “Partition number”表示主分区编号,可以选择24,由于1已被使用,此处从2开始。 步骤6 以分区编号选择“2”为例,输入分区编号“2”,按“Enter”。 回显类似如下信息: plaintext Partition number (24, default 2): 2 First sector (104857600209715199, default 104857600): “First sector”表示起始磁柱值,可以选择104857600209715199,默认为104857600。 步骤7 输入新分区的起始磁柱值,以使用默认起始磁柱值为例,按“Enter”。 系统会自动提示分区可用空间的起始磁柱值和截止磁柱值,可以在该区间内自定义,或者使用默认值。起始磁柱值必须小于分区的截止磁柱值。 回显类似如下信息: plaintext First sector (104857600209715199, default 104857600): Using default value 104857600 Last sector, +sectors or +size{K,M,G} (104857600209715199, default 209715199): “Last sector”表示截止磁柱值,可以选择104857600209715199,默认为209715199。 步骤8 输入新分区的截止磁柱值,以使用默认截止磁柱值为例,按“Enter”。 系统会自动提示分区可用空间的起始磁柱值和截止磁柱值,可以在该区间内自定义,或者使用默认值。起始磁柱值必须小于分区的截止磁柱值。 回显类似如下信息: plaintext Last sector, +sectors or +size{K,M,G} (104857600209715199, default 209715199): Using default value 209715199 Partition 2 of type Linux and of size 50 GiB is set Command (m for help): 步骤9 输入“p”,按“Enter”,查看新建分区。 回显类似如下信息: plaintext Command (m for help): p Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 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 label type: dos Disk identifier: 0x915ffe6a Device Boot Start End Blocks Id System /dev/sda1 2048 104857599 52427776 83 Linux /dev/sda2 104857600 209715199 52428800 83 Linux Command (m for help): 步骤10 输入“w”,按“Enter”,将分区结果写入分区表中。 回显类似如下信息: plaintext Command (m for help): w The partition table has been altered! Calling ioctl() to reread partition table. WARNING: Rereading the partition table failed with error 16: Device or resource busy. The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks. 说明 如果之前分区操作有误,请输入“q”,则会退出fdisk分区工具,之前的分区结果将不会被保留。 步骤11 执行以下命令,将新的分区表变更同步至操作系统。 partprobe 步骤12 执行以下命令,为新建分区设置文件系统。 mkfs t 文件系统 磁盘分区 ext文件系统命令示例: mkfs t ext4 /dev/sda2 回显类似如下信息: plaintext [root@ecsscsi ~]