Visit the LQ Articles and Editorials section
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 05-04-2007, 01:00 AM   #1
LQ Newbie
Registered: Apr 2007
Posts: 4

Rep: Reputation: 0
Talking Linux Script

Hello guys,
Im just starting to learn linux systems and im having this project automatic restoration using linux rescue cd. I already customized my own copy of the rescue cd and already have tested to restore images using a SATA HDD. My problem now is how to program a script (rc) that will automatically detect between a SATA and an IDE HDD so that my mount parameters will fit the corressponding hdd interface?

Hope someone could help me on this. Thanks in advance.....
Old 05-12-2007, 11:18 AM   #2
Registered: Aug 2003
Location: Minnesota, U.S.A.
Distribution: Debian, openSUSE
Posts: 400

Rep: Reputation: 30
Just off the top of my head, depending on your kernel version and whether you're using a static /dev, IDE drives will be /dev/hd* and SATA drives will be /dev/sd*.

So you could use something like:

if [ -e /dev/hda ]; then
    do something
if [ -e /dev/sda ]; then
    do something else
Or however you want to do it. You could also check /sys/bus/ide/devices/ for devices, and there are probably a lot of other or better ways that I'm not aware of


linux, script

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
same awk script running on linux 7.2 and linux 10 suchi_s Programming 2 11-22-2004 07:47 AM
Converting a Windows Perl script to a Linux Perl script. rubbercash Programming 2 07-19-2004 10:22 AM
linux 9 and java script error - premature end of script header sibil Linux - Newbie 0 01-06-2004 04:21 PM
Exp. Windows/Linux-Script Programmer - Need Linux Programming Mentor! ruttiger Linux - Newbie 2 10-28-2001 11:00 AM

All times are GMT -5. The time now is 08:06 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration