• How to detect a new hard disk attached without rebooting Ubuntu Server?

If you need to detect a new hard disk added to your server wihout performing a reboot here is the command:

# for host in /sys/class/scsi_host/*; do echo "- - -" | sudo tee $host/scan; ls /dev/sd* ; done

The expected output should look like this:

$for host in /sys/class/scsi_host/; do echo "- - -" | sudo tee $host/scan; ls /dev/sd ; done
/dev/sda /dev/sda1 /dev/sda2 /dev/sda5 /dev/sdb /dev/sdb1
/dev/sda /dev/sda1 /dev/sda2 /dev/sda5 /dev/sdb /dev/sdb1
/dev/sda /dev/sda1 /dev/sda2 /dev/sda5 /dev/sdb /dev/sdb1 /dev/sdc

As we can see from the last line a new device /dev/sdc was detected.


This article was last modified: Dec. 9, 2021, 11:05 a.m.

0 Comments

Please log in to leave a comment.

Add or change tags.

A comma-separated list of tags.

Share

Hacker News

Top