# How to DETECT NEW HARD DISKS without rebooting?

## l8bit

Hi guys,

does anyone know how to force the system to scan for new hard disks? I have my case open and sometimes I add (internal) sata disks on the fly. 

On windows I go to device manager and ask for the system to scan for any new devices and my hard disk is recognised without having to reboot. 

Is it possible to do the same with gentoo?   :Shocked: 

I tried sudo fdisk -l but it didn't show the newly added disk.. and the only way to detect the disk is to reboot.

Any help is greatly appreciated.  :Smile: 

PS: I have hald and udev installed and started. Also my system is compiled with the hal flag.

PS: just to emphasize I'm not talking about external USB disks. I'm talking about internal (either SCSI or SATA) disks.

----------

## magic919

Hmmm.  So you want to hotplug a sata drive...  I think a quick search might help.  Looks to me like it will depend on your SATA controller.

----------

## sonicbhoc

I have NO clue. Try restarting hotplug and udev?

----------

## kernelOfTruth

 *sonicbhoc wrote:*   

> I have NO clue. Try restarting hotplug and udev?

 

perhaps in addition to that restarting dbus & hald, that should help

http://lkml.org/lkml/2006/6/25/14

http://linux-ata.org/software-status.html

----------

## l8bit

 *sonicbhoc wrote:*   

> I have NO clue. Try restarting hotplug and udev?

 

I'll try that and report the results

----------

## martin20450

Also check the output of dmesg when you plug it in, you might also need to cd /dev and MAKEDEV sd{b,c,d,e,whatever shows in dmesg}

----------

## Bullet Dodger

I'd be interested in the answer to this?

I heard linux was big on hot pluggable devices, but when i set up a raid array and unplud 1 hd and tried to reconnect it and add it to the array again i couldn't.

I posted here and was told it depends on your hardware controlers, if the HD gets re-detected.

I don't know anything about my HD controler, so i just left it at that.

Thats more into the motherboard than i know, but now i'm interested to know.

Can any1 point me in the direction of some info on HD controles and what is/isn't hotplugable.

Cheers

----------

## kernelOfTruth

 *Bullet Dodger wrote:*   

> I'd be interested in the answer to this?
> 
> I heard linux was big on hot pluggable devices, but when i set up a raid array and unplud 1 hd and tried to reconnect it and add it to the array again i couldn't.
> 
> I posted here and was told it depends on your hardware controlers, if the HD gets re-detected.
> ...

 

see the links I posted + search for additional on google for newer kernel-patches above 2.6.17

http://linuxmafia.com/faq/Hardware/sata.html

http://linux-ata.org/driver-status.html

 *Quote:*   

> This status report applies to the latest SATA driver release, found in kernels >= 2.6.18-git5 (i.e. what will be 2.6.19).

 

----------

## l8bit

Ok I tried plugging in a SATA hard disk on the fly with my case open and then restarted hald and hotplug services but nothing happened.

Also dmesg |tail showed nothing at all.

cat /var/log/messages | tail showed nothing new either.

I'm not sure why new internal disks are not identified on the fly. Is there a command to force rescanning of the disks?

As I mentioned earlied, in windows this can be done via the device manager. I'm not sure it's a hotplugging issue as an internal sata disk is not a device with hot plug support. However it's the fact that the controller was forced to rescan for new hard disks that made Windows see the new disk. Surely there must be an equivalent linux command ?

EDIT: http://linux-ata.org/driver-status.html#nvidia says that sata_nv (my controller) has full SATA control including hotplug and PM so the disk should be recognized then?

----------

## Chris W

You could try the udevstart command.

----------

## bunder

i believe you need to rescan the bus.  "man hdparm"

cheers

----------

## l8bit

 *bunder wrote:*   

> i believe you need to rescan the bus.  "man hdparm"
> 
> cheers

 

I checked the man (8) pages and I couldn't find a parameter for hdparm to rescan the bus?

Perhaps I'm wrong?

----------

## bunder

i believe the options are -U and -R...  but the man page says they are dangerous.  ps: hotswapping can blow up your bus.

cheers

----------

## l8bit

 *bunder wrote:*   

> i believe the options are -U and -R...  but the man page says they are dangerous.  ps: hotswapping can blow up your bus.
> 
> cheers

 

Well I've read that already but since it's dangerous and may even damage (let alone hang) the system, it's not really a solution and I'm not willing to try it  :Smile: 

----------

## kernelOfTruth

 *l8bit wrote:*   

>  *bunder wrote:*   i believe the options are -U and -R...  but the man page says they are dangerous.  ps: hotswapping can blow up your bus.
> 
> cheers 
> 
> Well I've read that already but since it's dangerous and may even damage (let alone hang) the system, it's not really a solution and I'm not willing to try it 

 

how about sdparm? since you're using an ata-drive a ata-utility should do it ...

there has just been announced a new version:

http://lkml.org/lkml/2007/4/9/426

----------

## bunder

 *kernelOfTruth wrote:*   

>  *l8bit wrote:*    *bunder wrote:*   i believe the options are -U and -R...  but the man page says they are dangerous.  ps: hotswapping can blow up your bus.
> 
> cheers 
> 
> Well I've read that already but since it's dangerous and may even damage (let alone hang) the system, it's not really a solution and I'm not willing to try it  
> ...

 

interesting... i never knew they made a scsi equivalent to hdparm.   :Laughing: 

----------

## halfgaar

 *bunder wrote:*   

> i believe the options are -U and -R...  but the man page says they are dangerous.  ps: hotswapping can blow up your bus.
> 
> cheers

 

SATA should support hotswapping, right? IDE hotswapping is indeed a bad idea.

BTW, I heard that the 3.3V wire must be present on the power connector for hotplugging to work. Converters which you connect to ordinary molex connectors don't have that 3.3V wire, only dedicated SATA plugs do.

----------

## beatryder

make sure you have AHCI turned on in your kernel, and it *should* work

----------

## l8bit

 *beatryder wrote:*   

> make sure you have AHCI turned on in your kernel, and it *should* work

 

```
% cat /usr/src/linux/.config |grep AHCI

CONFIG_SATA_AHCI=y
```

as you can see AHCI is enabled and my nvidia sata driver is built in the kernel and says that it supports hot swapping. However, nothing happens when I connect an internal sata drive  :Sad:  The only way is to reboot for it to be seen.

Any other suggestions? 

Surely linux that is so much superior to windows (especially when it comes to uptime since windows needs to reboot all the time) must be able to do this!

----------

## beatryder

 *l8bit wrote:*   

>  *beatryder wrote:*   make sure you have AHCI turned on in your kernel, and it *should* work 
> 
> ```
> % cat /usr/src/linux/.config |grep AHCI
> 
> ...

 

Is it enabled in your BIOS?

What does

```

 find /sys -name "*ahci*"

```

print out?

----------

## Sachankara

SATA hotswapping is only supported by the new ATA driver, not by the old ones. The new ones can be found in a menu called "Serial ATA (prod) and Parallel ATA (experimental) drivers". Also, you'll have to disable all the old PATA/SATA drivers to get the new ones to work.

----------

## halfgaar

 *Sachankara wrote:*   

> SATA hotswapping is only supported by the new ATA driver, not by the old ones. The new ones can be found in a menu called "Serial ATA (prod) and Parallel ATA (experimental) drivers". Also, you'll have to disable all the old PATA/SATA drivers to get the new ones to work.

 

If you have the old PATA stuff enabled, does that mean it also still uses the old implementation of SATA, even though the new one is selected? I haven't enabled the new PATA stuff yet, because it's still experimental. But does that mean my SATA drives still use the old driver system?

Edit: if I read the section about libata here, they imply there are no new SATA drivers, they only have moved. The PATA drivers have changed, and for SATA hotswapping, that doesn't seem important...

----------

## roadrunner_gs

My problem seems to be in the same line.

I have a Asus P5LD2-VM SE which gives me this:

```
roadrunner-04 ~ # lspci

00:00.0 Host bridge: Intel Corporation 82945G/GZ/P/PL Memory Controller Hub (rev 02)

00:02.0 VGA compatible controller: Intel Corporation 82945G/GZ Integrated Graphics Controller (rev 02)

00:1b.0 Audio device: Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller (rev 01)

00:1c.0 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 1 (rev 01)

00:1c.1 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 2 (rev 01)

00:1d.0 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #1 (rev 01)

00:1d.1 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #2 (rev 01)

00:1d.2 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #3 (rev 01)

00:1d.3 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #4 (rev 01)

00:1d.7 USB Controller: Intel Corporation 82801G (ICH7 Family) USB2 EHCI Controller (rev 01)

00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev e1)

00:1f.0 ISA bridge: Intel Corporation 82801GB/GR (ICH7 Family) LPC Interface Bridge (rev 01)

00:1f.1 IDE interface: Intel Corporation 82801G (ICH7 Family) IDE Controller (rev 01)

00:1f.2 IDE interface: Intel Corporation 82801GB/GR/GH (ICH7 Family) SATA IDE Controller (rev 01)

00:1f.3 SMBus: Intel Corporation 82801G (ICH7 Family) SMBus Controller (rev 01)

01:0a.0 SCSI storage controller: Adaptec ASC-29320LP U320 (rev 03)

02:00.0 Ethernet controller: Intel Corporation 82573L Gigabit Ethernet Controller
```

Hot-plugging of my Fujitsu MAU3073NC connected to the Adaptec ASC-29320LP SCSI-controller does not work.

Hot-plugging of my Hitachi HDS728080PLA380 does not work when they are connected to the onboard SATA-controller, which in fact could only be configured as "Standard IDE" via BIOS, so this is okay.

Hot-plugging of my Hitachi HDS728080PLA380 does not work when they are connected to a Adaptec AAR-1210SA SATA-controller, which only is a Silicon Image SIL3112 with Adaptec-BIOS with integrated Software-RAID capability.

Hot-plugging of my Hitachi HDS728080PLA380 does not work when they are connected to a noname SATA-controller with a Silicon Image SIL3112.

Nothing shows up in /var/log/messages or via dmesg

However coldplugging - involving reboot - of harddisks and hotplugging of USB-devices such as iPod, dvd-rom, mouse or keyboard works flawless.

I am almost lost.   :Crying or Very sad: 

EDIT: Did i mention readout of SMART-parameters only works for the SCSI-harddisks, not for the SATA ones whereas obtaining the drive-temperature could be obtained for all via hddtemp...Last edited by roadrunner_gs on Sat May 19, 2007 10:09 pm; edited 1 time in total

----------

## halfgaar

 *Quote:*   

> EDIT: Did i mention readout of SMART-parameters only works for the SCSI-harddisks, not for the SATA ones whereas obtaining the drive-temperature could be obtained for all via hddtemp...

 

To obtain smart data from SATA disks with smartctl, you have to specify "-d ata" as command line option.

----------

## Monkeh

 *roadrunner_gs wrote:*   

> 
> 
> ```
> 
> 00:1f.2 IDE interface: Intel Corporation 82801GB/GR/GH (ICH7 Family) SATA IDE Controller (rev 01)
> ...

 

 *Quote:*   

> The following SATA controllers will never support hotplug: Intel ICH5-8 (non-AHCI), Pacific Digital Talon (ADMA), Promise SATA SX4.

 

Sorry, but you're out of luck.

----------

## roadrunner_gs

But that does not cover the Silicon Image-based controllers or the SCSI-Controller with the LVD-drives

----------

## roadrunner_gs

Hum i pulled some Samsung SP2504C out of another box and with those and the Adaptec AAR-1210SA hot-plugging works.

However with the SCSI-drives i have to use:

echo "scsi remove-single-device HOST CHAN DEV LUN" > /proc/scsi/scsi

echo "scsi add-single-device HOST CHAN DEV LUN" > /proc/scsi/scsi

Which also works for the SATA-disks.

----------

