Date: Tue, 07 Sep 2010 20:17:20 +0300 From: Alexander Motin <mav@FreeBSD.org> To: Alexander Leidinger <Alexander@Leidinger.net> Cc: geom@FreeBSD.org Subject: Re: Determinig removable devices in shell scripts? Message-ID: <4C8673A0.6070605@FreeBSD.org> In-Reply-To: <20100907170526.834646wxfkh4sou8@webmail.leidinger.net> References: <20100907170526.834646wxfkh4sou8@webmail.leidinger.net>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi. Alexander Leidinger wrote: > is there an easy way to determine in a shell script if a device (da/ada) > is removable (USB memory stick, eSATA connection)? I was thinking more > or less about something like "sysctl kern.disks". There is two kinds of removability - removable media and removable device. For removable media: SCSI/ATAPI disks (da) report different device types for fixed disks (HDD) and removable (ZIP, FDD, card readers, ...). It can be found via `camcontrol inquiry daX`. I haven't heard about ATA (non-ATAPI) disks with removable media, though specifications last time include dedicated fields for media serial number, which may mean removable media. For removable devices: I believe it is controller of even more - platform dependent. For USB it probably may be assumed by default, for others it depends. All I have seen - AHCI controller have two bits per port defining different kind of removability. You may see them during verbose boot. But BIOS vendors often not bothering to fill them correctly even if some ports wired to external connectors. To get information about controller, you may try `camcontrol negotiate ada0 -v`. -- Alexander Motin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C8673A0.6070605>
