Linux - GeneralThis 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.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I wrote a script file that does a bunch of things to all the possible partitions of HDA HDB HDC and HDD.
One thing I do is... I attempt to mount them.
If you try to mount a partition that doesn't exist then it spits out the message (for example) "open /dev/hdd12evice not configured"
My "issues" start here... I don't want a lot of useless messages to be displayed. I don't need to know if it failed or not. It must just return clean.
Is there a way I can tell if a partition exists before I try to mount it?
Then I could only mount those.
And, in the same token, is there a way to tell if a HDD exists?
This will also help a lot.
Hmm that's weird. Maybe it's some Redhat/Mandrake way of doing things. I don't have any of those systems around to check, but the ones I did check now all show the hdxX references in /proc/partitions. The man page of fdisk even says when using -l if there are no devices given then the entries in /proc/partitions are used. So that would explain why fdisk -l wouldn't work for you.
Maybe I should check my Mandrake system when I get home, probably also got those weird entries since I've seen them before.
Yep. That's exactly what I did.... but then, I thought... why the hell do I wanna use egrep and awk, they're soooo big, and i'm stingy with my space at the moment. (It's on a boot disk).
So I wrote a little C app of like 10 lines or something.
Statically compiles to about 10k.
All I do is pass it a command line like "hda2" or "hdc" and it returns true or false, which I use in my script file.