首先,对/dev/sdb进行分区:
[[email protected] /]#fdisk /dev/sdb #进入该设备
Command (m for help): p #查看分区
/dev/sdb1 1 500 4016218+ 83 Linux
/dev/sdb2 501 1000 4016250 83 Linux
/dev/sdb3 1001 1305 2449912+ 5 Extend
Command (m for help): d #删除分区
Partition number (1-4): 1 #依次删除三个分区,重新分区
Command (m for help): n #新建分区
Command action
e extended #表示扩展分区
p primary partition (1-4) #表示主分区
输入:p
Partition number (1-4): 1 #设置一个主分区
First cylinder (1-1305, default 1): 回车
Last cylinder or +size or +sizeM or +sizeK (1-1305, default 1305): 回车
Partition number (1-4): 1
First cylinder (1-1305, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1305, default 1305):
Using default value 1305
Command (m for help): p
Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 1305 10482381 83 Linux
Command (m for help): w #保存分区,别忘记哦
[[email protected] /]# yum install e4fsprogs #安装 ext4 的用户态工具;
[[email protected] /]#mkfs.ext4 -E lazy_itable_init=1 /dev/sdb1 #将 sdb1分区格式化为 ext4 文件系统;
[[email protected] /]#mkdir /web #创建目录;
[[email protected] /]#echo “/dev/sdb1 /web ext4 defaults,noatime,nodiratime 0 0 ” >> /etc/fstab #修改系统配置文件;
[[email protected] /]#mount -a #挂载磁盘 ;
[[email protected] /]# df -lh #查看磁盘信息
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 13G 2.1G 11G 17% /
tmpfs 513M 0 513M 0% /dev/shm
/dev/sdb1 9.9G 151M 9.2G 2% /web