disk moves from /dev/sdd to /dev/sde

Bill Davidsen davidsen at tmr.com
Sun Dec 20 18:15:39 UTC 2009


Wolfgang S. Rupprecht wrote:
> I'm seeing something strange where a disk appears to change from
> /dev/sdd to /dev/sde under f12.  I have a motherboard (Asus M3A78T) that
> appears to have multiple onboard disk controllers.  When I boot with no
> external storage plugged into the USB, my hard disks are assigned sda,
> sdb, sdc sdd.  When I boot with, say, a flash drive, camera or cell
> phone attached the external device gets the "sdd" name and my last disk
> gets the name sde.  Now, that in itself doesn't cause any problems
> because I don't have the disk sdX names wired into anything.
> 
> What is a problem is that after booting, something unknown (perhaps an
> ATA reset?) causes the disk letters to be re-assigned just as if it was
> at boot time.  If I have some flash-like external storage plugged in my
> last disk gets shifted to /dev/sde.  At that point programs like
> smartmon that are looking at the disk under the old name fail to find it
> and generate an error.  "smartmon -a /dev/sde" does show the disk under
> it's new name, but even the kernel appears to look for the disk under
> its old name.  I see lots of the following mailed to me by chron: 
> 
>   /etc/cron.hourly/zzzdo-backup:
> 
>     /dev/dm-0: read failed after 0 of 4096 at 0: Input/output error
>     /dev/dm-0: read failed after 0 of 4096 at 0: Input/output error
> 
> How do I nail down the disk numbering a bit tighter so that things don't
> move around after boot-time?
> 
This is a new one on me,m as I've never seen a device name change except a boot 
time. Obviously when a new device comes on line, USB or similar, it will get a 
name, but I've never seen the name change on a continuously connected device.

Therefore, it would be worth investigating carefully to see how and when this 
happens. Might I suggest running a script every ten minutes or so, so you can 
see what changes, and look at /var/log/messages for the time when the change 
happened.

Maybe something like this, so you are sure which device is which:
#!/bin/bash
#   blkdevtrc 1.1 2009-12-20 12:53:07-05 root Exp
# trace which devices are connected to which names
cd /sys/block || exit 1

# NOTE: works for real devices, not member of fakeraid
# controllers.

# Typical values for this define are "Serial" or "Capacity"
LastLine="Serial"

echo "block device trace for host $(hostname) $(date +%Y%m%d-%H%M)"
SepLine=""

for dev in sd*; do
   echo "${SepLine}"
   echo "Device name /dev/${dev}"
   echo -n "Device connection: "
   cat ${dev}/dev; echo
   smartctl --all /dev/$dev | sed -n "1,/INFORMATION/d;1,/${LastLine}/p"
   SepLine="======"
done

I swiped tis from my tool kit, later versions are more complex, but this will 
show when a device moves, and where.


-- 
Bill Davidsen <davidsen at tmr.com>
   "We have more to fear from the bungling of the incompetent than from
the machinations of the wicked."  - from Slashdot




More information about the fedora-list mailing list