udev and how to find a harddisk



Hello,

I'm searching for a way to identify my harddisk with a script (somethink
similar to fdisk -l). For that I watched out in /sys/block/hd*
or /sys/block/sd*. But which entry shows me that I've found a read/write
(harddisk) device or just a read-only device (cdrom)?

When I do a 'cat /sys/block/hdc/range' (hdc is my cdrom) I'll get a '1'.
If I do the same with hda (harddisk) or sda (usb-stick) I'll get
'64' (hda) and '16' (usb-stick). So, could '/sys/block/hd*/range' or
'/sys/block/sd*/range' tell me if I found a harddisk (>1) or cdrom (=1)?

Bye

Goran


--
To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx
with a subject of "unsubscribe". Trouble? Contact listmaster@xxxxxxxxxxxxxxxx



Relevant Pages

  • Re: udev and how to find a harddisk
    ... I'm searching for a way to identify my harddisk with a script (somethink ... device or just a read-only device? ... grep hd /var/log/dmesg ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)
  • Re: failed fsck on boot
    ... problem, but my harddisk is quit new, and windows installed in another ... but for my new installations, ... Umarzuki Mochlis ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)
  • Re: Measure "cp" Speed?
    ... harddisk if we are copying on same harddisk, different harddisk, ... and so on if we copy with USB interface ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ... Trouble? ...
    (Debian-User)
  • Re: Measure "cp" Speed?
    ... harddisk if we are copying on same harddisk, different harddisk, ... and so on if we copy with USB interface ... People take different roads seeking fulfillment and happiness. ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)
  • Re: Help! Grub is broken
    ... don't earn any money by rendering other people's computer, ... harddisk is broken, ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)