1、添加新硬盘
2、系统检测新硬盘
echo "- - -" > /sys/class/scsi_host/host0/scan
注意:三个"- - -"号之间有空格。执行完这条命令后,查看系统日志/var/log/messages,发现对SCSI设备进行了一次重新扫描。
OK,至此我们已经顺利新增了一块磁盘,那么接下来可以进行fdisk分区,mkfs格式化等操作了。
也可以直接把整块盘不分区格式化后直接使用。
3、查看系统日志/var/log/messages
tail -f /var/log/messages
Apr 1 03:41:38 localhost kernel: scsi target0:0:2: Beginning Domain Validation
Apr 1 03:41:38 localhost kernel: scsi target0:0:2: Domain Validation skipping write tests
Apr 1 03:41:38 localhost kernel: scsi target0:0:2: Ending Domain Validation
Apr 1 03:41:38 localhost kernel: scsi target0:0:2: FAST-40 WIDE SCSI 80.0 MB/s ST (25 ns, offset 127)
Apr 1 03:41:38 localhost kernel: sd 0:0:2:0: [sdc] 2147483648 512-byte logical blocks: (1.09 TB/1.00 TiB)
Apr 1 03:41:38 localhost kernel: sd 0:0:2:0: [sdc] Write Protect is off
Apr 1 03:41:38 localhost kernel: sd 0:0:2:0: [sdc] Cache data unavailable
Apr 1 03:41:38 localhost kernel: sd 0:0:2:0: [sdc] Assuming drive cache: write through
Apr 1 03:41:38 localhost kernel: sd 0:0:2:0: Attached scsi generic sg3 type 0
Apr 1 03:41:38 localhost kernel: sd 0:0:2:0: [sdc] Attached SCSI disk
4、查看新添加的硬盘
ls /dev/sd*
fdisk -l
5、不分区格式化后直接使用
mkfs.ext4 /dev/sdc
6、挂载新硬盘到指定目录
mount /dev/sdc /data2
7、修改配置文件,系统重启后自动挂载。
vim /etc/fstab
# 追加新挂载信息
/dev/sdc /data2 auto nosuid,nodev,nofail,x-gvfs-show 0 0