linux 添加硬盘如何不重启
1. 添加了磁盘后查看,没有刷新出来
[root@node /]# fdisk -l
Disk /dev/sda: 17.2 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000aa84a
Device Boot Start End Blocks Id System
/dev/sda1 * 1 2089 16775168 83 Linux
/dev/sda2 2089 2089 1024 82 Linux swap / Solaris
2. 查看主机总线号
root@node /]# ls /sys/class/scsi_host/
host0 host1 host2
3.重新扫描SCSI总线来添加设备
[root@node /]# echo "- - -" > /sys/class/scsi_host/host0/scan
[root@node /]# echo "- - -" > /sys/class/scsi_host/host1/scan
[root@node /]# echo "- - -" > /sys/class/scsi_host/host2/scan
4. 查看磁盘,可以看到 /dev/sdb :53.7G 这个就是新加的盘
[root@node /]# fdisk -l
Disk /dev/sda: 17.2 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000aa84a
Device Boot Start End Blocks Id System
/dev/sda1 * 1 2089 16775168 83 Linux
/dev/sda2 2089 2089 1024 82 Linux swap / Solaris
Disk /dev/sdb: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
接下来
fdisk /dev/sd*
n
p
1
回车
回车
w保存
mkfs.ext4 /dev/sdc1 建立EXT4文件系统
mount /dev/sdc1 /data_bak 挂载
vim /etc/fstab
/dev/sdc1 /data_bak ext4 defaults 0 0
X保存
mount -a 刷新fstab里的配置,查看配置文件收否写错。