LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 01-07-2013, 10:22 AM   #1
Lindgren
LQ Newbie
 
Registered: Jan 2013
Posts: 3

Rep: Reputation: Disabled
Question lvm volgroup not updating


Hello there!

I have a a slight issue updating and extending a lvm partition on a server which we don't want to reboot..

The thing is that this volume is shared through a SAN. The SAN part have been updated with another 25gb, but it does not show up when I run pvscan:

pvscan sends me this:
PV /dev/sda1 VG VolGroup01 lvm2 [150.00 GB / 0 free]

and it "should" now show 150.00 GB / 25.00 GB free

Apparently it shows up with no delay on m$.

What am I missing?

BR
 
Old 01-08-2013, 02:46 AM   #2
Lindgren
LQ Newbie
 
Registered: Jan 2013
Posts: 3

Original Poster
Rep: Reputation: Disabled
Just sayin, Im not that good with lvm - this might be really easy :-)
 
Old 01-08-2013, 04:31 AM   #3
Ramurd
Member
 
Registered: Mar 2009
Location: Rotterdam, the Netherlands
Distribution: Slackwarelinux
Posts: 555

Rep: Reputation: 75
You probably have the disk (/dev/sda) enlarged, but the partition table still has claimed 150 GB for /dev/sda1 (the first partition);
Somehow this partition ought to be enlarged using this new free space, so that the PV is showing the free space that can be allocated by the VG and thus LV
 
Old 01-08-2013, 06:52 AM   #4
Gr2600
LQ Newbie
 
Registered: Oct 2012
Posts: 15

Rep: Reputation: Disabled
You could try "vgchange --refresh and vg name", cannot guarantee that it will sole your problem, but it's worth a try.

If you have problems with fs space and you will need to fix it, assign new disk from sun and assign it to the vg and extend you fs's, this is the fastest way, if there is a real problem and you need to fix it quick.

Last edited by Gr2600; 01-08-2013 at 06:54 AM.
 
Old 01-10-2013, 09:14 AM   #5
Lindgren
LQ Newbie
 
Registered: Jan 2013
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Gr2600 View Post
You could try "vgchange --refresh and vg name", cannot guarantee that it will sole your problem, but it's worth a try.

If you have problems with fs space and you will need to fix it, assign new disk from sun and assign it to the vg and extend you fs's, this is the fastest way, if there is a real problem and you need to fix it quick.
Thanks for you reply!

Adding '--refresh' is not acceptable/possible with at least my version of vgchange.

Somehow I get the feeling your 'fast solution' is basically what I started up with and intended to do; we assigned new space from SAN at first, but I expected the resized space to show up when I run pvscan, but perhaps it does not work that way?
You wrote "..assign it to the vg and extend your fs.." makes me wonder, how do I assign it to the vg?

BR
 
Old 01-12-2013, 06:43 PM   #6
Gr2600
LQ Newbie
 
Registered: Oct 2012
Posts: 15

Rep: Reputation: Disabled
Wel, this is how LVM works:

PV[s] (Physical Volumes) > VG (Volume Groups) > LV (Logical Volumes) > Filesystem

After you assign the disk from SAN:

-fdisk -l (you will see your new disk here line /dev/sdax and that it contains no valid partition table
-using fdisk you will create a new partition table like:

Ex:

fdisk /dev/sdbx

Command (m for help): p

Disk /dev/sdb: 293.3 GB, 293389467648 bytes
255 heads, 63 sectors/track, 35669 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-35669, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-35669, default 35669):
Using default value 35669

Command (m for help): p

Disk /dev/sdb: 293.3 GB, 293389467648 bytes
255 heads, 63 sectors/track, 35669 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdbx 1 35669 286511211 83 Linux

while you are in fdisk do:

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

Disk /dev/sdb: 293.3 GB, 293389467648 bytes
255 heads, 63 sectors/track, 35669 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdbx 1 35669 286511211 8e Linux LVM

Command (m for help):

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

Calling ioctl() to re-read partition table.
Syncing disks.

After the disk is partitioned for LVM you need to:

pvcreate /dev/sdbx

Physical volume "/dev/sdbx" successfully created

After you creted the PV, you will need to exteng your VG:

vgextend (vg_name) /dev/sdbx

-now you can check your VG size: vgdisplay

Now you can exteng your LV and filesystem:

lvextend -L +15G /dev/vg_name/your_name_lv

resize2fs /dev/vg_name/your_name_lv

Now you can do a df -h on your filesystem to see your new size

Hope it helps
 
Old 01-14-2013, 01:35 AM   #7
Ramurd
Member
 
Registered: Mar 2009
Location: Rotterdam, the Netherlands
Distribution: Slackwarelinux
Posts: 555

Rep: Reputation: 75
Gr2600 tells you exactly what needs to be done; Excellent roundup!

Quote:
Wel, this is how LVM works:

PV[s] (Physical Volumes) > VG (Volume Groups) > LV (Logical Volumes) > Filesystem
Is almost 100% correct, with the addition that a PV is a partition.

So, you increased your physical disk. That disk contains a partition table. Currently you'll have a partition table that is not covering 100% of the disk, as it has been enlarged. So, you'll first need to update the partition table, so that it covers this new free space as well. (That's done with fdisk as Gr2600 shows; cfdisk is also possible as are other tools).

After the partition table has been updated, you'll not yet see the free space, although you should now see the free space in your VG; taking that you increased the partition that was already assigned to your PV, and thus the VG. Now that the PV is increased, you can expand the LV after which you can increase the FS (assuming you have a filesystem that supports resizing).

Just follow Gr2600's instructions and you should be set.
 
  


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
[SOLVED] LVM - I added a new partition to the WRONG Volgroup jgonzales6266 Linux - Newbie 1 06-07-2012 06:57 PM
move VolGroup-lv-home to VolGroup-lv-root dmb2002man Linux - Newbie 11 08-19-2011 09:22 AM
[SOLVED] command to add a volume in an existing LVM VolGroup x201s Linux - Newbie 3 05-25-2011 05:51 AM
Two LVM VolGroup's, same name, one is system disk - what to do? ffingers Linux - Hardware 11 05-12-2010 03:59 PM
mouting LVM. /dev/VolGroup and knoppix Tux Fedora 1 09-04-2006 11:43 PM


All times are GMT -5. The time now is 03:28 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration