1 查看硬盘
fdisk -l
2.给硬盘分区
fdisk /dev/sdb
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): 1
First sector (2048-3907029167, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-3907029167, default 3907029167):
Using default value 3907029167
Partition 1 of type Linux and of size 1.8 TiB is set
Command (m for help): w
The partition table has been altered!
3.格式化硬盘
ext4 文件格式
mkfs -t ext4 /dev/sdb1
4.挂载硬盘
mkdir /data
mount /dev/sdb1 /data
5.重启后让挂载生效
编辑/etc/fstab 文件
ext4
/dev/sdb1 /data ext4 defaults 0 0
转载请注明:创富者 » linux 系统新增硬盘命令操作