Skip to contentSkip to conversation

Remove and add a mounted device gets a new dev path

Bug Anand Jain 2 participants 3 messages Dec 7, 2012 – Dec 10, 2012

Subsystems (2)
lore
Share & tools
lore

Anand Jain

author
#0 lore raw

# mount /dev/sdb /btrfs
# echo "scsi remove-single-device 1 0 0 0" > /proc/scsi/scsi
# lsscsi
 [0:0:0:0]    disk    ATA      VBOX HARDDISK    1.0   /dev/sda
 [2:0:0:0]    disk    ATA      VBOX HARDDISK    1.0   /dev/sdc
# btrfs su create /btrfs/sv1
Create subvolume '/btrfs/sv1'
ERROR: cannot create subvolume - Input/output error
# echo "scsi add-single-device 1 0 0 0" > /proc/scsi/scsi
# lsscsi
[0:0:0:0]    disk    ATA      VBOX HARDDISK    1.0   /dev/sda
[1:0:0:0]    disk    ATA      VBOX HARDDISK    1.0   /dev/sdd <---
[2:0:0:0]    disk    ATA      VBOX HARDDISK    1.0   /dev/sdc

The same disk comes back as /dev/sdd

(the issue is same if disk is mounted as an ext4 fs)

Thanks

author
#1 lore raw

# mount /dev/sdb /btrfs
# echo "scsi remove-single-device 1 0 0 0" > /proc/scsi/scsi
# lsscsi
 [0:0:0:0]    disk    ATA      VBOX HARDDISK    1.0   /dev/sda
 [2:0:0:0]    disk    ATA      VBOX HARDDISK    1.0   /dev/sdc
# btrfs su create /btrfs/sv1
Create subvolume '/btrfs/sv1'
ERROR: cannot create subvolume - Input/output error
# echo "scsi add-single-device 1 0 0 0" > /proc/scsi/scsi
# lsscsi
[0:0:0:0]    disk    ATA      VBOX HARDDISK    1.0   /dev/sda
[1:0:0:0]    disk    ATA      VBOX HARDDISK    1.0   /dev/sdd <---
[2:0:0:0]    disk    ATA      VBOX HARDDISK    1.0   /dev/sdc

The same disk comes back as /dev/sdd

(the issue is same if disk is mounted as an ext4 fs)

Thanks

#2 lore raw
Quoted 16 lines · Anand Jain

# mount /dev/sdb /btrfs
# echo "scsi remove-single-device 1 0 0 0" > /proc/scsi/scsi
# lsscsi
  [0:0:0:0]    disk    ATA      VBOX HARDDISK    1.0   /dev/sda
  [2:0:0:0]    disk    ATA      VBOX HARDDISK    1.0   /dev/sdc
# btrfs su create /btrfs/sv1
Create subvolume '/btrfs/sv1'
ERROR: cannot create subvolume - Input/output error
# echo "scsi add-single-device 1 0 0 0" > /proc/scsi/scsi
Quoted 8 lines
# lsscsi
[0:0:0:0]    disk    ATA      VBOX HARDDISK    1.0   /dev/sda
[1:0:0:0]    disk    ATA      VBOX HARDDISK    1.0   /dev/sdd <---
[2:0:0:0]    disk    ATA      VBOX HARDDISK    1.0   /dev/sdc

The same disk comes back as /dev/sdd

(the issue is same if disk is mounted as an ext4 fs)

That has been called a feature for several years now. You (and any program that tries to track such things) should be using the Device Identification VPD page (e.g. see 'sg_vpd -i <device>').

And if the "VBOX HARDDISK" doesn't have that page containing a unique identifier then you need to speak to Oracle.

Linux could be more helpful and make those identifiers available in sysfs; then lsscsi might display those identifiers. The udev infrastructure tracks down some of those identifiers, see the /dev/disk folder.

Doug Gilbert