[root@localhost ~]# fdisk /dev/sda
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): m
Command action
a toggle a bootable flag #设置启动的扇区
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition #删除一个分区
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu #fdisk帮助信息
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): n #增加一个主分区
Partition type:
p primary (3 primary, 0 extended, 1 free) #已有3个主区,只有一个free
e extended
Select (default e): p #主分区
Selected partition 4 #主分区号
First sector (49891328-83886079, default 49891328): #增加分区的开始扇面,选择默认
Using default value 49891328
Last sector, +sectors or +size{K,M,G} (49891328-83886079, default 83886079): +3G #新建分区的大小3G,默认的情况下使用全部可用空间
Partition 4 of type Linux and of size 3 GiB is set
Command (m for help): p #打印下分区情况
Disk /dev/sda: 42.9 GB, 42949672960 bytes, 83886080 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: 0x0005926e
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1640447 819200 83 Linux
/dev/sda2 1640448 47794175 23076864 8e Linux LVM
/dev/sda3 47794176 49891327 1048576 83 Linux
/dev/sda4 49891328 56182783 3145728 83 Linux
Command (m for help): w #保存退出
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading 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. #提示使用partprobe(8) or kpartx(8) 重新读取分区