Todd C. Miller
GitHub Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

LBA48 Support

Using large disks with a Series 1 TiVo

The follow assumes a working knowledge of Unix and is not for the faint of heart. That said, I’ve tried to put down the necessary details to allow people who know what they are doing to upgrade their TiVo with an LBA48 disk. If you are not an experienced Unix user you may wish to use the ISO image at There is also das Monkey’s LBA48 Guide where he shows the steps he used to upgrade his DirecTiVo.

Before we get started, one small caveat about units. I use the IEEE naming conventions to distinguish between powers of two and powers of ten. Specifically: GiB is 2^30, GB is 10^9, MiB is 2^20 and MB is 10^6. I’m not particularly found of these revisionist units but since disk manufacturers have hijacked GB to mean 10^9 I need some way to distinguish between the two types of units.

The Linux kernel that the TiVo runs (2.1.24) only supports IDE disk up to 2^28 512 byte disk blocks which comes to 128GiB (137GB) of actual space. With the availability of large, inexpensive IDE disks it would be nice to be able to use one large disk instead of two smaller ones in a TiVo. To this end I have made a patch that back-ports support for LBA48 disks to the Linux kernel that the Series1 TiVos use. It would be fairly easy to do the same for the Series2 TiVo kernel but I don’t have one of those and it is not possible to replace the kernel on a Series2 TiVo since the PROM requires that the kernel be cryptographically signed with a key from TiVo (it is possible, but non-trivial, to patch the PROM such that this check is skipped). The Series1 DirecTV TiVo combo boxes also require a signed kernel but it is possible to flash an older version of the PROM onto those machines that does not have this requirement. The TurboNet installation instructions contain info on how to flash a version of the PROM that can boot an unsigned kernel. There is also information at the DirecTV TiVo Hacking Forum. I don’t own a DirecTV TiVo myself, so I can’t help you out…

Note that using an LBA48 kernel on your TiVo means that you will have issues when a new version of the TiVo software comes out since the kernel shipped with the new software will not be able to see the entire disk which may cause serious corruption of the media filesystem the TiVo uses to store programs (I don’t have a spare large disk to try and see what will actually happen in this case). In the worst case your TiVo might end up in boat-anchor mode. Therefore, you should keep a backup of your TiVo (both before and after you upgrade to the LBA48 kernel) and be sure to do another backup before the roll-out of a new version of the TiVo software. It should be possible to catch the TiVo when it is at the pending restart stage and replace the kernel in the newly updated kernel partition but you will need to be vigilant. It’s best to have a backup in case something untoward happens.

Still here? Ok, let’s get to it! Let’s say, for example, you will be using a single 200GB disk for your TiVo. You’ll use Tiger’s mfstools to do the upgrade. You will need to run mfstool on a Linux machine that supports large IDE disks (LBA48). I’ve used both RedHat 8.0 and 9.0 for this but any version of Linux with kernel version 2.4.18 or later should work. If you are a BSD person, you should be able to run mfstool on a BSD machine under Linux emulation as long as the OS also supports IDE disks larger than 128GiB. Note that you cannot use the TiVo bootable ISO images or boot floppies that many people like to use since those do not support IDE disks larger than 128GiB. If you don’t have a Linux or BSD machine handy, you should be able to use the Knoppix “live CD”.

Once you have connected your disks to the Linux (or BSD) machine you can do the backup and restore just as you normally would. Let’s say that you have two TiVo disks connected to a separate UMDA/133 IDE card (these ship with many large IDE disks but are not actually required–LBA48 support is a driver, not hardware, issue). The two old disks are the master and slave on the first channel, /dev/hde and /dev/hdf, and the new 200GB disk is by itself on the second channel as /dev/hdg. To do a backup and restore of all streams, you might do the following:

# mfstool backup -Tao - /dev/hde /dev/hdf | \
	mfstool restore -r 4 -s 127 -pxi - /dev/hdg

This will copy all the data, expand the target drive, and give you 127MiB of swap. If you use a value greater than 127 you will have to manually create the swap partition due to a bug in mfstools. Swap partitions larger than 128MiB are not supported by TiVo’s kernel but they are by some of mine (more on this later). If you are planning to use multiple large disks that are larger than 256GiB combined, you will probably want more than 128MiB swap so that fsfix and mfscheck won’t run out of virtual memory (a rough estimate is that you need 1/2MiB for each GiB of storage space). Copying all the data streams can take a several hours to run. If you just want to test things out, you may wish to avoid copying all the data streams like so:

# mfstool backup -l 32 -so - /dev/hde /dev/hdf | \
	mfstool restore -r 4 -s 127 -pxi - /dev/hdg

Note that if you are creating an MFS partition larger than 274GiB (256GB) you must use the -r 4 option.

Ok, you now have a TiVo-bootable 200GB disk but it still has the old kernel that can’t see the entire disk. I have built a number of custom kernels with support for LBA48 and swap partitions larger than 128MiB (you will find source code patches in the hacks subdir). All that’s left is to copy the new kernel onto your TiVo disk.

Kernel copying made easy

The simplest way by far to copy kernels to and from a TiVo disk is by using my tpip utility. For example:

# tpip -o kernel.orig -k vmlinux-3.0.px /dev/hdg

will copy the old kernel from the TiVo’s primary kernel partition in the file "kernel.orig" and write the new kernel, "vmlinux-3.0.px", to the TiVo.

If you created a swap partition larger than 127MiB you will need to write a swap header to it or your TiVo will not have any swap space. You can do this by running:

# tpip -s /dev/hdg

Alternately, you can do the kernel copy and swap initialization in a single step:

# tpip -s -o kernel.orig -k kernel.vmlinux-3.0.px /dev/hdg

Kernel copying the hard way

Don’t want to use tpip? No problem! Getting the new kernel on the TiVo disk requires booting a version of Linux that has byte swapping enabled for the TiVo disk and where the kernel is capable of reading a TiVo partition table. The simplest thing to do is to boot one of the TiVo Linux boot CD or floppies that has byte-swapping turned on. Alternately, you could build a custom Linux kernel with this patch and boot with byte-swapping enable for the TiVo disk (which is what I do).

Once you have a version of Linux that can read the TiVo disk’s partition table, you are ready to install your new kernel. The TiVo disk has two kernel partitions, 3 and 6. You can use Tridge’s bootpage to print the current boot partition or, on the TiVo itself, you can run bootpage -b /dev/hdg show this info. You can, of course, simply copy the new kernel to both partitions if you don’t know which one to use. Since we’re using /dev/hdg as our new TiVo disk, we can copy the kernel to partition 6 like so:

# dd if=vmlinux-3.0.px of=/dev/hdg3
# dd if=vmlinux-3.0.px of=/dev/hdg6

If you created a swap partition larger than 128MiB, you will need to initialize via mkswap. Unfortunately, due to host byte order differences, you cannot simply run mkswap on an x86 PC (the numeric fields will be in the wrong byte order). You will either need to fetch my updated mkswap binary and run that on the TiVo itself, or build a local copy of mkswap for the x86 using this patch. The commands to run on the TiVo itself are:

# mkswap -v1 /dev/hda
# swapon -a

If mkswap complains about the -v1 flag then you are running the stock TiVo mkswap and not my updated version.

A note about version 1 swap partitions

The new-style swap header, which is necessary to utilize a swap partition larger than 128MiB, will not be recognized by the stock TiVo kernel. This is not a fatal problem (a TiVo will boot up just fine without a swap partition) but on a stand-alone TiVo with only 16MiB of memory things are pretty cramped without swap (and the indexer will be unable to run). You can verify that the TiVo has swap space available by running:

# cat /proc/meminfo

You should see something like the following:

        total:    used:    free:  shared: buffers:  cached:
Mem:  14274560 14082048   192512 82980864    69632  5275648
Swap: 314564608  3407872 311156736
MemTotal:     13940 kB
MemFree:        188 kB
MemShared:    81036 kB
Buffers:         68 kB
Cached:        5152 kB
SwapTotal:   307192 kB
SwapFree:    303864 kB

You can see from the above that I have 300MiB of swap space.

That’s it!

You should now be able to halt the machine you are using to do the upgrade and move your beefy new disk to the TiVo and have it boot.