Welcome to fdisk (util-linux 2.32.1). Changes will remain in memory only, until you decide to write them. Be careful before using the write command.
Device does not contain a recognized partition table. Created a new DOS disklabel with disk identifier 0xb69b5e04.
# 输入m,查看帮助信息 Command (m forhelp): m
新建分区
1 2 3 4 5 6 7 8 9 10 11
# 新建分区:new Command (m forhelp): new Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) Select (default p): p #主分区 Partition number (1-4, default 1): 1 #第一个分区 First sector (2048-10485759, default 2048): 2048 # 起始扇区 Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519): # 或+nG Using default value 20971519 Partition 1 of type Linux and of size 10 GiB is set
Last sector nG前需要+号
打印分区结果
1 2 3 4 5 6 7 8 9 10 11
Command (m forhelp): p
Disk /dev/sdb: 10.7 GB, 10737418240 bytes, 20971520 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: 0xcbf87d11
Device Boot Start End Blocks Id System /dev/sdb1 2048 20971519 10484736 83 Linux
保存分区结果
1 2 3 4 5
Command (m forhelp): w The partition table has been altered!
Calling ioctl() to re-read partition table. Syncing disks.
格式化文件系统
mkfs - build a Linux filesystem
1 2 3 4 5 6 7 8 9 10
# 格式化为 ext3 [root@localhost ~]# mkfs -t ext3 /dev/sdb1 mke2fs 1.42.9 (28-Dec-2013) Filesystem label= OS type: Linux ... Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done