On Friday 15 January 2010 14:17, Christian Paro wrote:
>This will get you a mapping from the by-id to the by-path device names:
>
>for file in /dev/disk/by-id/*; do
>  echo ${file/*\/} \
>       $(ls -l /dev/disk/by-path |
>         grep $(ls -l $file |
>                awk '{print $11}') |
>         awk '{print $9}')
>done


Nice!

Just as an aside: if you're going to run this sort of script during the boot 
sequence, do yourself a favor and use the -n option on those ls(1) commands.  
That will keep it from calling getpwent()/getgrent() to map the UIDs/GIDs to 
names.  Why bother?  Well, if your system is configured to use LDAP as its 
password database and the network ain't up yet, it's kind of not a good idea 
to map those IDs to names.  Can you say "60 second timeout"? :-)

And yes, I did find out the hard way when I had a guest that took forever to 
boot.

One really should be using readlink(1) instead of ls for this sort of thing, 
but unfortunately the powers that be placed readlink in /usr/bin, which is 
often not available at boot-time.  So we're stuck with ls.
        - MacK.
-----
Edmund R. MacKenty
Software Architect
Rocket Software
275 Grove Street · Newton, MA 02466-2272 · USA
Tel: +1.617.614.4321
Email: m...@rs.com
Web: www.rocketsoftware.com  

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390

Reply via email to