LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 05-09-2007, 02:04 AM   #1
cyclonous_gt
LQ Newbie
 
Registered: Apr 2007
Posts: 4

Rep: Reputation: 0
Question How to create a script that will automatically detect a SATA and IDE hdd


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-09-2007, 02:28 AM   #2
deadeyes
Member
 
Registered: Aug 2006
Posts: 605

Rep: Reputation: 79
Quote:
Originally Posted by cyclonous_gt
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.....
sdx is scsi/sata/usb
hdx is IDE hdd
 
Old 05-10-2007, 05:23 AM   #3
cyclonous_gt
LQ Newbie
 
Registered: Apr 2007
Posts: 4

Original Poster
Rep: Reputation: 0
Thanks for the reply deadeyes but how will the script decide which to use. to give you an insight, below are the parameters i've included on the rc file of my linux rescue cd.

e2fsck -f -p /dev/sda3
mkdir /mnt/windows
mount /dev/sda3
partimage restore -b /dev/sda1 /mnt/windows/images/winpart1.000
partimage restore -b /dev/sda5 /mnt/windows/images/winpart2.000
partimage restore -b /dev/sda6 /mnt/windows/images/winpart3.000
umount /dev/sda3

my concern on the above parameter is how can i make an if condition or statement that will work both on the IDE and SATA interface automatically.
 
Old 05-10-2007, 02:02 PM   #4
jimmyok
LQ Newbie
 
Registered: Jan 2007
Posts: 6

Rep: Reputation: 0
I recently managed to do just this

create a tmp file to output to

fdisk -l grep Disk > tmp

creates a file called tmp with info about your disks ..

use cut or awk or sed to get the output from the tmp file and remove anything else

look them up may help you .

hope that helps
 
  


Reply


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot have a IDE HDD and SATA HDD together when using FC6 RivalSlayer Linux - Hardware 3 12-19-2006 04:03 AM
redhat fails to detect IDE HDD on installation alekosf Linux - Newbie 2 10-27-2006 03:43 PM
Installing ATA/IDE HDD on SATA HDD System Drahcir Linux - Hardware 10 05-31-2006 03:32 AM
move linux from IDE HDD to SATA HDD markmalcolm Linux - Hardware 2 05-07-2005 03:24 AM
Dual HDD Interface Problem, Linux on SATA, NTFS Part on IDE HDD LILO Not Loading Blade44 Linux - Hardware 2 02-01-2005 07:56 PM


All times are GMT -5. The time now is 01:38 PM.

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