View Full Version : Extending MFS-Tools For the TiVo Premiere (Support Thread)

08-29-2010, 03:08 PM
The attachment found in development thread post (link (http://www.dealdatabase.com/forum/showthread.php?p=308363)) includes pre-compiled executables that one can use with the 1.4 MFSLive BootDisk to backup, restore, and even expand a TiVo Premiere drive. These exectuables have limitations and are released to allow experimentation.

Some warnings about these exectuables

These are not backwards compatible with S3 and earlier drives (hence the different executable extension).
These have only been tested once with a single stock drive (other configurations including multiple drives or expanded drives have not been tested)
These executables do not handle the SQLite partition (partition 14), so one must manually delete this partition prior to backing up and must manually recreate the partition after a restore (see usage notes below).
One can expand using mfsadd to expand only by creating a "single, coallesced partition" or "uneven SOMETHING SOMETHING", this should be considered experimental.

Usage notes

Run these executables along side the normal compliment of PC-side tivo tools. They should work with any modern Linux distribution, Linux LiveCDs (or the MFSLive boot disk), a Linux Bootable USB derived from a LiveCD, etc...
Backups are best made of a stock drive configuration by first using pdisk to delete the partition 14 (the 3GB SQLite partition) and then creating a backup using -9vo (i.e. omit backing up the var partition).
When restoring one can specify "-v 3584" to make the var partition 3.5GB in size. This allows you to, later, manually divide it (again using pdisk) into partitions 9 (512MB var) and 14 (3GB SQLite) and then initialize their filesystems by hand (i.e., "mke2fs -t ext2 /dev/sdb9; mke2fs -t ext3 /dev/sdb14"). It's not necessary to save the contents of var or db (SQLite), as the TiVo will repopulate these partitions during power-up.
Expansion can be done with JMFS or using the modified provided mfsadd.s4.x86. The process I used is described here: on the mfslive forums (http://mfslive.org/forums/viewtopic.php?f=20&t=1500#p6810) Note that with either method (as both use the same underlying principle), there are still unanswered questions about the suitability of later adding (and removing external storage). Tivoapp contains the string: "TROUBLE: Partitions are supposed to come in pairs!", thus, there is reason to believe that perhaps during some level of mfscheck/fsfix might barf with a configuration like this.

run mfsadd.s4.x86 being sure to specify the "-r 4" option.
use pdisk to delete the newly created partitions 15 and 16 and create a single partition equivalent in size in their place.
hexedit the MFS superblock (found in partition 10) to remove (overwrite with zeros) "/dev/sda16" and
correct the superblock checksum (corrupted when you manually removed /dev/sda16) using "mfs_info -f"
Note that after you expand, its not possible (with the provided executables) to backup the expanded drive.

Remember: these executables are experimental, your mileage may vary, works for me, always back up your... oh, never mind about that last one ;)

01-08-2012, 04:14 AM
I hope this is the correct thread since its for support. How do you get tools like these or pdisk to work on a Debian machine? I get "cannot execute binary" when I try to run them. There must be a step I'm missing...

02-04-2012, 04:35 PM
I've been moving along but this ones has got me absolutely stumped. I compiled mfstools on a Debian machine and replaced the 4 tools with the ones from the bin folder. My tivo disk is /dev/sdc but when I try mfsinfo /dev/sdc it keeps saying hda11 isn't valid. I thought these tools changed it from hda to sdc

root@lenny:/usr/local/bin# mfsinfo /dev/sdc
mfsinfo: Unknown MFS partition device /dev/hda11

Anyway, I found someone said you can do

export MFS_HDA=/dev/sdc

but even after that I get the exact same error. Can someone nudge me over this hurdle?

I tried running the patches but for ex one is named mfstools-src_lib_volume.c.patch and I have no idea which tool to apply that patch against. I guessed to apply it against mfstools but I get nothing but failed hunk errors.

02-04-2012, 10:21 PM
I think I got past this hurdle. I didn't realize I have to begin each command with mfstools.

10-12-2012, 01:13 AM
did you make them executable? chmod 777 <executable>

10-15-2012, 05:38 PM
did you make them executable? chmod 777 <executable>
755 is preferable if it is a script. 555 is probably good if it is an executable binary. 777 means anyone can read, write, or attempt to execute it.

11-25-2012, 02:12 AM
puffdaddy, thanks for the tools and explanation. I was able to migrate all of my recordings and settings off of my stock THR-22 internal drive and onto a larger eSATA drive. The new backup and restore programs don't work for the THR-22, but this is what I was able to get working:

1. Duplicated old drive to new one using dd.
2. Booted the MFSLive CD, put your programs on an SD card so I could mount them.
3. Used your version of mfsadd.s4.x86 to add partitions 15 and 16.
4. Used pdisk to delete partitions 15 and 16 and created a new 15 with the combined size.
5. Used dd to overwrite " /dev/sda16" with null bytes in partition 10.
6. Used the MFSLive version of mfs_info -f to correct the checksum (needed to first do "export MFS_DEVICE=/dev/sda10" to get it to work.)
7. Hooked up the new drive via eSATA, rebooted the THR-22, and all was well.

Thank you so much!

11-26-2012, 08:52 AM
Thanks for the feedback and glad that the tools were of use to do a manual expansion. I don't believe that there's been much work done on the THR22's yet, and while I've not yet had a chance to play with one, from memory of what folks posted, the partition numbering was the same; however, the bootstrap/kernel/root partition triplets are absent (or replaced with an mtd partition). So that may have confused MFS-Tools, though it may well have been something else; e.g., lack of bootpage arguments).

11-26-2012, 04:24 PM
The method described in http://www.dbstalk.com/showthread.php?t=148760 supposedly also works for the THR22. I need to do this in the near future, nice to know there are choices.

12-09-2012, 01:24 PM
The method described in http://www.dbstalk.com/showthread.php?t=148760 supposedly also works for the THR22. I need to do this in the near future, nice to know there are choices.

The method in that thread works for the non-TiVo DirecTV DVRs (I've used it myself), but doesn't work on the THR22.

12-09-2012, 08:03 PM
Interesting. I was going to try this next weekend. Can you provide the detailed steps you successfully used on the THR22? I could probably figure it out from your earlier reply, but if you could give the exact commands that would be helpful. Thanks.

12-27-2012, 07:54 PM
I could really use some help with steps 4 and 5 above. I am stuck there...

01-07-2013, 07:19 PM
What sort of help are you looking for:

4. Used pdisk to delete partitions 15 and 16 and created a new 15 with the combined size.
5. Used dd to overwrite " /dev/sda16" with null bytes in partition 10.
From memory, pdisk (run from a linux PC, with the tivo drive attached as /dev/sdb) would be "pdisk /dev/sdb", once in the interactive mode, you can then do "p" or "P" to display the partition map of /dev/sdb. I think then the commands (you can always type ? for help) a "d" to delete and then 15. Then d 16. You'll want to make note of the blocks in those partitions so that you can then (after having deleted them both) create a new partition ("c", with the first block probably the default suggested by pdisk, and then the size specified as the number of blocks of 15 & 16 combined, give it a custom type "t" of MFS Partition).

For step 5, you might be better off dd'ing out the first 20k bytes of partition 10 to a file, using a hex editor to locate the /dev/sda16 string, and then overwriting it with zeros, saving the file, and then dd'ing it back to partition 10. Basically the same process, but a little more manual.

Hope this helps.

01-08-2013, 09:07 PM
What exactly do I type for the "t" argument? That's what I was stuck on. I'm also insufficiently familiar with dd to do step 5 - it's intensely arcane syntax, even for Linux.

01-09-2013, 02:34 PM
I believe that the "type" of the partition reflected in the apple partition map doesn't really matter (the tivo software won't care), but most just set the type to match what tivo (and mfs-tools) labels them, which you can see in the "-p" & "-P" outputs is "MFS" (minus the quotes).

dd is very simple and powerful, so it's worth learning your way around. For what you wish do to do (copy the first 20k or so sectors from a harddisk partition to a file, modify that file, and then copy the file back), here's how you could do it.

# dd if=/dev/sdb10 of=/path/to/dir/on/linuxPC/or/Linux/Boot/Disk/Stick/image.img bs=512 count=20k
20480+0 records in
20480+0 records out
<then edit this file with a hex editor, I think the /dev/sda16 should actually appear within the first 512byte sector>
# dd if=/paht/to/modified/image.img of=/dev/sdb10 bs=512 count=20kThe only other thing I recall having seeing folks have trouble with was the "mfs_info -f" step, for which, it's necessary to export an environmental variable to let know mfs_info that the MFS superblock lives in, say, /dev/sdb10. e.g.,

export MFS_DEVICE=/dev/sdb10

01-10-2013, 07:33 PM
Thanks - I'll give this a try when I can. I can sort-of stumble my way around Linux - I don't use it enough (except for doing software development) to know the disk tools.

11-01-2013, 05:18 AM
Thanks - I'll give this a try when I can. I can sort-of stumble my way around Linux - I don't use it enough (except for doing software development) to know the disk tools.

Steve, were you successful in upgrading your THR22's internal drive while maintaining the contents of the original drive? And yeah, I read another post of yours saying your were trying to wean your wife off of the THR22 as you'd just gotten a Genie. The one thing that keeps me with Tivo is the ability for it to record Suggestions.

Pointers to any how-tos, etc for accomplishing replacement of THR22's internal drive while maintaining original content will be appreciated.


11-01-2013, 05:20 PM
No, never succeeded. I did manage to copy the drive but not expand its capacity. I ended up just dropping the idea and stuck a 2TB drive on an HR44.

01-16-2014, 12:34 PM
Any chance that mfsadd.s4.x86 can be modded further to accomodate drives larger than 2TB and allow expansion beyond 2TB.

01-16-2014, 04:35 PM
If you're trying to expand a single premiere drive beyond 2TB, I'll have to check to see where these tools stand.

01-16-2014, 08:00 PM
That's exactly what I am doing. I have successfully expanded a 1TB XL drive to 3TB with JMFS. It fails on expanding a 2TB XL4 drive to 3TB. The modified mfsadd does not expand a 2TB XL4 image. Since the Roamio can go to 4TB, I believe the Premieres can go there as well (as long as it has the latest OS) and if the tools can address large drives.