2

So, I'm using my brand new HDD CADDY SATA III in CPU.

When I mount the HDD/SSD physically in the mounting bracket, I can click on "Scan for hardware changes" in "Device Manager" of Windows 7 to detect HDD/SSD. Now, how can I do like it in Ubuntu 18.04? I mean how can I detect HDD/SSD without rebooting Ubuntu?

I have three questions that I need to type in Ubuntu's terminal:

  1. What command can I type to detect HDD/SSD via IDE and SATA?
  2. What command can I type to remove plug-in with HDD/SSD via IDE or SATA?
  3. What the best way can I change HDD/SSD physically via IDE or SATA without any problem?
luisito_36
  • 322
  • 2
  • 5
  • 15
  • Please tell us the exact model. – danzel Jul 12 '18 at 21:13
  • No matter what the model is, it's about connecting and disconnecting the HDD/SSD from SATA manually and physically without rebooting. – luisito_36 Jul 13 '18 at 04:20
  • You should at least tell us which connections are involved. Looking at the manufacturer's website, the connection to the mainboard could be USB2, USB3, SATA, eSATA, SAS, IDE. The hard drive could be connected to the enclosure via SATA or IDE. If hot-plugging works depends on your mainboard and power supply. You should provide more information about your setup if you want an answer. – danzel Jul 13 '18 at 17:06
  • The hard drive is connected to the enclosure via SATA. But the problem is software, no hardware. Windows 7 is working fine, I can enable after I plugged the HDD/SSD and I can unplug the HDD/SSD after I disabled in software. Now, my question is: How can I do in Ubuntu? – luisito_36 Jul 13 '18 at 17:24
  • I'm using MSI G31M3L_V2 ( https://us.msi.com/Motherboard/G31M3L_V2__G31M3LS_V2/Specification ), I use only SATA, not IDE. But I'm looking for "Device Manager of Windows 7" in Ubuntu to click on "Scan for hardware changes" when I plug and unplug HDD/SSD in hardware without rebooting. – luisito_36 Jul 13 '18 at 18:10
  • Please don't or put SOLVED in the title. The green check sign ✅ is sufficient. – user68186 Sep 22 '20 at 15:22

1 Answers1

4

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.

luisito_36
  • 322
  • 2
  • 5
  • 15
  • 1
    To detect the disk you can also use `echo 1 > /sys/class/scsi_device/0:0:0:0/device/rescan` without having to install scsitools. (Replace 0:0:0:0 with the appropriate bus). – doneal24 Jun 21 '19 at 18:56