Graveyard

From MythTV Book

Jump to: navigation, search

File System and Disk Layout

This content was originally in the operating system install chapter, which is now spread across four chapters: Selecting Hardware; The Easy Way: Installing MythBuntu; The Hard Way: Installing Ubuntu; and The Hard Way: Installing MythTV From Source.

Before we run the installer, we should decide what file system we are going to use for the system. A few years ago it seemed fashionable to write a journaling file system (one that doesn't require a file system check after a crash) for Linux. Quickly we went from having none to having ReiserFS, ext3, JFS, and XFS. Each file system has different properties that might lead you to choose it for a specific application.

Stewart Smith chose XFS for the following reasons:

  • Designed for large disks, files, and IO loads.
  • Robust and reliable.
  • Near raw disk performance. There is very little file system overhead—especially for large files (your TV recordings of a few gigabytes qualify as large files).
  • Fast deletes of large files (essentially instant).

There is also a full suite of utilities:

  • xfscheck and xfsrepair: In the event of corruption (unlikely due to journaling), the check and repair utilities work well.
  • xfs_bmap: This prints a list of extents that have been allocated to a file. An extent is how XFS tracks which space has been allocated to a file and is the number of the first block and a count. In an ideal situation, all files have only one extent. In reality, this often doesn’t happen. The larger the extent, the better, because disks operate best on contiguous access.
  • xfs_fsr: This stands for XFS File System Repacker. This offers online defragmentation and tries to reduce the number of extents a file uses.
  • xfsdump and xfsrestore: You can back up and restore the file system efficiently. In practice, you would never use this for the file system with your media on it (who has backup media with a few hundred gigabytes of capacity at home?). However, it’s useful for the file system with the operating system on it because if you do something silly (or the disk dies), getting your MythTV system back up and running can be easier.
  • xfs_growfs: This is the online grow_fs. If you want to expand the space used for recordings, you can plug in extra disk drives, and without having to unmount the file system (that is, while the computer is running and, for example, recording TV), you can grow the file system used for storing the recordings. This is most powerful with LVM and disks that can be hot-plugged (such as USB disks). Note that you can’t shrink an XFS file system, and this can cause problems if you ever want to do that.

As a disclaimer, Stewart used to work for Silicon Graphics, the company that made XFS. However, he was a fan and user of XFS before he joined Silicon Graphics.

Michael, however, decided to choose the more traditional ext3 because it's the file system he uses everywhere, because the performance is fine for the workload it’s being used for, because it’s easy to resize, and because he’s not as trusting of some of the newer file systems. ext3 is a good choice for root and other system file systems even if you're going to use XFS for the file system with your video files on it. One common criticism of ext3 is that it is slow to delete large files like those produced by MythTV. This is addressed in MythTV 0.20 with a Delete Large Files Slowly option that stops the user interface from locking up while waiting for the delete to finish.

Disk Layout, Logical Disks, and Meta Disks

This content was originally in the operating system install chapter, which is now spread across four chapters: Selecting Hardware; The Easy Way: Installing MythBuntu; The Hard Way: Installing Ubuntu; and The Hard Way: Installing MythTV From Source.

The LVM allows you to group physical partitions on your disks into larger logical volumes, on which you can then create a Linux file system. It can be convenient, since the simplest MythTV configuration supports only a single directory for video recording storage; however, with power comes complexity and sometimes fragility. Figure 2-1 shows a simple LVM setup.

Figure 2-1. A simple LVM setup

Here, we have three physical disks. The first disk has two partitions, only one of which is being used as an LVM physical volume. The other partition might be for the /boot file system, the root (/) file system, or a different operating system. The other two disks are being fully used as LVM physical volumes. A volume group is a group of physical volumes. You allocate space from a volume group to form logical volumes. A logical volume is where you store data. Here, we’re using all the space in the physical volume for one volume group. We could format this volume as an XFS file system and mount it as /home. In the future, we could add physical volumes to the volume group, extend the logical volume (using the lvextend program), and increase the size of the file system (using xfs_growfs).

You need to be careful, too, about what you call your LVM objects—they will end up as files and directories in /dev, and this can be confusing. Common naming schemes either prepend or append some combination of “vg” and “lv” to the names.

You can also build LVM volumes on top of RAID volumes. So, you have the flexibility of LVM along with the redundancy of RAID. If you don’t use RAID and just have LVM, you have what’s referred to as JBOD—Just a Bunch of Disks. Typically, if one of the disks in a JBOD dies, any file system that was even partly stored on that disk is gone. However, some file system repair programs (for example, xfsrepair) can “repair” a file system where one of the disks in a JBOD failed and has been replaced with another one. Typically you will lose any file whose inode (the data structure that represents a file) was stored on the lost disk, the parts of a file that were stored on the lost disk, and any directory information (filenames, although the files themselves might still exist—and be moved to the lost+found directory) that was stored on the lost disk. Running a file system repair on such a system is a “neat trick” and shouldn’t be relied on for any data you care about.

MD means multiple disk or meta disk depending on who you talk to and is the software RAID implementation for Linux. There are many different levels of RAID, some even living up to the redundant part of what RAID stands for (Redundant Array of Inexpensive Disks):

  • RAID 0 gives you no redundancy; it simply interleaves storage across two or more disks. For example, the first 4KB is stored on disk A, the second is stored on disk B, the third is stored on disk A, and so on. The purpose of RAID 0 is an increase in both read and write throughput. If either disk fails, your data is gone. This is called striping.
  • RAID 1—or mirroring—gives you full redundancy at the expense of requiring twice as much disk space. Disk A and B both have the same data. Read throughput can be higher, but write speed suffers (because of the overhead of having to send the data to

two disks). If one disk fails, you have full access to your data. If both disks fail, your data is gone.

  • RAID 5 gives you redundancy with three (or more) drives. One drive out of the three can fail, and you still have access to your data. If two (or more) drives fail, your data is gone. So you get about two-thirds space efficiency, but it does give you redundancy.

For more information about RAID, refer to the Wikipedia description at http://en.wikipedia.org/wiki/RAID. The decision about how critical your TV recordings are is of course up to you. Stewart’s answer is “not very.” If the disk holding his TV recordings dies, he’ll be annoyed, but he’s not going to cry over it. Michael, on the other hand, uses mirrored disks for all his recordings, because he often has a large backlog of video to watch because of work commitments.

However, other data might be more important than your videos—for example, your photo and music collection, first because it’s hard to redo all your holidays to take pictures again and second just because of the amount of time it can take to rip and encode large numbers of CDs. You might choose to store some of this data on a redundant system. Another alternative is to just store it on two PCs (on the MythTV box and on your desktop) and to make backups. Largely, the amount of redundancy and backup you have is going to be a function of your paranoia, faith in technology, and size of your budget.

Personal tools