View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 7 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
 Post subject: Adding a 3rd hdd to LVM
PostPosted: Fri Aug 10, 2007 2:46 am 
Offline
Joined: Tue Sep 13, 2005 10:48 am
Posts: 852
Location: London, UK
Hi,
I'm getting my test rig ready to become a full time backend. I want to take the disc I've got in my current backend (a Samsumg Spinpoint 500gb SATA hdd) and add this to the two discs I've in my test rig.
I'm fine about loosing the data - I'm going to back everything up I want to DVD, though ideally I'd preserve the information and add the disk to others and keep the data.

My test rig is currently this:
Athlon 2600+, Abit NF-S2 mobo, 512mb PC2700 Ram (soon to be 1.5G PC2700 ram) Samsung 250g PATA drive, Wstern Digital 250g SATA drive and a single DVB-t tv card.

In the initial setup of LVM, I added hda3 to sda1 using the create_lvm.sh script. Obviously I'll be adding sdb1 (a single partition on the third hdd) to something, but to what? hda3?

Thanks.

_________________
Version:R8
Intel C2D 7400, Nvidia 5600 via HDMI to Samsung B37B650TW (PAL), Asus P5QL-E mobo, 4Gb PC6400 DDR2 ram, Samsung Spinpoint 500 Gb & 1Tb drive, Nova-HD-S2 (x2)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 10, 2007 5:19 am 
Offline
Joined: Mon Feb 06, 2006 5:11 pm
Posts: 353
Location: Brisbane, Australia
Hi,

You add the physical volume to the volume group. So if you followed the wiki, you will add /dev/sdb1 to /dev/vg/myth.

BigB


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 11, 2007 1:18 am 
Offline
Joined: Tue Sep 13, 2005 10:48 am
Posts: 852
Location: London, UK
Thanks BigB,
I'm sure I looked at everything on the wiki related to LVM but must've missed it.

_________________
Version:R8
Intel C2D 7400, Nvidia 5600 via HDMI to Samsung B37B650TW (PAL), Asus P5QL-E mobo, 4Gb PC6400 DDR2 ram, Samsung Spinpoint 500 Gb & 1Tb drive, Nova-HD-S2 (x2)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 14, 2007 7:51 pm 
Offline
Joined: Sat Dec 24, 2005 11:33 am
Posts: 400
Location: Kitsap Peninsula, Wa., United States
I raised this again as I now have an issue.

I have the 3rd drive added following the Wiki article. I now show the additional space in the Physical Volume. However, I can't get it to expand the system to come up in the available File Space.

Here is what I did. I went to Step 12 adding your original disks space.
I modified that first part to cfdisk /dev/sdb (my new disk) created the partition and made it Linux LVM.

I did a vgdisplay and it showed me the new PV as the Free PV
I then did an lvextend to add the "Free PE" It now shows as having the extra 320G of space. However it is not in the Filesystem.


I tried to e2fsck -f /dev/vg/myth and it tells me it is mounted and I shouldn't do this.
The steps below that do not work.

I am thinking I forgot the pvcreate step for this new volume and even though it is adding it, the volume is incorrect.

So My question to the knowledgeable folks out here. I am searching too.

How do I remove this new disk from the group and start over?

TIA

Running R5C7 at this time, that is LVM2 I believe. Filesystem is I believe ext3 or whatever is stock there.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 14, 2007 8:38 pm 
Offline
Joined: Sun Sep 25, 2005 3:50 pm
Posts: 1013
Location: Los Angeles
BigBro, did you expand / grow the filesystem as stated in step 14?

Quote:
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)

_________________
Mike
My Hardware Profile


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 14, 2007 8:40 pm 
Offline
Joined: Wed Nov 16, 2005 8:55 pm
Posts: 1381
Location: Farmington, MI USA
bigbro wrote:
Here is what I did. I went to Step 12 adding your original disks space.
I modified that first part to cfdisk /dev/sdb (my new disk) created the partition and made it Linux LVM.
I don't believe this is necessary, and may be incorrect. From man pvcreate:
Quote:
For whole disk devices only the partition table must be erased,
which will effectively destroy all data on that disk.

All my disks in an LVM configuration have no partitions on them as I use the entire disk, which is what you appear to be trying to accomplish with /dev/sdb.

bigbro wrote:
I am thinking I forgot the pvcreate step for this new volume and even though it is adding it, the volume is incorrect.

So My question to the knowledgeable folks out here. I am searching too.

How do I remove this new disk from the group and start over?


You probably want vgreduce. It should go something like
Code:
vgreduce /dev/vg/myth /dev/sdb
WARNING: Before running vg<anything> make SURE you have backed up whatever is on your LVM!!!

bigbro wrote:
Running R5C7 at this time, that is LVM2 I believe.
man lvm should tell you which version of LVM you are using.

Given your examples, I would expect to do the following:

(If /dev/sdb is already associated with the LVM, use vgreduce to remove it now)
1 - Clear ALL partitions from /dev/sdb
2 - Stop any processes accessing the LVM
3 - Unmount the existing LVM with umount /dev/vg/myth
4 - Initialize /dev/sdb for LVM use with pvcreate /dev/sdb
5 - Add /dev/sdb to the existing LVM with vgextend /dev/vg/myth /dev/sdb
6 - Remount /dev/vg/myth to wherever you had it originally


Top
 Profile  
 
PostPosted: Tue Aug 14, 2007 10:52 pm 
Offline
Joined: Sat Dec 24, 2005 11:33 am
Posts: 400
Location: Kitsap Peninsula, Wa., United States
Mike, I tried that. I guess I didn't explain myself very well. It kept telling me the mount was busy when I tried umount. So I would telinit 1 and then I couldn't find the e2fsck or resize2fs.

I removed the new disk from the vg following SlowtoLearns instructions.
Only comment it would not let me mount /dev/sdb I had to create 1 partition as /dev/sdb1 then I could mount that. I followed the instructions again and got to the same point.

Code:
# vgdisplay
  --- Volume group ---
  VG Name               vg
  System ID
  Format                lvm2
  Metadata Areas        3
  Metadata Sequence No  10
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                3
  Act PV                3
  VG Size               887.70 GB
  PE Size               16.00 MB
  Total PE              56813
  Alloc PE / Size       37736 / 589.62 GB
  Free  PE / Size       19077 / 298.08 GB
  VG UUID               Ji8xge-AEhI-4Ktn-gp0Z-jK74-uK75-Effjp7

# lvextend -l+19077 /dev/vg/myth
  Extending logical volume myth to 887.70 GB
  Logical volume myth successfully resized


I don't have a screen shot of this portion but it would Show Free PE as "0" and Alloc PE/Size was still the above numbers.

I do need to grow the File size to the volume, that is where I was stuck before...


So... I first located the two files I am going to need /sbin/e2fsck and /sbin/resize2fs then I did telinit 1 and I could umount the vg.

Now I ran /
Code:
sbin/e2fsck -f /dev/vg/myth it reports back no errors.
myth: 7462/150944 files (4.6% non-contiguous), 91138217/154566656 blocks


Then I ran
Code:
/sbin/resize2fs /dev/vg/myth. 
Resizing the filesystem on /dev/vg/myth to 232706048 (4k) blocks.

It is resizing now which if I understand the directions "grows" the filesystem to the extent of the volume group.

Final Product:
Code:
# vgdisplay
  --- Volume group ---
  VG Name               vg
  System ID
  Format                lvm2
  Metadata Areas        3
  Metadata Sequence No  11
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                3
  Act PV                3
  VG Size               887.70 GB
  PE Size               16.00 MB
  Total PE              56813
  Alloc PE / Size       56813 / 887.70 GB
  Free  PE / Size       0 / 0
  VG UUID               Ji8xge-AEhI-4Ktn-gp0Z-jK74-uK75-Effjp7


So we got there. I mounted the vg back as myth. did a telinit 5 and restarted the mythtv-backend it all reports now.

woohoo! We solved this one.
I marked the topic solved as the first portion seemed solved as well.


Top
 Profile  
 

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


All times are UTC - 6 hours




Who is online

Users browsing this forum: Bing [Bot] and 12 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