LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 09-07-2010, 07:22 PM   #1
lpallard
Senior Member
 
Registered: Nov 2008
Posts: 1,045

Rep: Reputation: Disabled
Question UDev rules and detecting powered up SATA HDD in 5.25 enclosure


My new question is pretty straight forward. I have 3X 5.25 SATA removable bays with hard drives in it. I am working on a new script
to manually backup some very important data to those drives. Basically, to eliminate risks of burning the HDD's, or accidentally (either by me or my scripts) destroy data, I normally keep those drives offline, i.e. unpowered. The enclosures are Vantec EZ swap and require a key to turn them on/off. Once it is turned on, Slackware see them without a glitch. My script will basically display a message to warn that the backup is about to happen, then once the user click the OK button, mount the partition to a local folder and then backup the data. The partition will then be unmounted and a new message will be displayed to ask the user to "unplug" the HDD. Cron will take care of the schedule.

Basically, in pseudo code:

Code:
1-Verify if sdd is connected (powered)... If so, procee to #2, else display message box "The HDD is not connected"
2-Mount the partition sdd5 to the local folder
3-Backup
4-Unmount the partition from the local folder
5-Display a message box "The backup was completed with success.  You can now disconnect the HDD"
Now to the question, how can I automate the detection of the hdd? I would like the script to poll or probe the HDD to see if it was properly turned on, and if so, proceed with the rest... I tried all kind of stuff but no luck... For example, fdisk -l will list the drive & its partitions if it is connected (powered) and wont if the drive is not connected. I cant use the output of fdisk to efficiently accomplish what I am trying to do...


The second question is more complicated. I want the script to display the messages boxes (Please plug the HDD & You can now unplug the HDD) to a different display (i.e. my laptop). The reason is because the script will run on my server that has no monitor...

any idea? Thanks!!
 
Old 09-08-2010, 02:36 AM   #2
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
http://www.reactivated.net/writing_udev_rules.html
http://gentoo-wiki.com/HOWTO_Customizing_UDEV

Were you looking for something like this?

I can't really help you with the second question. Aside the fact that you very, umm, sparsely described your physical setup here is a rough outline how it might be done: create a XWindow session on your laptop which gets the data for instance via ssh. Details might better come by in a dedicated thread...

Last edited by JZL240I-U; 09-13-2010 at 01:34 AM.
 
Old 09-11-2010, 05:08 PM   #3
lpallard
Senior Member
 
Registered: Nov 2008
Posts: 1,045

Original Poster
Rep: Reputation: Disabled
JZL240I-U, thanks for replying! I will try what you suggested as soon as my laptop is back in action, I am having major problems right now... We'll post soon!
 
Old 09-11-2010, 06:38 PM   #4
10110111
Member
 
Registered: Jun 2008
Location: St.-Petersburg, Russia
Distribution: (B)LFS, Ubuntu, SliTaz
Posts: 403

Rep: Reputation: 51
Quote:
I want the script to display the messages boxes (Please plug the HDD & You can now unplug the HDD)
You can use gxmessage to show dialogs.

Use DISPLAY environment variable to direct gxmessage what X server and display to use (e.g. DISPLAY=YourLaptopIP:0.0)

You'll have to use xhost command to allow the server access to your laptop's X server.

Last edited by 10110111; 09-11-2010 at 06:48 PM.
 
Old 01-08-2011, 06:47 PM   #5
lpallard
Senior Member
 
Registered: Nov 2008
Posts: 1,045

Original Poster
Rep: Reputation: Disabled
Thanks for your replies! I am closing this thread since I sold the enclosures therefore I no longer need to play around with UDEV rules...

Thanks to all!
 
  


Reply



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
How to edit "/etc/udev/rules.d/40-basic-permissions.rules" file cygan Linux - Newbie 11 03-09-2009 05:22 AM
cat: /etc/udev/rules.d/70-persistent-net.rules: No such file or directory rcg1984 Linux From Scratch 2 09-17-2008 07:02 AM
udev rules fail on identical sata hard disk drives xushi Linux - Hardware 5 01-03-2008 01:49 AM
slackware-current, udev 0.96, and custom udev rules not working rignes Slackware 6 08-10-2006 03:43 AM
need help fixing my udev rules or ivman rules hedpe Linux - Hardware 2 03-18-2006 10:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 09:25 AM.

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
Open Source Consulting | Domain Registration