You can scan a newly added SCSI disk in Linux without rebooting the system. The process is shown below:
First, check all disks presently shown on the system by using the below command:
[root@server ~]# fdisk -l |egrep '^Disk' |egrep -v 'dm-'
WARNING: GPT (GUID Partition Table) detected on ‘/dev/sdd’! The util fdisk doesn’t support GPT. Use GNU Parted.
WARNING: The size of this disk is 3.3 TB (3298534883328 bytes).
DOS partition table format can not be used on drives for volumes
larger than 2.2 TB (2199023255040 bytes). Use parted(1) and GUID
partition table format (GPT).
Disk /dev/sda: 214.7 GB, 214748364800 bytes
Disk /dev/sdb: 53.6 GB, 53687091200 bytes
Disk /dev/sdc: 1099.5 GB, 1099511627776 bytes
Disk /dev/sdd: 3298.5 GB, 3298534883328 bytes
It is showing the four disks.
Now check the SCSI host by the following command:
[root@server ~]# ls /sys/class/scsi_host host0
Now scan the newly added SCSI disk for host0 using the command echo ‘- – -‘ > /sys/class/scsi_host/host0/scan
[root@server ~]# echo '- - -' > /sys/class/scsi_host/host0/scan
Again run the command fdisk -l |egrep ‘^Disk’ |egrep -v ‘dm-‘ to see the disks.
[root@server ~]# fdisk -l |egrep '^Disk' |egrep -v 'dm-'
WARNING: GPT (GUID Partition Table) detected on '/dev/sdd'! The util fdisk doesn't support GPT. Use GNU Parted.
WARNING: The size of this disk is 3.3 TB (3298534883328 bytes).
DOS partition table format can not be used on drives for volumes
larger than 2.2 TB (2199023255040 bytes). Use parted(1) and GUID
partition table format (GPT).
Disk /dev/sde doesn't contain a valid partition table
Disk /dev/sda: 214.7 GB, 214748364800 bytes
Disk /dev/sdb: 53.6 GB, 53687091200 bytes
Disk /dev/sdc: 1099.5 GB, 1099511627776 bytes
Disk /dev/sdd: 3298.5 GB, 3298534883328 bytes
Disk /dev/sde: 2199.0 GB, 2199023255552 bytes (New Disk)
Now you can see the newly added disk (Disk /dev/sde: 2199.0 GB, 2199023255552 bytes) in the list. Make the partition for this disk and format the disk.
How Do I Delete a Single Device Called /dev/sdc
[root@server ~]# fdisk -l |egrep '^Disk' |egrep -v 'dm-' WARNING: GPT (GUID Partition Table) detected on '/dev/loop0'! The util fdisk doesn't support GPT. Use GNU Parted. Disk /dev/loop0: 3878 MB, 3878682624 bytes Disk identifier: 0x50be8ac6 Disk /dev/sda: 1798.7 GB, 1798651772928 bytes Disk identifier: 0x5706085e Disk /dev/sdb: 2199.0 GB, 2199023255552 bytes Disk identifier: 0x00000000 Disk /dev/sdc: 2199.0 GB, 2199023255552 bytes Disk identifier: 0x00000000
[root@server ~]# echo 1 > /sys/block/sdc/device/delete
[root@server ~]# fdisk -l |egrep '^Disk' |egrep -v 'dm-' WARNING: GPT (GUID Partition Table) detected on '/dev/loop0'! The util fdisk doesn't support GPT. Use GNU Parted. Disk /dev/loop0: 3878 MB, 3878682624 bytes Disk identifier: 0x50be8ac6 Disk /dev/sda: 1798.7 GB, 1798651772928 bytes Disk identifier: 0x5706085e Disk /dev/sdb: 2199.0 GB, 2199023255552 bytes Disk identifier: 0x00000000 [root@server ~]#