KnoppMyth downloads | documentation | HowTo | reporting bugs | links | Recent Changes  
search for in the  

What is a Wiki?

See WikiWikiWeb

If you don't know how to use a wiki see the WikiHowto

ErfurtWiki is maintained by a loosely knit group of developers.

Quick Links

Related sites

Contact

Please submit website bugs in the BugReports

Contribute!

Please file any wishes on UserSuggestions.

Hosted By

MythTV 0.21 introduces a new feature called Storage Groups, which allows you to easily add new mounted drives as additional locations for recording. This takes less time to get going and doesn't have the potential problems LVM has if you lose a disk in the volume group. See StorageSpaces.

Standard Automated LVM Setup

The following standard method is recommended for first time KnoppMyth users that want to convert to LVM:

1) After installation is complete and the system reboots and you are asked for the root password, press <CTRL><ALT><F1> to switch to the first text console and login there as root.

2) Use cfdisk to create any additional partition(s). The script expects to be passed the names of exisiting partitions. It will not take raw devices.

3) Now run something like this example for R5B7 and later with PATA drives:

    create_lvm.sh /dev/hda3 /dev/hdb1
    

If you're using SATA or SCSI drives the command should look like this instead:

    create_lvm.sh /dev/sda3 /dev/sdb1
    

This will create a volume from the specified partitions. It will also modify /etc/fstab and mount the new partition. The general form of the command is create_lvm.sh followed by the list of devices (partitions) to be included in the volume group. NOTE - Prior to R5B7 this list would be different from the examples given above.

4) Umount /dev/vg/myth and format it with the filesystem of your choosing. For example:

    umount /myth
    mke2fs -j -O sparse_super -m0 -i8000000 -L myth /dev/vg/myth
    

The "ext3" file system was chosen for this example because it allows for growing and shrinking the volume without reformating and losing the contents.

5) Remount /myth

    mount /myth
    

6) Use the <CTRL><ALT><F7> key combo to return to the graphical console, enter the root password and continue installation.

7) For SCSI or SATA drives you may also need to add a line to the beginning of /etc/init.d/lvm to modprobe the correct driver so the LVM volume will mount at boot time. For example, using the Nvidia SATA driver add this:

    modprobe sata_nv >/dev/null 2>&1
    

Manual LVM setup

Here are the original manual directions (for users with existing data in /myth):

I decided to go with LVM because I have heard that it gives you greater flexibillity, such as being able to easily add or take away space from partitions or being able to add additional space to a mount from the free space on another hard drive. If you're concerned about being able to Autoupgrade KnoppMyth after using LVM, don't be. See KnoppMythUpgradeWithLVM for instructions on upgrading a KnoppMyth installation after you've changed your /myth partition to LVM.

Note: If you setting up LVM for the first time, I recommend the following: After installation is complete and the system reboots, press <CRTL><ALT><F1> when asked for the root password. Log in the terminal as root. Use cfdisk to create the additional partition(s). Now run (example): create_lvm.sh /dev/hda4 /dev/hdb1
or create_lvm.sh /dev/sda4 /dev/sdb1
This will create a volume of any partition your specify. It will also modify /etc/fstab and mount it. Then just umount /dev/vg/myth and format with the filesystem of your choosing. Remount /myth then <CTRL><ALT><F7>, enter the root password and continue installation. This script doesn't account for volumes over 255Gb. --Cecil (10-12-05)

Here are the steps I took to setup LVM on a second hard drive, which will be used entirely for /myth. As as reference I used http://tldp.org/HOWTO/LVM-HOWTO/ . Any sugestions for improving what I did would be greatly appreciated, as I only did the minimum required to set it up. The following instructions assume you have Knoppmyth R4V2 or greater set up on your primary drive (hda), and that your second drive is the slave (hdb).

Note: If your intention is to add your original non-lvm /myth partition's disk space to the volume group without losing data your new drive must be larger in size than the data stored on your original /myth partition (du -sh /myth). --DPP (09-24-06)

1. Partition the drive. The following assumes your new drive currently has no partitions set up. Also, when creating the partition, we need to make sure to change the type of the partion we create to 8e (Linux LVM).

fdisk /dev/hdb
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-19457, default 1): (press Enter for default)
Last cylinder or +size or +sizeM or +sizeK (1-19457, default 19457):
(Press Enter for default)
Command (m for help): t
Hex code (type L to list codes): 8e
Command (m for help): w

2. Initialize Disk (Creating the Physical Volume). The following command creates a volume group descriptor at the start of the partition /dev/hdb1.

pvcreate /dev/hdb1

3. Create a volume group vg (/dev/vg)

vgcreate vg /dev/hdb1

NOTES: vgcreate defaults to a physical extent (PE) size of 4MB. This default setting will only allow the creation of logical volumes with up to a maximum of 256GB. You must specify a larger size with the -s (--physicalextentsize) argument if your logical volume will be larger. The example below works for volumes up to ~500Gb, to create a bigger one simply go to the next power of 2 (16M). If you've got over 1Tb you'll have to bump it again. NOTES 2: supposedly this limitation only applies to LVM1, not the newer LVM2. See "haertig"'s comment in http://mysettopbox.tv/phpBB2/viewtopic.php?t=8481


From the LVM man pages:
If the volume group metadata uses lvm1 format, extents can vary in size from 8KB to 16GB and there is a limit of 65534 extents in each logical volume. The default of 4 MB leads to a maximum logical volume size of around 256GB.


The math on that is: 4MB X 65534 extents = 262136MB / 1024MB = 255.99GB maximum for LVM1

If the volume group metadata uses lvm2 format those restrictions do not apply, but having a large number of extents will slow down the tools but have no impact on I/O performance to the logical volume. The smallest PE is 1KB.

So if you're using LVM2, you don't necessarily have to change the extent size, but it will help the LVM tools run faster. Modern versions of Knoppmyth (I know from R5A30.2 to current, possibly earlier versions) utilize LVM2.

Alternate command for larger logical volume:

vgcreate -s 8M vg /dev/hdb1

NOTES: when I did this step, I got an error...

vgcreate -- ERROR "lvm_tab_read(): size" inserting volume group "vg" into "/etc/lvmtab"

Solved by deleting /etc/lvmtab, then using vgscan and continuing with Step 4.

4. Use vgdisplay to find the "Total PE" size to create a logical volume that uses the entire volume group. Then use the size displayed to create the logical volume named myth.

vgdisplay vg | grep "Total PE"
Total PE 4768
lvcreate -l 4768 vg -n myth

Note: In R5A9, the device-mapper is not loaded by default and so lvcreate will error. Load the device mapper (and set it to load automatically in the future) before running lvcreate. --Abelard Snazz

This is no longer needed with R5A16. - tjc

modprobe dm-mod
echo dm-mod >> /etc/modules

5. Create the ext3 filesystem for the logical volume (/dev/vg/myth) you created. I used the recommendation from the manual install section of the Knoppmyth installation instructions page.

mke2fs -j -O sparse_super -m0 -i8000000 -L myth /dev/vg/myth

6. Mount your logical volume. I chose to mount it to /mnt/hdb1 since it was already created for me. If /mnt/hdb1 does not exist, just do mkdir /mnt/hdb1 to create it.

mount /dev/vg/myth /mnt/hdb1

7. Copy over the files from /myth to /mnt/hdb1.

Optional: Check that you have enough space before copying

du -h /myth | grep /myth$
df -h | grep /dev/vg/myth

If the number in the size column of the second command is larger than the number reported by the first command you have enough space.

cp -p -r -v /myth/* /mnt/hdb1

8. Edit /etc/fstab. Comment out or change /dev/hda to /dev/vg/myth.

#/dev/hda4 /myth auto defaults,auto 0 2
/dev/vg/myth /myth auto defaults,auto 0 2

9. Set LVM to start up at boot. An lvm script is allready installed in /etc/init.d/lvm.

update-rc.d lvm start 26 S . stop 82 1 .

NOTE: If you are using LVM over firewire this will not properly load the LVM drives. Firewire depends on hotplug running which does not fire before this happens. The only fix I have found (so far) is to play with the init params of hotplug. I have run this:

update-rc.d hotplug start 40 2 . start 40 3 . start 40 4 . start 40 5 . start 25 S .

This throws tons of errors on boot, but it works in getting the firewire drives recognized beforehand. I am looking for better solutions than this, but I am just happy to find something that works.

10. Enable DMA on the additional drive(s)
You will probably want to enable DMA on the additional drive(s) in order to prevent jumpy playback:

Edit /etc/init.d/bootmisc.sh
# enable DMA
/sbin/hdparm -qd1 /dev/hda
/sbin/hdparm -qd1 /dev/hdb

11. Reboot After rebooting your box should now be using the second drive as the /myth mount.

Adding your original partition's disk space to the volume group

If you stop at Step 11 above, your original /dev/hda4 partition is now unused space. If you'd like to add it to the volume group for additional recording space, you can take the following additional steps (all done as root):

12. Reformat /dev/hda4 as Linux LVM. Basically, you redo Step 1 above but this time on /dev/hda. You first run fdisk /dev/hda, delete partition 4 (I believe the fdisk command is 'd,' it then prompts you for which partition to delete, and you enter 4), then create a new LVM partition out of the old partition 4 space by following the steps listed in Steps 1 and 2 above.

Note: If you created your initial LVM group under Knoppmyth R4 and are adding a new volume after upgrading to R5A16 you may encounter an error when you issue the pvcreate command on /dev/hda4. The issue appears to be that R4 defaulted to LVM1 and R5A16 defaults to LVM2. To resolve this you can add the "-M1" option to force the new volume to LVM1, ie:

pvcreate -M1 /dev/hda4
or
pvcreate -M2 /dev/hda4 if you are getting "Device /dev/hdx not found." messages.

Be sure to replace "/dev/hda4" with the actual partition name you are adding to your established LVM group.

13. Add the newly formatted /dev/hda4 to your volume group

vgextend vg /dev/hda4

14. Expand the filesystem to take up all the new available space. This will require that you first unmount the volume group. I did it this way which is hopefully correct--I first changed runlevel to single user, which allowed me to unmount the volume group:

telinit 1
umount /dev/vg/myth

The 'telinit 1' command may freeze the system. If it does, use the following command at a command prompt as root: --Dr. Hood

/etc/init.d/mythtv-backend stop
umount /dev/vg/myth

If it continues to say "device is busy" when you try to umount, then perhaps "mythcommflag" is active. Use "top" to see the process ID, then use "k" (while in "top") to kill the mythcommflag process.

You then use the lvextend command to extend the logical volume by the amount of space available in /dev/hda4. Type

vgdisplay

and look for the "Free PE" number before the slash. Then use that number in place of the xxxx in this command:

lvextend -l+xxxx /dev/vg/myth

Once extended you then have to increase the file system to match. If you followed the steps above, the file system is using ext3. To resize this, you would use resize2fs after running a required fsck.

e2fsck -f /dev/vg/myth
resize2fs /dev/vg/myth

Note: When resizing a JFS volume, the file system must be re-mounted.

# mount /dev/vg/myth /myth

# mount -o remount,resize /myth

See http://tldp.org/HOWTO/LVM-HOWTO/extendlv.html --MH 03-12-2006

Also, you can supposedly combine the above lvextend, resize2fs, and fsck steps above with a single command:

e2fsadm -l+xxxx /dev/vg/myth

(where xxxx is the size of the partition you're adding). Anyone confirming this can edit this section appropriately. (Yes, this does work. In fact this command is required to reduce a logical volume safely which I have written in BreakingUpLvmHowTo -- Maaltan)

15. I think you should be able to remount /dev/vg/myth at the /myth mount point, and telinit 5 to change runlevel back to where it was. But I was chicken so I just rebooted. :)

16. Don't forget to change group and ownership permissions for the newly created /myth :
chown -R mythtv /myth
chgrp -R mythtv /myth

See also http://tldp.org/HOWTO/LVM-HOWTO/recipemovevgtonewsys.html and http://tldp.org/HOWTO/LVM-HOWTO/extendlv.html

_Note: (Kevin Cosssaboon 10-10-05)_

I do not recomend XFS with LVM. I followed the above except used XFS instead of EXT3 as it faster. I added my 4 drives to the LVM each at 100%. One of the drives went bad. I could not remove the bad drive from the LVM. Without adding a newdrive.

To remove a drive you must move the contents to free space, using 'pvmove'. If all of your drives are used in the LV then you do not have anywhere to move the drive content to. If you use EXT3 you can shrink your drive using resize2fs. There is no shrink for XFS.

_Note: (Kevin Cossaboon 10-10-05)_

If you turn on WEBMIN in version R5A16 and then upgrade it using the built in WEBMIN upgrade you can add LVM to WEBMIN.

This permits graphical managment of the LVM. I did not see any way to set the PE to 8 or 16 meg. I did this manualy, but adding drives is very easy.

  1. Turn on WEBMIN
  2. Upgrade webmin
    • webmin tab -> webmin configuration -> upgrade webmin
  3. Add LVM
  4. Now Module is loaded user needs permision to use the module
    • webmin tab -> webmin users
    • Click the user you are using
    • Select the 'Logical Volume Management' (it is under hardware)
  5. Administer you LVM via the WEB!

Fixing extraneous boot time error messages

When booting after setting up LVM, you may notice a large number of error messages as the LVM driver probes every device in the system looking for VG members. To prevent this, edit the file: /etc/lvm/lvm.conf and changing the line that says:

    filter = [ "r|/dev/cdrom|" ]

To be something more specific like this:

    # Only scan hda and hdb
    filter = [ "a|/dev/hd[ab]|", "r|.*|" ]

Note: if you want to add a new physical volume to your existing lvm, be sure to add your new block device (i.e. hard drive) to the filter above. So, if you have an lvm that uses parts of or the entire hda and hdb, but you want to now add hdc to the mix, you should change the filter to:

    # Only scan hda, hdb and hdc
    filter = [ "a|/dev/hd[abc]|", "r|.*|" ]

If you do not do this, you will get an error when trying to use the pvcreate command on your new drive. -- MH 7-11-2006



UpdatedPages

· MythwebFlash last changed on Tue Sep 7 08:01:14 2010
· HauppaugeThreeFiftyInstallation last changed on Tue Sep 7 07:59:50 2010
· MythStreamTV last changed on Tue Sep 7 07:58:13 2010
· UsingSambaHowto last changed on Tue Sep 7 07:57:01 2010
· TVOverScanHowto last changed on Tue Sep 7 07:53:19 2010
· TroubleShooting last changed on Mon Sep 6 15:33:02 2010
· Links last changed on Mon Sep 6 15:31:25 2010
· KnoppMythInstall last changed on Mon Sep 6 15:29:41 2010
· HowTo last changed on Mon Sep 6 15:26:44 2010
· TinnyAudioPVR150 last changed on Mon Sep 6 14:42:38 2010
· KnoppmythDownloads last changed on Sun Sep 5 22:27:51 2010
· LinuxTips last changed on Fri Sep 3 12:44:17 2010
· RepairingMythConvergDB last changed on Wed Sep 1 01:56:32 2010
· KnoppMythWiki last changed on Sun Aug 29 14:22:57 2010
· R5A12DvdRipping last changed on Fri Aug 27 22:24:09 2010
· HVR950HowTo last changed on Mon Aug 23 11:00:20 2010
· MythVodkaHowTo last changed on Mon Aug 23 00:48:53 2010
· x11vncHowTo last changed on Tue Aug 17 08:20:17 2010
· PickingComponents last changed on Tue Aug 17 08:19:41 2010
· MediaMVP_LinuxHOWTO last changed on Tue Aug 17 08:17:10 2010
· webminhowto last changed on Tue Aug 17 08:11:10 2010
· MythTVBurn_Scripts_HowTo last changed on Mon Aug 16 15:44:19 2010
· EditThisPage last changed on Wed Aug 4 04:10:39 2010
· R5.5/R6.x Differences Table and Equivalent Commands last changed on Wed Aug 4 00:27:20 2010
· Media_Center_Edition_Remote_Control last changed on Tue Aug 3 08:19:13 2010
· kworld115HowTo last changed on Tue Aug 3 08:12:26 2010
sitemap |