Backup-tablo.sh - Backup all recorded shows from a Tablo

After purchasing a Tablo (coming from MythTV), I was worried about all my recorded shows being in a single hard drive without a proper backup. After reading a bit here in the forums, and learning a few neat things about the Tablo webserver, I found a potential way to backup the Tablo’s recorded shows. After some quick sucessfull tests, I wrote a small bash script to backup (not transcode) my recordings to my ZFS server. As a bonus, I wrote directions on how to restore them to a Tablo too :slight_smile:

I’ve named it backup-tablo and placed it on github if anyone is interested in it:

-May the source be with you

7 Likes

I’ve used it successfully today. I swapped drives and gave it a try. I have changed drives in the past, so I had some clue. I used clonezilla, gparted and basic rsync. The USB is a bottle neck, so I could just let this run until I was ready.

I let tablo format the new drive, I actually put it in the PC to “restore” the files. Connected everything up and as you know, it works just like nothing happened.

A note, users don’t get write access to /var/log, running from the command line should maybe have root privileged and maybe to retain file permission/owner.

When restoring, tablo is root owner of / traversing down, shouldn’t it be run as root?

Needed utilities, look to to be part of Coreutils - GNU core utilities and I doubt a system is a system without them :wink: (it’s unlikely you’d need to specify a full path what with /usr merge)

Thanks :exclamation: :floppy_disk:

1 Like

Awesome, and glad it worked :wink: Thanks for trying it out.

FYI: I made an update to the code this past weekend that properly removes the backed up “deleted” shows. The old code won’t break anything, but those folders will stick around more than the 14 day period.

I decided to upgrade the drive - twin it to the other tablo. Ran backup-tablo from root’s terminal. I get these benign messages, at first they make you nervous, then there’s no interactive “activity”.

backup-tablo --log
/usr/bin/tail: cannot open '/var/log/backup-tablo.log' for reading: No such file or directory
/bin/ls: cannot access '/media/VideoLibrary/tablo/rec': No such file or directory
/usr/bin/find: ‘/media/VideoLibrary/tablo/deleted/*’: No such file or directory 

I just created directories to tablo/ so I guess it was my fault, as the script does create them.

First time I used it, no issue (may have had those warnings). This time I’m looking at your rsync example and for some reason though I wasn’t sure. Who mounts anything it /tmp - what’s that? Source to destination generally.

I ran this command:

rsync -a --info=progress2 --no-inc-recursive /media/VideoLibrary/tablo/rec /media/tablo/rec

When I found recording not found. Via a browser, I had /pvr/rec rsync’s man page tells of the importance of the trailing / which you do show.

looking through .bash_history I found my previous command

sudo rsync -av --info=progress2 --no-inc-recursive /media/dvr/tablo/rec /media/tablo/

Because I’m moving a directory more than files. If I add /rec to the destination, wouldn’t we have to have a file spec on each? Not going to try. I just connected to drive back to the PC and dragNdrop’d eveything where it should be. backup-tablo works great, user needs work :wink:

Wow, great feedback, thanks!

I made some code changes in response to your comments. Specifically, I added an initialize function that should create the necessary directories and moved the logfile to the same path as the backups (much better than requiring write access to /var/log/). I also made comments to ensure people know to use the trailing slash on the rsync command (Even I have to look that up most times).

As far as using /tmp for the new (replacement) tablo storage drive, I think it’s perfectly fine as a mount point for temporary usage, and I’ve never had any problem with doing that. However, I understand if people would rather use /mnt or /media :wink:

All in all, I am thrilled you got it to work in the end and thanks again for taking the time to comment.

1 Like

Thanks :heavy_heart_exclamation: the readme.md covers things great.

Note, I can’t say for sure, I recall using rsync a long time ago because it tends to retain file attributes and ownership. But I was moving between drives. Since the files on the tablo device are all owned by root, don’t know if it cares, if you copy as a normal user?

Just to avoid any of it, I ran both backup-tablo and rsync as root/sudo.

I also run backup-tablo.sh as root (a very bad habit on my part :slight_smile: ), so I don’t really know if it matters to tablo or not. However, my gut feeling is that the tablo device won’t care as it runs as root, so the files would be writable anyway.

1 Like

Thanks for the backup script. I am having an issue with the timestamps. Is there anyway that the backup copy could maintain the original timestamp for directories and files?