[root@demo ~]# fdisk /dev/sdb
The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.
Welcome to fdisk(util-linux 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):
查看现有分区
Command (m for help): p
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0xdff524f7
Device Boot Start End Blocks Id System
/dev/sdb1 2048 3907583 1952768 83 Linux
删除分区
Command (m for help): d
Selected partition 1
Partition 1 is deleted
重新创建分区 – 确保分区开始同删除前
Command (m for help): n # 创建新分区
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p # 创建主分区
Partition number (1-4, default 1):
First sector (2048-20971519, default 2048): 2048
Last sector, +sectors or +size{K,M,G}(2048-20971519, default 20971519):
Using default value 20971519
Partition 1 of type Linux and of size 10 GiB is set
Command (m for help): p # 查看现有分区
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: dos
Disk identifier: 0xdff524f7
Device Boot Start End Blocks Id System
/dev/sdb1 2048 20971519 10484736 83 Linux
Command (m for help): w # 保存退出
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@demo ~]# resize2fs /dev/sdb1
resize2fs 1.42.9 (28-Dec-2013)
Resizing the filesystem on /dev/sdb1 to 2621184 (4k) blocks.
The filesystem on /dev/sdb1 is now 2621184 blocks long