On 05/06/2011 02:13 PM, Harald Becker wrote:
Hallo David!
If I can gain access to the serial numbers of the drive, ...
Serial number? ... do you mean the unique block device number? ... sorry
if that may be confusing, a serial number is a strait counting number
(1, 2, 3, ...) for me.
... looks like you are looking for the block device UUID feature ... may
be the blockdev command can give you that information (I do not use this).
Perhaps a peek into your file might help as I'm also using mdev to
call an external script for processing.
Sorry, I do not have an ready example for posting. It is just a simple
and well known feature used in other shell programming technics too.
A brief introduction ...
At start of script, read stored variable values like:
[ -f /dev/script/serial_number ]&& source /dev/script/serial_number
The variable name file may contain shell variable assignments, like:
my_serial_number=4
That variables my be used in your shell script:
new_name="$base_name$(( ++my_serial_number ))"
... or any other form of shell variable substitution.
At the end of the script, save new/changed variable values for later
retrieval:
echo "my_serial_number=$my_serial_number">/dev/script/serial_number
That's it. May be modified to fit all types of simple information
passing from one script invocation to next one. Feal free to ask for
details.
--
Harald
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox
Thanks again for the continued help Harald. When I was saying the
serial number, I'm actually talking about the serial number for the
drive/device itself. This can be seen in /proc/scsi/usb-storage/*ID*
file for USB devices (I have no idea how to obtain this information for
internal SATA/IDE/SCSI drives) and is not the UUID of the drive (I can
obtain that info via blkid). The reason I'm trying to use serial
numbers is because that information does NOT change between devices
being plugged in and removed from computer. It's a way to always
reference a device file without fear of it changing (unlike /dev/sda1
for example). Unfortunately the lines above will not help either as
those are not unique information to the drive and can change between
devices being plugged in and removed. Any other thoughts or methods to
obtain serial numbers?
Dave
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox