On Dec 25, 2004, at 8:26 pm, GERALD SCHEPENS wrote:
... I just want to add another couple hundred gigs without having to totally reformat, etc.
Also, can a person take a non-LVM'd drive such as mine is currently and begin using LVM with it and another drive, again without wiping the existing disk?
This is fairly straight-forward, at least once you've done it the first time. The important thing to remember is that a logical volume looks to the filesystem as just another partition - it can be resized easily & it can span more than one physical drive, but it can be referred to as /dev/volumes/something, in the same way that conventional partitions are referred to as /dev/hda1 &c.
I haven't started building a mythtv box, yet, but presumably you have all your films in a directory such as /var/mythtv/movies or /home/mythtv. If you don't already have this as a mount point for a partition then things are a bit more involved, so let's start by assuming everything you want on LVM is already in a separate partition which you can format after you've moved it:
- First, shutdown the PC, add the new hard-drive & restart.
- Next, initialise the new drive with `pvcreate`, create & activate your logical volume group, add the new drive to it and create & format a logical volume of a suitable size & filesystem, as shown at <http://www.tldp.org/HOWTO/LVM-HOWTO/>. Once you're familiar with the concepts of physical & logical extents, chapter 11 is all you'll ever need to refer to.
- You should now be able to mount the new volume, using something like `mount /dev/volumes/movies /mnt/temp`, so `cp -aRf /path/to/movie/directory/ /mnt/temp/`
- You'll probably need to shut-down MythTV before proceeding - I always go to a single-user runlevel - and backup & edit your /etc/fstab to mount the /dev/volumes/movies at /path/to/movie/directory/. You'll need to comment out the old entry for /path/to/movie/directory/ and specify the filesystem with which you formatted the new logical volume in the new fstab entry.
- Reboot & test.
- Provided everything has gone ok you can now add the old partition to the logical volume group using `pvcreate` & `vgextend`. Then enlarge the movies volume as described as <http://www.tldp.org/HOWTO/LVM-HOWTO/extendlv.html>
It becomes a bit more of a pain if you've currently got /etc, /lib, /bin and suchlike in the same partition as your movies. If you have a partition that you'll want smaller, preserving the data, you'll have to copy everything off that partition, delete it, set up the new partition(s) / logical volumes and then copy the data into the new arrangement. I gather it's kinda tricky to get your root partition itself on LVM, so I keep /etc, /lib, /bin, /sbin and so on on a conventional partition of 6gig and then hive off only my interesting data onto logical partitions, although experts may tune finer than this.
Worst case is that you currently have something like this in /etc/fstab:
# <fs> <mountpoint> <type> <opts> <dump/pass>
/dev/hda1 /boot ext3 noauto,noatime 1 2
/dev/hda3 / reiserfs noatime 0 1
/dev/hda2 none swap sw 0 0
In this case, I'd advise booting from a liveCD to do the work - I use the Gentoo ones. I'd mirror everything over to the new hard-drive & use that as the new boot device - once that's working you can add the original drive back in as secondary & add it to the logical volumes.
So fit the new hard-drive as secondary & use `fdisk` or `cfdisk` to make a better partition layout. Don't worry about LVM just yet, just make a big separate partition for your movies at first. Something like 100meg for /boot, 500 or 1024meg for swap, a few gig for system files like /etc & /lib & the rest for /path/to/movie/directory/. Mark the smallest directory as bootable & put filesystems on the partitions.
Once you've finished fdisking you'll probably need to reboot before you can access it the new partitions.
At the liveCD shell prompt:
# mkdir /mnt/old /mnt/new
# mkdirhier /mnt/old/boot /mnt/new/boot /mnt/new/path/to/movie/directory
Mount the partions appropriately:
# mount /dev/hda3 /mnt/old
# mount /dev/hda1 /mnt/old/boot
# mount /dev/hdb3 /mnt/new
# mount /dev/hdb1 /mnt/new/boot
# mount /dev/hdb4 /mnt/new/path/to/movie/directory
Copy the files across:
# cp -Rfva /mnt/old /mnt/new
Reward yourself with a cup of tea and a cigarette whilst your drives crunch merrily. The next thing is to do stuff with grub to make the second drive bootable - I do this by removing the original hard-drive, setting the new one as master, booting from a LiveCD & chrooting in before running grub. The GRUB HOWTO is probably worth a look-see before you start. You'll also need to edit the new drive's fstab to mount the new /dev/hda4 as /path/to/movie/directory before you boot it. Once you've got the new drive booting & you're sure you're happy with it all working you can set the original drive as slave & go back to paragraph 2.
It's all a bit time-consuming, but as long as you're clear how it all works and you type carefully you'll be fine. When you've done this the once you'll be plenty confident about doing it another time. Feel free to post the output of your current `df -h` & ask for advice.
Stroller.
_______________________________________________ mythtv-users mailing list [email protected] http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
