Saturday, March 26, 2016

How to scan a new disk in Linux without rebooting?

[root@server-01 ~]# fdisk -l
Disk /dev/sda: 26.8 GB, 26843545600 bytes
255 heads, 63 sectors/track, 3263 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104390+  83  Linux
/dev/sda2              14        3263    26105623+  8e  Linux LVM


[root@server-01 ~]# ls -lh /sys/class/scsi_host/host0/scan
--w------- 1 root root 4.0K Jun  6 19:13 /sys/class/scsi_host/host0/scan

[root@server-01 ~]# echo "- - -" > /sys/class/scsi_host/host0/scan

[root@server-01 ~]# fdisk -l
Disk /dev/sda: 26.8 GB, 26843545600 bytes
255 heads, 63 sectors/track, 3263 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104390+  83  Linux
/dev/sda2              14        3263    26105623+  8e  Linux LVM

Disk /dev/sdb: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table

[root@server-01 ~]# tail -30 /var/log/messages
Jun  2 04:02:04 server-01 syslogd 1.4.1: restart.
Jun  6 19:13:30 server-01 kernel:   Vendor: VMware    Model: Virtual disk      Rev: 1.0
Jun  6 19:13:30 server-01 kernel:   Type:   Direct-Access                      ANSI SCSI revision: 02
Jun  6 19:13:30 server-01 kernel:  target0:0:1: Beginning Domain Validation
Jun  6 19:13:30 server-01 kernel:  target0:0:1: Domain Validation skipping write tests
Jun  6 19:13:30 server-01 kernel:  target0:0:1: Ending Domain Validation
Jun  6 19:13:30 server-01 kernel:  target0:0:1: FAST-40 WIDE SCSI 80.0 MB/s ST (25 ns, offset 127)
Jun  6 19:13:30 server-01 kernel: SCSI device sdb: 209715200 512-byte hdwr sectors (107374 MB)
Jun  6 19:13:30 server-01 kernel: sdb: Write Protect is off
Jun  6 19:13:30 server-01 kernel: sdb: cache data unavailable
Jun  6 19:13:30 server-01 kernel: sdb: assuming drive cache: write through
Jun  6 19:13:30 server-01 kernel: SCSI device sdb: 209715200 512-byte hdwr sectors (107374 MB)
Jun  6 19:13:30 server-01 kernel: sdb: Write Protect is off
Jun  6 19:13:30 server-01 kernel: sdb: cache data unavailable
Jun  6 19:13:30 server-01 kernel: sdb: assuming drive cache: write through
Jun  6 19:13:30 server-01 kernel:  sdb: unknown partition table
Jun  6 19:13:30 server-01 kernel: sd 0:0:1:0: Attached scsi disk sdb
Jun  6 19:13:30 server-01 kernel: sd 0:0:1:0: Attached scsi generic sg1 type 0

No comments:

Post a Comment