Do PVRs need to be defragmented?

A question I’ve seen pop up quite often over the years, both on the forum that I run, and elsewhere, concerns disk fragmentation on PVRs. Does it matter, and how do you defragment the disk?

First, what is fragmentation? Borrowing an analogy from one of my colleagues, imagine the hard drive is a bus, and you have a load of schoolchildren, which make up the contents of a file. If the bus is empty, it’s easy for all the schoolchildren to get on the bus and sit together. And that makes it easy for a teacher to check they’re all there.

But what if the bus is already half full? Chances are that a few of the children will be able to sit together, but they’ll be spread out across the inside of the bus. And that means that if a teacher wants to check they’re all there, they have to do a fair bit of walking up and down.

That, essentially, is what happens when a computer’s hard disk becomes fragmented – the files that you save aren’t stored in one place, and instead are split into fragments. When you want to access them, the disk has to seek backwards and forwards, which is one of the slowest mechanical operations it can do, and so the file takes longer to fetch, or to save.

Fragmentation in PCs

In a PC, fragmentation can cause a massive slow-down. But it’s worth understanding why that happens, because it has a bearing on how this issue affects PVRs.

A Windows PC will typically have dozens, or hundreds of files open at the same time. You’re running lots of programs, each of which may be saving information or updating preferences, and the computer’s probably also using the hard disk as memory.

And, because very often files on a computer a quite small (by which I mean less than, say, 100 kilobytes), then the file system on a PC – that’s the way the hard drive is laid out – is designed to take account of that, and allows small pieces of space to be allocated. After all, you don’t want to lose 1MB of disk space when you save a small Word document or photo, just because that’s the smallest part that can be set aside in one go.

The downside of that is that while small files don’t take up too much empty space, large ones end up being made of many, many different pieces. As you create and delete files, you end up with lots of small gaps, and eventually files get slotted into some of those gaps. Fragmentation can become quite bad on some systems, and have a major effect upon performance.

What’s different in a PVR?

The story is rather different in a PVR, however. First, they’re not a general purpose computer, so they will typically be doing far fewer things than a PC. Being designed for a specific purpose, they can be tailored to perform well at that task.

The primary thing that’s being done with a PVR is recording and playing television. And that means big files – even a poor quality standard definition channel will use up around 900MB of disk space per hour, or 15MB per minute.

And since that’s all that users are storing on the hard drive, you can choose a way of setting up the file system that takes it into account. Instead of having to allocate disk space in small chunks, you can do it in much bigger ones. That means that even if there is fragmentation, a file will typically be split across far fewer chunks than on a PC.

With most PVRs, you’ll never be recording more than two files at a time, and possibly playing one back as well. That’s a far cry from a PC or Mac – as I write this, I have seven applications running on my Mac, and the ‘lsof’ command tells me there are 1,635 files open.

So, while a desktop computer’s hard drive may be frantically dashing backwards and forwards keeping track of all those files, the one in a PVR has a much more leisurely job.

And, as all the files are so large, when you do delete a recording, the gap it leaves will be large too – you won’t end up with lots of small pockets of space left all over the hard drive.

Different PVRs have different file systems; some do allow smaller files, like the Topfield. Some Humax models have a separate partition for those smaller JPG and MP3 files. And of course many PVRs are designed so that the operating system runs from the memory, and doesn’t have to use the hard disk for anything other than storing recordings.

Does it matter?

Now, I’m not saying that PVRs don’t become fragmented, but that it happens to a much lesser degree than with a general purpose computer. And on the whole, I don’t think it really makes a massive difference. Because of the limitations on what you’re able to do with a PVR – record two, watch one – then even when a disk is fragmented, the disk really isn’t that exercised.

Take a look at the figures I worked out for HD recordings on Freeview a couple of weeks ago. If you take the highest figure, 4GB per hour, and assume you managed to be recording two channels at that rate, while watching a recording at the same rate, that would be 12GB an hour the PVR would need to shift to and from the hard disk, or about 200MB per minute. That’s somewhere around a maximum rate of 3.5MB per second.

That’s a small fraction of the theoretical rate of many modern disks; the Western Digital units designed for AV purposes, for instance, claim rates of up to 111MB/second. Even allowing for marketing spin, and the effect of serious fragmentation, it’s easy to see that sustaining a transfer rate of 3.5MB per second really isn’t difficult for a drive at all.

So, in short, while they can become fragmented, the disks in PVRs do so to a much lesser degree than those in general purpose computers. And even the demands of HD recording and playback aren’t high enough to make it worth including a defragmentation tool in the PVR’s firmware.

3 thoughts on “Do PVRs need to be defragmented?

  1. …or XFS, both of which are journalling filesystems which protect the integrity of your files and filesystem better than FAT32. Defrag is usually an optional and unnecessary concept on these modern filesystems.

  2. Well, all the reasons you gave why PVRs don’t need disk defragment tool adds up to the fact that it would be quite easy to make (well, for someone knowing what to do). And since the files (or fragments) are large, the process shouldn’t take too much time (and what’s the hurry – you could leave it working over night). I’ve ran into quite many HDD-related problems with different PVRs.

    All in all, I think the absense of disk defragment programs in PVRs is because their manufactures do not mind them breaking down in few years – so, that people have to buy a new one… If anyone knows how to make a disk defragment TAP for Topfield – please do. Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *