For When You Can't Have The Real Thing
[ start | index | login ]
start > Ubuntu > 20 LTS > Scan For Newly Added Disk

Scan For Newly Added Disk

Created by dave. Last edited by dave, 42 days ago. Viewed 236 times. #3
[diff] [history] [edit] [rdf]
labels
attachments
(2023-09-05)

Problem

I've added a new disk to my Ubuntu 20 LTS VM and it isn't showing up without a reboot.

Solution

Find the SCSI host holding your disk:

root@radio2:~# ls  -l /sys/class/scsi_device/*/device/block
'/sys/class/scsi_device/32:0:0:0/device/block':
total 0
drwxr-xr-x 12 root root 0 Jan 11 12:44 sda

'/sys/class/scsi_device/32:0:1:0/device/block': total 0 drwxr-xr-x 10 root root 0 Jan 11 12:44 sdb

Force a rescan of the appropriate host:
root@radio2:~# echo "- - -" > /sys/class/scsi_host/host32/scan
Check to make sure the new disk got detected:
root@radio2:~# ls  -l /sys/class/scsi_device/*/device/block
'/sys/class/scsi_device/32:0:0:0/device/block':
total 0
drwxr-xr-x 12 root root 0 Jan 11 12:44 sda

'/sys/class/scsi_device/32:0:1:0/device/block': total 0 drwxr-xr-x 10 root root 0 Jan 11 12:44 sdb

'/sys/class/scsi_device/32:0:2:0/device/block': total 0 drwxr-xr-x 9 root root 0 Jan 11 13:10 sdc

Brute Force

Probe all SCSI hosts in the VM:

# echo "- - -" | tee /sys/class/scsi_host/host*/scan
# dmesg | grep sd

(>>Source)

no comments | post comment
This is a collection of techical information, much of it learned the hard way. Consider it a lab book or a /info directory. I doubt much of it will be of use to anyone else.

Useful:


snipsnap.org | Copyright 2000-2002 Matthias L. Jugel and Stephan J. Schmidt