LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-19-2010, 07:11 PM   #1
MartenH
Member
 
Registered: Jul 2005
Location: Lund, Sweden
Distribution: Mandriva
Posts: 76

Rep: Reputation: 23
LVM help


Hello,

I have two drives (sde 120Gb) and sdh(250Gb) which I want to use for the following setup:

sde + 120Gb of sdh as a striped LVM as an ext4 partition
remaining 130Gb of sdh as a separate ext4 partition

I am able to use the build in partition manager in Mandriva to set up the rest of my disks and I can set up an LVM as planned above, but I find no way of choosing whether it should be linear or striped. This means I will most likely have to do it from the command line. Can someone help me out with the correct commands to set it up? Please?

PS. I'm using Mandriva 2010.
 
Old 02-19-2010, 08:56 PM   #2
ongte
Member
 
Registered: Jun 2009
Location: Penang, Malaysia
Distribution: Mageia, CentOS, Ubuntu
Posts: 468

Rep: Reputation: 72
Stripes can be defined at the creation of the LV.

For example:
Quote:
# lvcreate -i2 -I4 -L200G -n lv_striped vg00 /dev/sde /dev/sdh
Creates a striped LV named lv_striped that is striped across two PVs (/dev/sde and /dev/sdh) with stripe size 4KB and 200GB in size.
 
Old 02-20-2010, 07:20 AM   #3
MartenH
Member
 
Registered: Jul 2005
Location: Lund, Sweden
Distribution: Mandriva
Posts: 76

Original Poster
Rep: Reputation: 23
Lightbulb

Hello,

With the help of ongte and some more googling I was able to set it up as desired. Here is how I did it (as help for other users).
  1. Create Physical Volumes (Partitions, not physical drives, the name is a bit confusing.)
    Create partitions of all parts that should be included. This can be done using fdisk but I used the partition configurator in Mandriva. If you use Mandriva select Logical Disk Volume Manager as type (toggle to expert mode). If you use fdisk make sure to mark them as 0x8e (Some pages say 0xFE but that seems to be the old standard)

    For me this meant making sde as one entire partition and then an equal size partition on sdh. (The remaining space on sdh was set up as a regular ext4 partition).

  2. Register the Physical Volumes with LVM
    This is done automatically in Mandriva partitioner. Otherwise you can use the following command:
    >pvcreate /dev/sde1
    >pvcreate /dev/sdh1

  3. Create a volume group (vg0)
    This can be done in the Mandriva partitioner by selecting each partition and choosing "add to LVM". Add both to a new Volume Group named vg0.
    >vgcreate vg0 /dev/sde1
    >vgextend vg0 /dev/sdh1

    3b. Verify the volume group by issuing the command:
    >vgdisplay -v vg0

  4. Create a striped logical volume (lg0) in volume group vg0
    I was not able to figure out how to do this in Mandrivas partitioner so I used the following command:
    >lvcreate -l100%FREE -nlv0 -i2 vg0 /dev/sde1 /dev/sdh1

    -l100%FREE tells it to use the entire amount of space on the partitions. You could also read the physical Extents (PE) from the vgdisplay command and type in the total sum. Or use a lower percentage/amount.
    -nlv0 names the the Logical Volume
    -i2 tells it to stripe it across the two disks.
    vg0 is which volume group to use
    /dev/sde1 /dev/sdh1 adds the two physical volumes (partitions) to use

    Judging from ongtes comment you could also use -I to specify the stripe size. Default is 64KB which is what I have. I am not sure of the benefit of making it higher/lower. If ongte or anyone else care to comment on the choice of stripe size I'd be very happy!

  5. Verify your logical volume:
    >lvdisplay -v /dev/vg0/lv0

  6. Mount it:
    >mount /dev/vg0/lv0 /media/mountposition

Thanks to ongte and the following two pages
http://blog.fosketts.net/guides/walk...manager-linux/
http://linux.die.net/man/8/lvcreate
 
Old 02-20-2010, 08:55 AM   #4
ongte
Member
 
Registered: Jun 2009
Location: Penang, Malaysia
Distribution: Mageia, CentOS, Ubuntu
Posts: 468

Rep: Reputation: 72
Glad you've got it working. As for stripe size, that largely depends on your environment & needs.
Obviously, if you have no idea, you can't go wrong choosing something in the middle. So 64KB makes sense as the default. There's really no reason to change that unless you have very specific performance requirements.
 
Old 02-20-2010, 03:59 PM   #5
MartenH
Member
 
Registered: Jul 2005
Location: Lund, Sweden
Distribution: Mandriva
Posts: 76

Original Poster
Rep: Reputation: 23
Dang.

I thought I had it up and running. Tge lv0 was created, formatted, mounted. Added to fstab. Everything seemed fine.
...Reboot...
Now it won't work. lvdisplay for lv0 lists the lv0 but with "LV Status: NOT available".
Code:
[root@localhost]# lvdisplay
File descriptor 7 (/proc/1903/status) leaked on lvdisplay invocation. Parent PID 2873: bash
  /proc/misc: No entry for device-mapper found
  Is device-mapper driver missing from kernel?
  Failure to communicate with kernel device-mapper driver.
  --- Logical volume ---
  LV Name                /dev/vg0/lv0
  VG Name                vg0
  LV UUID                wpYl01-4J9y-Y3s8-Nt8n-oNRf-NRVs-o6BBjL
  LV Write Access        read/write
  LV Status              NOT available
  LV Size                228.98 GB
  Current LE             58618
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
Why won't it stick? Is there some change I must do to make the lv persitent after a reboot?


Additional information:
Code:
[root@localhost]# lvchange -ay lv0
File descriptor 7 (/proc/1903/status) leaked on lvchange invocation. Parent PID 2873: bash
  Volume group "lv0" not found
  Skipping volume group lv0
[root@localhost]# lvchange -ay /dev/vg0/lv0
File descriptor 7 (/proc/1903/status) leaked on lvchange invocation. Parent PID 2873: bash
  /proc/misc: No entry for device-mapper found
  Is device-mapper driver missing from kernel?
  Failure to communicate with kernel device-mapper driver.

Last edited by MartenH; 02-20-2010 at 04:08 PM.
 
Old 02-20-2010, 04:29 PM   #6
MartenH
Member
 
Registered: Jul 2005
Location: Lund, Sweden
Distribution: Mandriva
Posts: 76

Original Poster
Rep: Reputation: 23
It seems to be related to some modules not beeing loaded. Once I ran
Code:
modprobe dm_mod
modprobe dm_mirror
modprobe dm_snapshot
I could trigger lvchange -ay /dev/vg0/lv0 without a problem and remount it.

After a new reboot the modules have to manually started again. So, how can I set them up to run on startup?
 
Old 02-20-2010, 04:53 PM   #7
MartenH
Member
 
Registered: Jul 2005
Location: Lund, Sweden
Distribution: Mandriva
Posts: 76

Original Poster
Rep: Reputation: 23
Problem solved. Add the following lines to /etc/modprobe.preload
dm_mod
dm_mirror
dm_snapshot
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
lvm ontop of raid10 or combine two raid1 via lvm? okar Linux - Server 3 09-11-2009 03:37 PM
Possible to change non-LVM to LVM? darthfoolish Linux - Software 2 08-01-2008 04:47 AM
LVM and multiple iSCSI disks performance of LVM xxx_anuj_xxx Linux - Server 4 05-01-2008 01:26 PM
LXer: Managing LVM with the LVM Manager LXer Syndicated Linux News 0 03-16-2008 12:10 PM
LXer: Back Up (And Restore) LVM Partitions With LVM Snapshots LXer Syndicated Linux News 0 04-17-2007 12:16 PM


All times are GMT -5. The time now is 06:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration