Page 1 of 2

LVM IDE harddisk's

Posted: Thu Jan 08, 2009 7:13 am
by pbecks1963
Hello,

I installed AMAHI (accidentaly) as a LVM-server. My 3 IDE-harddisks are now treated as one. I sort off like it though. (even though there is a risk that i loose all the data if one harddisk goes corrupt!)

I want to add a fourth IDE-harddisk to the LVM but i don't know how!

Any ideas?

Re: LVM IDE harddisk's

Posted: Sun Jan 11, 2009 7:26 pm
by cpg
Hmm, sorry, not too much LVM experience here.

LVM Howto?

Re: LVM IDE harddisk's

Posted: Thu Jan 29, 2009 4:44 am
by moredruid
as promised a quick tutorial on adding a new physical disk to an LVM
(all info is provided as-is :mrgreen:)

easy basic stuff, but still important
  • shut down your hda
  • open the case, place and connect your harddrive as per your manufacturers instructions
  • start computer, check in the BIOS that your drive is recognized properly
  • shut down your computer and close the case
  • boot your hda
now the real work
linux counts the disks this way: disk 1 is /dev/sda, disk 2 /dev/sdb, disk 3 /dev/sdc etc.
Some older distro's see IDE (PATA, not SATA) disks as /dev/hda, /dev/hdb etc.
warning: I will explain adding a 2nd harddrive and I assume the following:
- your volumegroup is called vgdata
- your logical volume is called lvdata
- you're using ext3 as your filesystem
  • login as root
  • type "fdisk -l" for a list of your partitons (optional)
  • type "fdisk /dev/sdb" => you will enter a menu
    n => create new partition
    p => make partition primary
    1 => this is the partition number
    t => this is the filesystem type, choose or type 8e for linux extended (LV)
    w => write changes to disk
  • type "pvcreate /dev/sdb1"
  • type "vgextend vgdata /dev/sdb1"
  • type "vgdisplay -v vgdata", you should see the available new space, take note how much you can add
  • type "lvextend -L +<number of GB you want to add, see notes from 1 step earlier>G /dev/vgdata/lvdata /dev/sdb1"
    example: "lvextend -L +700G /dev/vgdata/lvdata /dev/sdb1" to add 700 GB to the logical volume
  • type "resize2fs /dev/vgdata/lvdata", wait till completed
  • type "df -h", you can see that your % of space has increased
  • sit back and feel one with the universe. You are now completely zen and even though you have no idea what it is you have just done you have a certain sense of accomplishment.
  • (optional) invite me to your BBQ

Re: LVM IDE harddisk's

Posted: Thu Jan 29, 2009 11:38 am
by pbecks1963
Hello Moredruid,

I get this error...

[root@localhost ~]# lvextend -L +40G /dev/vgdata/lvdata /dev/sdb1
Volume group "vgdata" not found
Volume group vgdata doesn't exist

?

ps: i am adding a 40 Gb harddrive (sdb)

Re: LVM IDE harddisk's

Posted: Thu Jan 29, 2009 11:51 am
by moredruid
you should note that I assume your volumegroup is called "vgdata" and your logical volume is called "lvdata"

the defaults in Fedora are different from this, since you didn't set up the LVM by hand I think you have the default setup.

the default name for the volume group is: Volgroup00
the default name for the logical volume is: LogVol00

you can substitute the vgdata & lvdata with those.
your command would be like this:

Code: Select all

lvextend -L +40G /dev/VolGroup00/LogVol00 /dev/sdb1

Re: LVM IDE harddisk's

Posted: Thu Jan 29, 2009 12:23 pm
by pbecks1963
[root@localhost ~]# lvextend -L +40G /dev/VolGroup00/LogVol00 /dev/sdb1
Physical Volume "/dev/sdb1" not found in Volume Group "VolGroup00"

Re: LVM IDE harddisk's

Posted: Thu Jan 29, 2009 12:28 pm
by moredruid
you've added /dev/sdb1 to volumegroup vgdata first.
you should run "vgremove vgdata"
then run "vgextend VolGroup00 /dev/sdb1"
then proceed with the lv-command

Re: LVM IDE harddisk's

Posted: Thu Jan 29, 2009 12:48 pm
by pbecks1963
[root@localhost ~]# vgremove vgdata
Volume group "vgdata" not found
[root@localhost ~]

Re: LVM IDE harddisk's

Posted: Thu Jan 29, 2009 12:50 pm
by moredruid
and just vgextend VolGroup00 /dev/sdb1 ?

Re: LVM IDE harddisk's

Posted: Thu Jan 29, 2009 1:19 pm
by pbecks1963
my hda just died on me.... No display on the monitor??? I had to shut it down by holding down the power off button. I restarted the server and everything seems to be ok.


What do you suggest i do now? (haven't done your last tip)