About
Community
News of the Temple
Community Bulletin Board
Chat
Art
Carnality
Entertainment
Science
Society
Technology
bbs | search | rss | faq | about | register
digg | del.icio.us | sphere | google

Go Back   Community > Technology > Everything *NIX

Everything *NIX This is a general forum about all forms of *nix. Post your ideas and thoughts on this wonderful OS family. Talk about your personal favorite flavor of *nix and why you think it's so much better than the others. Anything pertaining to *nix and *nix administration should be posted here.

Reply
 
Thread Tools Display Modes
  #1   Add Akdor 1154 to your ignore list  
Old 2009-01-05, 01:51
Akdor 1154 Akdor 1154 is offline
Regular
 
Victoria, Australia
Lightbulb "Offline" portable device usage

Hi,

I'm getting a portable HDD as data storage to supplement my "puny" 64GB SSD laptop - is there any way to rig up a transparent 'offline mode' for mount points?
I.e. there is a folder ~/Downloads.
When the device is plugged in, this is a mountpoint/symlink to /media/device/Downlolads; when the device isn't plugged, it's a symlink to a temp directory somewhere. When I plug in the HDD, this hypothetical 'offline mode' would transparently move everything in the temp directory to /media/device/Downloads, so the temp directory is blank - a "one-way" sync.

Could I rig something like this up with HAL or Solid (kde4)? A bash script could probably do this (there's no fancy conflict resolution etc. needed), but I haven't played with HAL at all, really.
Better, does something like this exist? I've played with Unison, but AFAIK it isn't designed for this sort of thing. I'm running Sidux with the kde42.debian.net repo.

A Unison (or other cross platform) solution would be great, as I want to use this drive as a common "data dump" for both my Linux lappy and WinXP desktop.

Thanks, Jarrad
Reply With Quote
  #2   Add Prometheum to your ignore list  
Old 2009-01-05, 03:08
Prometheum Prometheum is offline
Regular
 
01 Send a message via AIM to Prometheum Send a message via MSN to Prometheum
Default Re: "Offline" portable device usage

I have never tried doing anything like this, but you seem to be on the right track. I don't know of anything like that existing. There might be a better solution, though.
Reply With Quote
  #3   Add coroner to your ignore list  
Old 2009-01-05, 18:23
coroner coroner is offline
Moderator
 
Sierra Vista. Arizona
Default Re: "Offline" portable device usage

To my knowledge you don't need anything specific with HAL.
If you specify the device partitions in /etc/fstab when you plug the device in it is mounted where you specify.

Try to explain in more detail what you mean by temporary directory or whatever.
As far as I know all directories are temporary, unless you modify them with chattr.

The above fstab example though works for me on Fedora 10 using hotplugged USB flash devices, external HDD, whatever.
Reply With Quote
  #4   Add Akdor 1154 to your ignore list  
Old 2009-01-05, 20:56
Akdor 1154 Akdor 1154 is offline
Regular
 
Victoria, Australia
Smile Re: "Offline" portable device usage

Quote:
Originally Posted by coroner View Post
Try to explain in more detail what you mean by temporary directory or whatever.
As far as I know all directories are temporary, unless you modify them with chattr.
I want to have a single folder (say, ~/Downloads) that, if the HDD is connected, will be a mountpount of/symlink to a folder on the HDD - however if the HDD is not connected, I can dump stuff in there anyway and it will be transparently propagated to the HDD when I plug it in next.
That is the end result, the temp dir stuff was my own projected implementation.

Quote:
Originally Posted by Promethem
I have never tried doing anything like this, but you seem to be on the right track. I don't know of anything like that existing. There might be a better solution, though.
Yeah I don't actually have the HDD yet but I'll let you know how it goes when I finally get it. Or if I get bored I'll play around with a thumb drive.

Thanks,
Jarrad
Reply With Quote
  #5   Add Prometheum to your ignore list  
Old 2009-01-05, 21:17
Prometheum Prometheum is offline
Regular
 
01 Send a message via AIM to Prometheum Send a message via MSN to Prometheum
Default Re: "Offline" portable device usage

If HAL has some sort of "action" it can do for certain things, then you can write a script to toggle it on/off and have it run when HAL mounts/umounts it.

I know that I can force arbitrary devices to be recognized as music players by putting a specially named file in their root, so failing all else, set your "music device plugged in" action to the toggle script.

The script itself would be simple: You have ~/Downloads be a symlink, either to ~/.tmp_downloads or ~/mnt/drive (or /media/drive or whatever you want obviously). On mounting the device, you redo the symlink and you move all the files over.
Reply With Quote
  #6   Add coroner to your ignore list  
Old 2009-01-06, 16:01
coroner coroner is offline
Moderator
 
Sierra Vista. Arizona
Default Re: "Offline" portable device usage

Check out /etc/udev/rules.d/90-hal.rules

What you need essentially is to move before the mount occurs, and move after the mount occurs, and finish it all with 'sync' to flush the buffer cache to disk, unless you are using synchronous I/O with the device.

Since I did not bring my USB stick with me today I will not be able to test anything, but the file above on my system should be before the mount occurs, and it's possible to move the files, leave the udev-event target, then run again to move the files and sync, that might be all you need to do.
Reply With Quote
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
Forum Jump


All times are GMT. The time now is 14:41.


 

 

totse.com certificate signatures
 
 
About | Advertise | Art | Carnality | Community | Contact Us | Copyright Policy | Entertainment | FAQ
Link to totse.com | Science | Search | Society | Submissions | Technology
Hot Topics
Why is torture such a fukin big deal?
The Coming Age of China Superpower
Don't you guys think this is a little messed up?
[UK] Police Given New Powers to hack your PC
bombarding Gaza
Will the new proposed economic measures work
Recent Development on Obama Citizenship.
so we have 51 states now?
 
Sponsored Links
 
Ads presented by the
AdBrite Ad Network

 

 

TSHIRT HELL T-SHIRTS