View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 10 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
PostPosted: Mon Feb 13, 2006 6:59 pm 
Offline
Joined: Thu May 12, 2005 9:45 pm
Posts: 95
Location: Minneapolis area
I set up LVM a while ago, using 2 drives. Now, it's time to add another drive and I'm trying to add another, but am having difficulty following the instructions again.

I did this part with no problems:
Code:
mythtv# fdisk /dev/hdc

The number of cylinders for this disk is set to 30401.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
Partition 1 is already defined.  Delete it before re-adding it.

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
root@pvr:/home/mythtv# pvcreate /dev/hdc1
  Physical volume "/dev/hdc1" successfully created
root@pvr:/home/mythtv# vgcreate vg /dev/hdc1
  /dev/vg: already exists in filesystem
root@pvr:/home/mythtv# vgdisplay vg | grep "Total PE"
  Total PE              52970
root@pvr:/home/mythtv# lvcreate -l 52970 vg -n myth
  Logical volume "myth" already exists in volume group "vg"
root@pvr:/home/mythtv# fdisk /dev/hdc[/b]

And I'm not sure how to get past this last couple errors ("/dev/vg already exists in this filesystem" and " Logical volume "myth" already exists in volume group "vg")

I don't want to mess things up and really need some advice so I don't lose all my shows recorded on the other drive.

And just to confirm. I have previously set up LVM - and included the portion of the original drive for /myth in addition to the other drive I added a while ago. Now, I'm just trying to add another drive to the existing LVM partition, without doing anything destructive to the shows that are now on the existing LVM partition.....I think that makes sense, but may have used the equivalent of double negatives in the explanation.

I do have Webmin on my KnoppMyth box as well, if that'd be easier. (again - I still don't know how to do it in Webmin, either. Actually - I did check Webmin, and it doesn't even see there's a hdc (new hard drive) added - just hda and hdb...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 13, 2006 8:07 pm 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
Two things:

1) When you originally set up the VG did you use a big enough extent size to allow for the new storage? If not you may need to set up a new VG with the new drive(s), using a size big enough for all your space, mount it temporarily, copy all the current contents over, delete the old vg, and add that space to the new one. I'm obviously glossing a few details here...

2) If you did choose a big enough extent size, then you can just use the second part of the instructions from step 12 on, where it tells you how to add the space from hda4 to the existing vg, with suitable tweaks (hda4 ->hdc1) for the partition names.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 14, 2006 12:37 am 
Offline
Joined: Thu May 12, 2005 9:45 pm
Posts: 95
Location: Minneapolis area
I guess I can't say if I
Code:
used a big enough extent size to allow for the new storage
I'm not sure what that means. I basically followed the directions on the LVM how-to. At the time I switched to LVM, I did plan on adding hard drives later, but didn't do anything that I know of ahead of time. I didn't know what size hard drive I'd get. I thought it'd just be easy to add it to the LVM.

Anyway - I followed the directions starting with step 1 and 2, then skipped to 12. Here's the output:
Code:
root@pvr:/home/mythtv# fdisk /dev/hdc

The number of cylinders for this disk is set to 30401.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): d
Selected partition 1

Command (m for help): 1
1: unknown command
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): d
No partition is defined yet!

Command (m for help): p

Disk /dev/hdc: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-30401, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-30401, default 30401):
Using default value 30401

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
pvcreate /root@pvr:/home/mythtv# pvcreate /dev/hdc1
  Physical volume "/dev/hdc1" successfully created
root@pvr:/home/mythtv# vgextend vg /dev/hdc1
  Volume group "vg" successfully extended
root@pvr:/home/mythtv# telinit 1
root@pvr:/home/mythtv# umount /dev/vg/myth
umount: /myth: device is busy
root@pvr:/home/mythtv#

Not sure how to make the device /myth not busy...I'll search the web tomorrow for that. But if someone has a quick answer, that'd be nice as well.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 14, 2006 12:57 am 
Offline
Joined: Tue Sep 27, 2005 12:32 pm
Posts: 104
You need to make sure that no program has open files on /myth. There is a command called lsof that will show you what files are open (list open files).


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 14, 2006 8:10 am 
Offline
Joined: Thu May 12, 2005 9:45 pm
Posts: 95
Location: Minneapolis area
Thanks for the help. I just waited overnight and tried it again, starting where I got the umount: /myth: device is busy
error and it worked with no problems.

Now, I'm up to
Code:
Disk Usage:
Total Space: 662,168 MB
Space Used: 418,008 MB
Space Free: 244,160 MB


Thanks again.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 14, 2006 5:16 pm 
Offline
Joined: Tue Nov 08, 2005 7:31 am
Posts: 195
Location: Secret Lair
rkhanso wrote:
I guess I can't say if I
Code:
used a big enough extent size to allow for the new storage
I'm not sure what that means. I basically followed the directions on the LVM how-to. At the time I switched to LVM, I did plan on adding hard drives later, but didn't do anything that I know of ahead of time. I didn't know what size hard drive I'd get. I thought it'd just be easy to add it to the LVM.

Step 3 from the LvMHowTo describes the physical extent requirements:
Quote:
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.

Alternate command for larger logical volume:

vgcreate -s 8M vg /dev/hdb1

So, how big was your initital logical volume? What did you specify for the PE size? If you did "-s 16M" you're all set for sizes from 512Gb (real not decimal Gb) up to 1Tb.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 1:34 am 
Offline
Joined: Thu May 12, 2005 9:45 pm
Posts: 95
Location: Minneapolis area
EvilTwin,

I don't know what I used for settings originally - I did it quite some time ago.

I don't know what the initial logical volume was/is, nor how to check it. I don't know what I used for PE size, nor how to check that. All I know is it works.

I have 3 hard drives (original 160GB, 300GB second drive and now a new 250GB third drive) and Myth sees 662GB available for recording. I will likely add another drive down the road, but don't know if I'll run into problems then...hopefully not.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 7:52 am 
Offline
Joined: Tue Nov 08, 2005 7:31 am
Posts: 195
Location: Secret Lair
You may discover that you can't access all of the current logical volume or even worse have a wrap around problem. The reason for the bigger extent size is to keep the logical "block" indices below the maximum number of bits. Better to know and research this now rather than later when it corrupts your vg.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 18, 2006 10:59 pm 
Offline
Joined: Mon Oct 10, 2005 2:00 pm
Posts: 29
That 4Mb PE -> 256Gb max LV limitation is only for LVM1. If you're using LVM2 there is no such limitation. Run "vgscan" to see whether you're using LVM1 or 2 (if you don't already know the answer).


Top
 Profile  
 
 Post subject: graphical LVM
PostPosted: Sun Feb 19, 2006 2:03 pm 
Offline
Joined: Thu Feb 02, 2006 2:11 am
Posts: 4
Location: Dunedin, New Zealand
I guess this is technically a different topic... but...

I was going through exactly the same issue yesterday (didn't think of reading here! :). Anyways, I add/remove a drive from my LVM setup sufficiently rarely that I can never remember whether I want vgscan or lvscan or vgdisplay... is it vgreduce, or vgremove... etc. etc. etc. Plus, that's for someone comfortable in linux already.

Since LVM is such a natural choice for myth, and we all use pretty much the same setup, wouldn't it be really cool to have a tiny graphical (or at least curses) program that handles the addition/removal of hard drives.

From a programming perspective, I can't imagine it being that hard except that people tend to get quite upset if a bug wipes all their data, which does raise the stakes somewhat.

A quick google finds a number of projects, an old java one, an old RH one, and a fairly new SuSE one. All of these look far too powerful. I was thinking of a script that just ran:

umount /mythtv
dd if=/dev/zero of=/dev/newdisk bs=1k count=1
pvcreate /dev/newdisk
vgextend mythtv /dev/newdisk
lvextend --size +<have to get the size from somewhere> /mythtv
resize_reiserfs (or resize2fs) /dev/mapper/mythv
mount /mythtv

Excuse errors in the above (which is kinda my point)

Corrin


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 


All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu