DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2008-03-11 01:30:15

jayas
Member
Registered: 2008-01-24
Posts: 151

re: DNS-323 has hot-plug capability?

Hello,

When I asked D-LINK Support why hot-plugging of drives was not supported.  I was told that the software engineers say it is a hardware limitation.  The following experiment seems to suggest otherwise:

My device is running happily in RAID 1 mode.

I fault a drive and remove it from the array as follows:

Code:

mdadm -f /dev/md0 /dev/sda2
mdadm -r /dev/md0 /dev/sda2

The relevant logs are as expected:

Code:

raid1: Disk failure on sda2, disabling device.
        Operation continuing on 1 devices
RAID1 conf printout:
 --- wd:1 rd:2
 disk 0, wo:1, o:0, dev:sda2
 disk 1, wo:0, o:1, dev:sdb2
RAID1 conf printout:
 --- wd:1 rd:2
 disk 1, wo:0, o:1, dev:sdb2
md: unbind<sda2>
md: export_rdev(sda2)

I then remove the right drive and then insert it back after a minute.  The relevant logs:

Code:

Synchronizing SCSI cache for disk sda:
FAILED
  status = 0, message = 00, host = 1, driver = 00
  <5>  Vendor: SAMSUNG   Model: HD501LJ           Rev: CR10
  Type:   Direct-Access                      ANSI SCSI revision: 03
SCSI device sdc: 976773168 512-byte hdwr sectors (500108 MB)
SCSI device sdc: drive cache: write back
SCSI device sdc: 976773168 512-byte hdwr sectors (500108 MB)
SCSI device sdc: drive cache: write back
 sdc: sdc1 sdc2
Attached scsi disk sdc at scsi0, channel 0, id 0, lun 0
Attached scsi generic sg0 at scsi0, channel 0, id 0, lun 0,  type 0
md: bind<sdc2>

Note that the re-inserted disk inserted becomes SCSI device sdc and not sda.

I was able to add /dev/sdc2 to the raid array and things went back to normal other than the fact that I now do not have sda SCSI device but sdc instead.

It does look like DNS-323 hardware has hot-plug capability.   The problem is caused by the software allocating running device names on hot-plugging.  I cannot see any reason why the SCSI device name should not be tied to the particular hardware ports for this device.

Is this a kernel (or device driver) imitation?  Is there a feature that I am missing in relation to getting the SCSI device driver to allocate static device names to particular ports?

Kind regards,

Jaya


H/W=B1 F/W=1.04; RAID1: SAMSUNG HD501LJ T166 (500GB, SATA 3.0Gb/s 16MB)

Offline

 

#2 2008-03-11 03:28:07

fordem
Member
Registered: 2007-01-26
Posts: 1938

Re: re: DNS-323 has hot-plug capability?

SATA was designed to support hot plugging, so the hardware supports hot plug - the limitation is in the software.

Offline

 

#3 2008-03-11 09:06:43

mig
Member
From: Seattle, WA
Registered: 2006-12-21
Posts: 532

Re: re: DNS-323 has hot-plug capability?

jayas wrote:

...The problem is caused by the software allocating running device names on hot-plugging.  I cannot see any reason why the SCSI device name should not be tied to the particular hardware ports for this device.

Is this a kernel (or device driver) imitation?  Is there a feature that I am missing in relation to getting the SCSI device driver to allocate static device names to particular ports?

I agree with fordem, I believe the problem is the lack of hot plug software to manage the hot plug events.

I think the problem is that /dev/sda is not being un-allocated (released, closed maybe?) after the disk is removed.
I don't think static device names to hardware ports is the correct implementation.  Although, it might work
for the HDD0 and HDD1 SATA port, it kinda falls down when looking at a USB hub connection with multiple drives. 

I had to configure a Fedora Core (maybe FC4 or FC5) to work with a firewire drive a year (or two) ago.  I recall
I had to add a hot plug module and related configuration scripts to rescan the SCSI bus when devices were
attached or removed.  I didn't do any development, myself, just implemented work others had pioneered.
But the relevant technologies were 'hotplug', 'udev' and 'hal',  IIRC.  Perhaps a google search for those key
words will find some information which could be applied to get hot-plugging on the DNS-323.

Last edited by mig (2008-03-11 09:09:20)


DNS-323 • 2x Seagate Barracuda ES 7200.10 ST3250620NS 250GB SATAII (3.0Gb/s) 7200RPM 16MB • RAID1 • FW1.03 • ext2 
Fonz's v0.3 fun_plug http://www.inreto.de/dns323/fun-plug

Offline

 

#4 2008-03-11 10:30:30

jayas
Member
Registered: 2008-01-24
Posts: 151

Re: re: DNS-323 has hot-plug capability?

Hi Mig,

mig wrote:

I think the problem is that /dev/sda is not being un-allocated (released, closed maybe?) after the disk is removed.
I don't think static device names to hardware ports is the correct implementation.  Although, it might work
for the HDD0 and HDD1 SATA port, it kinda falls down when looking at a USB hub connection with multiple drives.

Yes it does look like /dev/sda is not being un-allocated, or if it was, then it is not being re-allocated.

In the context for 2-bay DNS-323, reserving sd[ab] to these two SATA slots would make sense.  What is interesting is that once I worked out that removing and re-insertion caused the drive to jump, I was able to make DNS-323 support hot-plug for purposes of removal and insertion of one drive of a RAID1 set without requiring a reboot ... well almost.

I say almost because the hot plug auto mount script seems to require a reboot after 16 hot plugs.  When I figure out what was in Mr Wilson Chan's mind when he wrote that script, I will probably be able to fix it or at least explain why.  smile

Jaya


H/W=B1 F/W=1.04; RAID1: SAMSUNG HD501LJ T166 (500GB, SATA 3.0Gb/s 16MB)

Offline

 

#5 2009-10-02 22:24:41

eastpole
Member
Registered: 2009-10-02
Posts: 9

Re: re: DNS-323 has hot-plug capability?

Aha, Wilson Chan!

I actually think he did a really good job here, assuming he was limited to sh scripts for the hotplug handling of printers and SATA devices.

It looks like he did ponder cardreaders etc, but was pulled back from that problem. Too bad!

I'm trying now to decide how hard it would be to implement consistent naming, i.e. whenever I plug in a specific usb device it will always mount at the same path. Then it will be easy to get my digital cameras to rsync out to the NAS whenever I plug them in, etc.

I raise my glass to you, Wilson, wherever you are.

tai

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB