LinHES Forums
http://forum.linhes.org/

store TV files in two locations
http://forum.linhes.org/viewtopic.php?f=2&t=8938
Page 1 of 1

Author:  seandiggity [ Sun Mar 12, 2006 3:55 pm ]
Post subject:  store TV files in two locations

I've been searching for this and I'm sure it must be somewhere in this forum, but I can't find it -
I want to have my TV recordings stored on a 120GB drive in /myth/tv and, when that fills up, stored on a 320GB drive also (perhaps symbolically linked as /myth/tv2). I would like this to happen automatically, rather than noticing I'm full on the 120GB drive and then moving the files to the 320GB. Any suggestions?

Author:  Xsecrets [ Sun Mar 12, 2006 5:42 pm ]
Post subject: 

your best option would be LVM there is a howto on the wiki.

Author:  mac [ Sun Mar 12, 2006 9:31 pm ]
Post subject: 

you could also put a simple script in your crontab that runs at say 3 am.

It would do a check on /myth/tv2 to check avail space.
If its below say 95%, it would move all the files over from the /myth/tv
directory to /myth/tv2 (except for most recent set, to avoid moving a file that might
still be open) and create sym links for them.

Once utilization exceeds 95% on /myth/tv2 the script would stop moving files and
you would start to fill up your /myth/tv directory.

I don't know if mythtv follows sym links when it deletes show, If it just deletes the
link and not the file... well then it gets a little ugly.

Isn't linux a joy ;)

Author:  seandiggity [ Sun Mar 12, 2006 9:41 pm ]
Post subject:  great idea

That's actually a great idea. I know very little about shell scripting, but I should be able to pull it off.

Author:  mac [ Sun Mar 12, 2006 9:54 pm ]
Post subject: 

Also -- I would do it in perl, as the script would be quite small..
I edited my above post -- You should do a few test first:

-) Create a sym link in /myth/tv for a show. Delete it with the frontend and see if
it followed the sym link and deleted the file of just deleted the link.

If it just deleted link and not the file. You would also have the script remove
files in /myth/tv2 that don't have link in /myth/tv.

Author:  mac [ Mon Mar 13, 2006 7:13 pm ]
Post subject: 

There is a setting in mythtv-setup -> general
to follow sym-links when deleting files..

Author:  marc.aronson [ Tue Mar 14, 2006 12:53 am ]
Post subject: 

Just out of curiosity, why not use LVM? I've been using it for quite a while now and it works well for me. It essentially takes multiple drives and makes them look like 1 single, large drive...

Marc

Author:  khrusher [ Tue Mar 14, 2006 7:29 am ]
Post subject: 

Quote:
Just out of curiosity, why not use LVM? I've been using it for quite a while now and it works well for me. It essentially takes multiple drives and makes them look like 1 single, large drive...



Same here!

Author:  EvilTwin [ Tue Mar 14, 2006 8:30 am ]
Post subject: 

LVM rocks.

Author:  mac [ Tue Mar 14, 2006 10:05 am ]
Post subject: 

Nothing against LVM, it is really cool. For about anything I have a tendency to look at the
alternatives and then weigh the pro and cons..

pro:
LVM -- cool, expandable
Script -- fast and easy setup

con:
LVM -- crash recovery a bit of a hassle, > time to implement, I don't have any way to add extra
drives to my system anyway.

Script -- clunky, lots of extra IO

don't know.. it would be tough call for me ;)

Author:  seandiggity [ Tue Mar 14, 2006 10:21 am ]
Post subject: 

LVM seems very cool, but I probably won't use it until I'm sure I have a good backup system in place.

The script is not the kind of solution I was hoping for, but I think I'll go with it. The main problem is figuring out when to move data to the bigger drive and when to stop (I can probably wait till the drive's 99% full rather than 95% but do I risk losing some data or wasting space?)

I'll post the script here when I'm done, which may be a while from now...I've got bigger fish to fry for the next few weeks and another side project (trying to get DSL on an old Powerbook that has no CDROM).

Author:  mac [ Tue Mar 14, 2006 6:59 pm ]
Post subject: 

the mv command won't delete the orginal if the copy to new location fails for some reason.
As for wasting space, just compare the file you are about to move to avail space before moving it.

$aspace = `df /myth/tv2 |awk '{print \$4}'|tail -1`;
$fsize = `ls -l /myth/tv/big.nuv |awk '{print \$4}'`;

Another con that I thought of regarding script method would be that mythtv would
misreport the the amount of avail space.. not a big deal, just another thing to consider.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/