Move recordings to new disk
Added by Josu Lazkano almost 8 years ago
Hello,
I have a Tvheadened server with 2 different DVR profiles, each one in diferent path.
I add a new hard drive and want to change the path of one profile to the new disk. How could I move the recordings? Just change the path in the configuration and move the files?
I will appreciate your help.
Kind regards.
Replies (5)
RE: Move recordings to new disk - Added by Joe User almost 8 years ago
There is already a new feature request for the moving of files. Until it is implemented, you need to use a linux shell to manually move the files, then edit the config files to point to the new location. Then restart tvheadend so it will see the changes. If there are a lot of files and they are moved from/to the same place, it is probably easiest to use something like sed to change all the config files...
sed -i 's/\/old\/path/\/new\/path/g' /home/hts/.hts/tvheadend/dvr/log*
RE: Move recordings to new disk - Added by Josu Lazkano almost 8 years ago
Thanks!
So the steps will be:
- Change the path in the profile configuration.
- Stop the tvheadened service.
- Move the files to new path.
- Execute the sed command.
- Start the tvheadened service.
Is this correct?
Could you provide a real sed command with this path?
- Old path: /home/hts/profile1/
- New path: /mnt/disk1/profile1/
Thanks for your help.
Kind regards.
RE: Move recordings to new disk - Added by Robert Cameron almost 8 years ago
I would recommend stopping the Tvheadend service first, before moving files. It sometimes tracks changes to the file names and updates its logs.
Also, you can move the files to the new location, and then mount the new disk at the same place where your DVR profile recorded to, so you do not need to update/change the logs. Remember, you can bind mount and symlink, giving you a variety of ways to make your existing recording location point to your new disk.
RE: Move recordings to new disk - Added by Joe User almost 8 years ago
Yes, those steps should work. (although step 1 can be done before or after since it only affects new recordings...)
sed -i 's/\/home\/hts\/profile1/\/mnt\/disk1\/profile1/g' /home/hts/.hts/tvheadend/dvr/log/*
(although depending on which shell you are using, you may have to double or triple escape the forward slashes. ie \\\/home\\\/hts\\\/profile etc.)
Also to test first and see how the new line will be changed, you can replace the "-i" (means in place edit) with "-n" (quiet) and add "p" (print pattern) to the end :
sed -n 's/\/home\/hts\/profile1/\/mnt\/disk1\/profile1/gp' /home/hts/.hts/tvheadend/dvr/log/*
Also, while making symlinks will work, I have sometimes found the free/used disk space is not always accurate following symlinks...
RE: Move recordings to new disk - Added by Josu Lazkano almost 8 years ago
Thanks!
I did it and it work.
I have a little problem I posted here: https://tvheadend.org/boards/5/topics/24113
Kind regards.