LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 05-08-2014, 08:34 PM   #1
UltraPain
Member
 
Registered: Jun 2006
Posts: 32

Rep: Reputation: 3
Logical Volume Manager Issue


Hi all,

I added a disk (/dev/sdc) to my CentOS 6 VM. I have a physical volume group called "vg_oracle" and a logical volume that was 5GB in size called "vg_oraflash". I used fdisk to format /dev/sdc, which created /dev/sdc1. I then used this command to add the volume /dev/sdc1 to "vg_oracle":

vgextend vg_oracle /dev/sdc1

I then used this command to extend LV "vg_oraflash" by 10GB:

lvextend -L10G /dev/vg_oracle/vg_oraflash

I ran "mount -a" because I didn't see the additional space reflected, but no change. I then rebooted, but still no change. What am I missing? Any help would be greatly appreciated.

Thanks,
Dave
 
Old 05-08-2014, 09:22 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,119

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
You need to run pvcreate on /dev/sdc1 before the vgextend.
 
Old 05-08-2014, 09:42 PM   #3
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,776

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by syg00 View Post
You need to run pvcreate on /dev/sdc1 before the vgextend.
Actually, you don't. Quote from the vgextend manpage:
"If PhysicalDevicePath was not previously configured for LVM with pvcreate (8), the device will be initialized with the same default values used with pvcreate."
To the OP: You just need to expand the filesystem to fill its new container. If this was an ext2/3/4 filesystem, the command would be
Code:
resize2fs /dev/vg_oracle/vg_oraflash
It is safe to run that while the filesystem is mounted -- resize2fs will let you know if it can't do it that way.
 
1 members found this post helpful.
Old 05-08-2014, 10:01 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,119

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Hopefully that only applies to --restoremissing - else any partition (i.e. filesystem) could be erased silently.
 
Old 05-09-2014, 09:08 AM   #5
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,776

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by syg00 View Post
Hopefully that only applies to --restoremissing - else any partition (i.e. filesystem) could be erased silently.
Your hopes are hereby crushed. It will happily overwrite any filesystem that is not currently mounted, as would pvcreate (or, for that matter, mkfs, or any of a host of other commands, many of which would not bother to check whether that filesystem might be mounted).
 
Old 05-14-2014, 07:32 PM   #6
UltraPain
Member
 
Registered: Jun 2006
Posts: 32

Original Poster
Rep: Reputation: 3
Quote:
Originally Posted by rknichols View Post
Actually, you don't. Quote from the vgextend manpage:
"If PhysicalDevicePath was not previously configured for LVM with pvcreate (8), the device will be initialized with the same default values used with pvcreate."
To the OP: You just need to expand the filesystem to fill its new container. If this was an ext2/3/4 filesystem, the command would be
Code:
resize2fs /dev/vg_oracle/vg_oraflash
It is safe to run that while the filesystem is mounted -- resize2fs will let you know if it can't do it that way.
Worked like a champ - thanks!!!

[root@oem ~]# resize2fs /dev/vg_oracle/vg_oraflash
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/vg_oracle/vg_oraflash is mounted on /oraflash; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/vg_oracle/vg_oraflash to 2621440 (4k) blocks.
The filesystem on /dev/vg_oracle/vg_oraflash is now 2621440 blocks long.

[root@oem ~]# df -h
Filesystem Size Used Avail Use% Mounted on

/dev/mapper/vg_oracle-vg_oraflash
9.9G 4.7G 4.7G 50% /oraflash

I noted the error in my syntax. "lvextend -L10G" extends the volume to a total size of 10GB, NOT by a further 10GB. Nonetheless, thank you all so much for your input. Case closed
 
  


Reply



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
Logical Volume Manager phani.kandula Linux - Newbie 1 09-16-2011 09:45 AM
Logical Volume Manager at installation christopher5 SUSE / openSUSE 0 07-02-2005 10:54 PM
logical volume manager plythgam Linux - Software 1 11-08-2004 10:47 AM
Logical Volume Manager sidmark-2850 Linux - General 3 01-02-2004 01:25 PM
Logical Volume Manager Setup Breezwell Linux - Software 0 11-06-2001 01:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:26 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
Open Source Consulting | Domain Registration