|
|
 |
 |
 |
 |
bbs |
search |
rss |
faq |
about |
register
|
 |
 |
digg |
del.icio.us |
sphere |
google
|
 |
|
| 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. |

2009-01-05, 01:51
|
|
Regular
|
|
Victoria, Australia
|
|
"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
|

2009-01-05, 03:08
|
|
Regular
|
|
01
|
|
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.
|

2009-01-05, 18:23
|
|
Moderator
|
|
Sierra Vista. Arizona
|
|
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.
|

2009-01-05, 20:56
|
|
Regular
|
|
Victoria, Australia
|
|
Re: "Offline" portable device usage
Quote:
Originally Posted by coroner
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
|

2009-01-05, 21:17
|
|
Regular
|
|
01
|
|
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.
|

2009-01-06, 16:01
|
|
Moderator
|
|
Sierra Vista. Arizona
|
|
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.
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
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
|
 |
 |
 |
 |
|