How to reset and detect plug-in HDD/SSD via IDE or SATA without rebooting?

Finally, I found out how to reset/detect plug-in HDD/SSD via IDE or SATA without rebooting.

1. What command can I type to detect HDD/SSD via IDE and SATA?

First install scsi tools:

sudo apt-get install scsitools

Then, you can type to detect plug-in via IDE and SATA:

sudo rescan-scsi-bus

2. What command can I type to remove plug-in with HDD/SSD via IDE or SATA?

BE CAREFUL! DO NOT REMOVE THE DISK THAT THERE IS AN UBUNTU OS RUNNING ON YOUR COMPUTER

To unmount and delete disks from Ubuntu's software, to type to get permission:

sudo -i

Then, you can type to unmount and delete disk:

echo 1 > /sys/class/scsi_device/h:c:t:l/device/delete

The code h:c:t:l is the bus' number via IDE or SATA to remove disk, to check the bus' number, you can type:

lsscsi -s

To make sure if the Hard Disk can be safely unplugged physically, you can type this same code to check that the disk does not display on the screen.

3. What the best way can I change HDD/SSD physically via IDE or SATA without any problem?

First, you have to type the command to remove the disk. Then, you have to type the command to check to make sure that the disk does not display on the system's software and you can change the disks physically being safely to unplug and plug. Finally, you can type the command to detect plug-in via IDE and SATA and to check the disks detected.