IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an
email to Administrator. User accounts are meant only to access repo
and report issues and/or generate pull requests.
This is a purpose-specific Git hosting for
BaseALT
projects. Thank you for your understanding!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
If a USB device is marked as removable, it is often a SATA/PATA disk
in an enclosure (note that flash card readers and usb storage sticks
are always marked as removable). In this case, try running ata_id
(which sends ATA commands wrapped in SCSI ATA PASS THROUGH commands)
to get information about the disk. If this fails, just fall back to
running usb_id since it could be the device isn't an ATA device at
all or the device doesn't have a SAT layer.
This extra information is nice to have as it indicates if it is
suitable to send e.g. SMART commands to the disk, whether the disk
supports power management and so on. Additionally, the VPD and serial
number returned by ata_id is usually more accurate as it stems from
the disk itself instead of the enclosure.
Note that udisks has been doing this for a while
KERNEL=="sd*[!0-9]", ATTR{removable}=="0", ENV{ID_BUS}=="usb", ENV{DEVTYPE}=="disk", IMPORT{program}="udisks-probe-ata-smart $tempnode"
so this change shouldn't be too disruptive (udisks-probe-ata-smart
also sends ATA commands via the ATA PASS THROUGH command).
Signed-off-by: David Zeuthen <davidz@redhat.com>
The bsg devices node are created after the LUN, so we fail in the
hotplug case, but succeed at coldplug, and create inconsistent data
that way.
The bsg device event order will need to be sorted out, by changing the
kernel.
The major benefit here, is that we get the ATAPI device serial
number. With SCSI ID we didn't get this since it's not part of the
SCSI INQUIRY command. Specifically this means that we get symlinks to
empty optical drives, e.g.
/dev/disk/by-id/ata-VBOX_CD-ROM_VB2-01700376
which we didn't get earlier. So this is a major win.
Also make ata_id work on CD-ROM devices when using /dev/bsg nodes so
this works on both the scsi_device as well as the block device. We do
this, basically, by issuing the ATA IDENTIFY PACKET DEVICE command
instead of the ATA IDENTIFY command. We also use 16-byte pass-through
ATA passthrough instead of 12-byte passthrough to avoid clashing with
the MMC BLANK command.
This means that we get this output
# udevadm info -q all -p /sys/devices/pci0000:00/0000:00:01.1/host3/target3:0:0/3:0:0:0
P: /devices/pci0000:00/0000:00:01.1/host3/target3:0:0/3:0:0:0
E: UDEV_LOG=3
E: DEVPATH=/devices/pci0000:00/0000:00:01.1/host3/target3:0:0/3:0:0:0
E: DEVTYPE=scsi_device
E: DRIVER=sr
E: MODALIAS=scsi:t-0x05
E: SUBSYSTEM=scsi
E: ID_ATA=1
E: ID_TYPE=cd
E: ID_BUS=ata
E: ID_MODEL=VBOX_CD-ROM
E: ID_MODEL_ENC=VBOX\x20CD-ROM\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x 20\x20\x20\x20\x20\x20\x20
E: ID_REVISION=1.0
E: ID_SERIAL=VBOX_CD-ROM_VB2-01700376
E: ID_SERIAL_SHORT=VB2-01700376
instead of just
# udevadm info -q all -p /sys/devices/pci0000:00/0000:00:01.1/host3/target3:0:0/3:0:0:0
P: /devices/pci0000:00/0000:00:01.1/host3/target3:0:0/3:0:0:0
E: UDEV_LOG=3
E: DEVPATH=/devices/pci0000:00/0000:00:01.1/host3/target3:0:0/3:0:0:0
E: DEVTYPE=scsi_device
E: DRIVER=sr
E: MODALIAS=scsi:t-0x05
E: SUBSYSTEM=scsi
E: ID_SCSI=1
E: ID_VENDOR=VBOX
E: ID_VENDOR_ENC=VBOX\x20\x20\x20\x20
E: ID_MODEL=CD-ROM
E: ID_MODEL_ENC=CD-ROM\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
E: ID_REVISION=1.0
E: ID_TYPE=cd
Signed-off-by: David Zeuthen <davidz@redhat.com>
In a multi-initiator setup, the HBA may very well export a SCSI device
for a device that another initiator has already logged into. But since
another initiator has already logged in, the kernel will not create a
block device.
Note that this is also the case for some RAID HBAs - for example, the
LSI 1068 series cards will export a SCSI device for a disk that is in
use by the HBAs RAID engine (no block device will be created here).
Running scsi_id and ata_id on the actual SCSI device means that we can
inquire the capabilities of the device. For example, we can check
whether ID_ATA_FEATURE_SET_SMART and ID_ATA_FEATURE_SET_SMART_ENABLED
is set and, if so, periodically poll the SMART status of the
disk. Even when other initiators has claimed the disk and if the disk
is in use by the RAID engine of the HBA.
Note that we run scsi_id and ata_id on /dev/bsg/* nodes - this is safe
to do because the scsi core guarantees that the bsg device has been
created before the actual add uevent for the scsi_device is emitted.
Since the block device is a direct child of the scsi_device we can
avoid running scsi_id and ata_id again by simply importing the
resulting ID_* properties from the parent.
Signed-off-by: David Zeuthen <davidz@redhat.com>
Using virtio-blk serial attributes add rules to extract drive serial numbers and
generate by-id links for the block device and partitions.
With these rules added, we now see the following symlinks in disk/by-id
% ls -al /dev/disk/by-id | grep vdb
lrwxrwxrwx. 1 root root 9 Jun 1 22:09 virtio-QM00001 -> ../../vda
lrwxrwxrwx. 1 root root 10 Jun 1 22:09 virtio-QM00001-part1 -> ../../vda1
Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
Some SCSI devices use the same WWN and have a WWN extension that we
need to take into account when creating the /dev/disk/by-id/wwn
symlinks. Thus, introduce ID_WWN_WITH_EXTENSION. This property will
contain either the WWN (if no extension is present) or the WWN with
the vendor extension appended.
Example:
# /lib/udev/ata_id/ata_id --export /dev/sda |grep WWN
ID_WWN=0x5001517387d61905
ID_WWN_WITH_EXTENSION=0x5001517387d61905
# /lib/udev/scsi_id --whitelisted --export -d /dev/sdb |grep WWN
ID_WWN=0x600508b400105df7
ID_WWN_VENDOR_EXTENSION=0x0000e00000d80000
ID_WWN_WITH_EXTENSION=0x600508b400105df70000e00000d80000
# /lib/udev/scsi_id --whitelisted --export -d /dev/sdc |grep WWN
ID_WWN=0x600508b400105df7
ID_WWN_VENDOR_EXTENSION=0x0000e00000db0000
ID_WWN_WITH_EXTENSION=0x600508b400105df70000e00000db0000
Signed-off-by: David Zeuthen <davidz@redhat.com>
Now that both ata_id and scsi_id exports the World Wide Name in the
ID_WWN property, use this to create persistent symlinks. Example
/dev/disk/by-id/wwn-0x500000e01b83f360 -> ../../sdn
/dev/disk/by-id/wwn-0x500000e01b83f440 -> ../../sdm
Signed-off-by: David Zeuthen <davidz@redhat.com>
The kernel IDE drivers get deprecated now:
http://article.gmane.org/gmane.linux.ide/43151
Almost everybody has switched over to libata devices long ago.
Recent services do not work with the now deprecated IDE drivers
at all and require libata drivers and SCSI infrastructure.
Systems who care about the old stuff need to add the rules to the
compat rules.
ID_CDROM_MEDIA_SESSION_LAST_OFFSET is not set for CDs with only a single
session (i. e. for the vast majority of CDs out there). The previous rules ran
blkid with invalid arguments for these, causing CD detection to fail in
DK-disks and gvfs.
Now check whether we actually have ID_CDROM_MEDIA_SESSION_LAST_OFFSET, and if
not, call blkid without -O for specifying the offset.
Many thanks to Maxim Levitsky for tracking this down!
https://launchpad.net/bugs/431055
We need to call ata_id as the default for libata sd* devices. We
want ID_BUS=ata, and the ATA device proeprties, and be independent
of the SCSI emulation with the truncated values. The links
in /dev/disk/by-id/{ata-*,scsi-*} are still the same.
Opening an optical drive device node without O_NONBLOCK autocloses the
tray, we run vol_id on every media change by kernel emitted "change"
events, which can make it hard to change the media when the tray closes
immediatey again.:) We check for cdrom_id to indicate an existing track,
if no media is found, we will not open the device with vol_id.
Thanks to Christian Krause and DavidZ for debugging and testing.
None of these rules is supposed to be changed by users, so move
them out of /etc. Custom rules, and automatically generated rules
stay in /etc. All rules are still processed in lexical order,
regardless which directory they live in.