Mailinglist Archive: opensuse-autoinstall (36 mails)

< Previous Next >
Re: [opensuse-autoinstall] I don't want /dev/disk/by-id/ in my fstab :-(
  • From: Mike Marion <mmarion@xxxxxxxxxxxx>
  • Date: Mon, 8 Oct 2007 13:28:00 -0700
  • Message-id: <20071008202759.GH2086@xxxxxxxxxxxxxxxxxxxxxx>
On Mon, Oct 08, 2007 at 02:46:51PM +0200, Frank Steiner wrote:

> /dev/disk/by-id/scsi-...
> 
> instead of /dev/sda in /etc/fstab. Although I'm using /dev/sda in the
> AY profiles and not /dev/disk/by-id.

If there's no option to do what you want, a pretty simple script can do
it for you... quick example:

#!/bin/sh
PATH=/bin:/sbin:/usr/bin:/usr/sbin
cat /etc/fstab | while read line

do
        dev=`echo $line | awk '/by-id/{print $1}'`

        if [ -n "$dev" ]
        then real_dev=`ls -l $dev | awk -F/ '{print $NF}'`
                echo $line | sed -e 's|'$dev'|'/dev/$real_dev'|g'
        else
                echo $line
        fi
done

Only drawback to that is it screws up the whitespacing that was lined
up.  Side effect of the while read line bit.. works though.  Probably
more elegant ways to accomplish the same thing too.

-- 
Mike Marion-Unix SysAdmin/Staff IT Engineer-http://www.qualcomm.com
[Desperate for a doughnut, Homer opens his "Emergency Procedures" manual to 
reveal a cutout with some crumbs and a note...]
Homer: [reads note] "Dear Homer, I.O.U. one emergency donut.  Signed, Homer.
Bastard!  He's always one step ahead."  ==> Simpsons, Treehouse of Horror IV.
-- 
To unsubscribe, e-mail: opensuse-autoinstall+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-autoinstall+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups
References