[root@localhost ~]# fdisk -l //查看分区
Disk /dev/sda:10.7GB,10737418240 bytes,20971520 sectors
Units = sectors of1*512=512 bytes
Sector size(logical/physical):512 bytes /512 bytes
I/Osize(minimum/optimal):512 bytes /512 bytes
Disk label type: dos
Disk identifier:0x00013f3e
Device Boot Start End Blocks Id System
/dev/sda1 *20482097033210484142+83 Linux
Disk /dev/sdb:10.7GB,10737418240 bytes,20971520 sectors
Units = sectors of1*512=512 bytes
Sector size(logical/physical):512 bytes /512 bytes
I/Osize(minimum/optimal):512 bytes /512 bytes
[root@localhost ~]# fdisk /dev/sdb //分区sdb
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.
Device does not contain a recognized partition table
Building a newDOS disklabel with disk identifier 0x07931636.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 newemptyGPT partition table
G create an IRIX(SGI) partition table
l list known partition types
m print this menu
n add a newpartition//新建一个分区
o create a newemptyDOS partition table
p print the partition table
q quit without saving changes //退出分区,不保存
s create a newempty 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(0 primary,0 extended,4 free)//主分区 、默认
e extended //逻辑分区Select(default p): p
Partition number(1-4,default1):1//第一个主分区
First sector(2048-20971519,default2048)://第一分区、默认2048
Using default value 2048
Last sector,+sectors or +size{K,M,G}(2048-20971519,default20971519):10971519//分区大小
Partition 1of type Linux and of size 5.2 GiB is setCommand(m for help): n
Partition type:
p primary(1 primary,0 extended,3 free)
e extended
Select(default p): p
Partition number(2-4,default2):2
First sector(10971520-20971519,default10973184):
Using default value 10973184
Last sector,+sectors or +size{K,M,G}(10973184-20971519,default20971519):
Using default value 20971519
Partition 2of type Linux and of size 4.8 GiB is setCommand(m for help): w //保存并退出
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.[root@localhost ~]# fdisk -l
Disk /dev/sda:10.7GB,10737418240 bytes,20971520 sectors
Units = sectors of1*512=512 bytes
Sector size(logical/physical):512 bytes /512 bytes
I/Osize(minimum/optimal):512 bytes /512 bytes
Disk label type: dos
Disk identifier:0x00013f3e
Device Boot Start End Blocks Id System
/dev/sda1 *20482097033210484142+83 Linux
Disk /dev/sdb:10.7GB,10737418240 bytes,20971520 sectors
Units = sectors of1*512=512 bytes
Sector size(logical/physical):512 bytes /512 bytes
I/Osize(minimum/optimal):512 bytes /512 bytes
Disk label type: dos
Disk identifier:0x07931636
Device Boot Start End Blocks Id System
/dev/sdb1 204810971519548473683 Linux
/dev/sdb2 1097318420971519499916883 Linux
[root@localhost ~]# mkfs -t ext4 /dev/sdb1 //制定类型 ext4 sdb1
mke2fs 1.42.9(28-Dec-2013)
Filesystem label=OS type: Linux
Block size=4096(log=2)
Fragment size=4096(log=2)
Stride=0 blocks, Stripe width=0 blocks
343392 inodes,1371184 blocks
68559blocks(5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=140509184042 block groups
32768 blocks per group,32768 fragments per group
8176 inodes per group
Superblock backups stored on blocks:32768,98304,163840,229376,294912,819200,884736
Allocating group tables: done
Writing inode tables: done
Creating journal(32768 blocks): done
Writing superblocks and filesystem accounting information: done
[root@localhost ~]# mkfs -t ext4 /dev/sdb2
mke2fs 1.42.9(28-Dec-2013)
Filesystem label=OS type: Linux
Block size=4096(log=2)
Fragment size=4096(log=2)
Stride=0 blocks, Stripe width=0 blocks
312624 inodes,1249792 blocks
62489blocks(5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=128135987239 block groups
32768 blocks per group,32768 fragments per group
8016 inodes per group
Superblock backups stored on blocks:32768,98304,163840,229376,294912,819200,884736
Allocating group tables: done
Writing inode tables: done
Creating journal(32768 blocks): done
Writing superblocks and filesystem accounting information: done
[root@localhost ~]# mkdir /home/newfile
[root@localhost ~]# mount
mount mount.fuse mount.nfs mount.nfs4 mountpoint mountstats
[root@localhost ~]# mount /dev/sdb1 /home/newfile/[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 10G 3.1G 7.0G 31%/
devtmpfs 475M 0475M 0%/dev
tmpfs 490M 80K 490M 1%/dev/shm
tmpfs 490M 14M 477M 3%/run
tmpfs 490M 0490M 0%/sys/fs/cgroup
/dev/sdb1 5.1G 21M 4.8G 1%/home/newfile