LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices



Reply
 
Search this Thread
Old 08-02-2012, 10:07 PM   #1
tauro_kpo
Member
 
Registered: Feb 2007
Distribution: Debian
Posts: 81

Rep: Reputation: 15
Question How to add unallocated space to a logical volume? using LVM


Hello folks,

This is how my 2 TB (GPT) hard disk looks like

Code:
sda1       1 MiB Bios_boot
sda2 1024 GB LVM --- vg1 1024 GB --- lv1     24 GB ext4
                                 --- lv2   1000 GB ext4
      800 GB unallocated
sda3  200 GB ext4
What is the safest or better way to add 512 GB to lv2 ?

1. Resize sda2 to be 512 GB bigger with parted or gdisk and then pvresize, lvresize, resize2fs.
2. Create a new partition in the unallocated space, initialize it as a new pv and add it to the vg, then lvresize, resize2fs.

What's the best alternative? Are there performance penalties if the 2nd option is used?

Thank you very much
 
Old 08-03-2012, 04:29 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,491

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
2.

No.
 
Old 08-04-2012, 06:13 PM   #3
deadeyes
Member
 
Registered: Aug 2006
Posts: 605

Rep: Reputation: 79
Quote:
Originally Posted by tauro_kpo View Post
Hello folks,

This is how my 2 TB (GPT) hard disk looks like

Code:
sda1       1 MiB Bios_boot
sda2 1024 GB LVM --- vg1 1024 GB --- lv1     24 GB ext4
                                 --- lv2   1000 GB ext4
      800 GB unallocated
sda3  200 GB ext4
What is the safest or better way to add 512 GB to lv2 ?

1. Resize sda2 to be 512 GB bigger with parted or gdisk and then pvresize, lvresize, resize2fs.
2. Create a new partition in the unallocated space, initialize it as a new pv and add it to the vg, then lvresize, resize2fs.

What's the best alternative? Are there performance penalties if the 2nd option is used?

Thank you very much
Actually to me this isn't clear. Maybe you still have enough space in your volume group.
Further the partition table would help in saying the best/easiest path to take.
 
Old 08-06-2012, 01:03 AM   #4
tauro_kpo
Member
 
Registered: Feb 2007
Distribution: Debian
Posts: 81

Original Poster
Rep: Reputation: 15
Question

syg00 And what if I did the method number one? Why method two is better? because it is simpler? Other people have told me that method is better so I am still in doubt.

deadeyes the disk uses a GUID partition table (GPT) and it's layout is the one I described before. All the partitions/lv are nearly full.

thanks
 
Old 08-06-2012, 01:59 AM   #5
deadeyes
Member
 
Registered: Aug 2006
Posts: 605

Rep: Reputation: 79
Quote:
Originally Posted by tauro_kpo View Post
syg00 And what if I did the method number one? Why method two is better? because it is simpler? Other people have told me that method is better so I am still in doubt.

deadeyes the disk uses a GUID partition table (GPT) and it's layout is the one I described before. All the partitions/lv are nearly full.

thanks
Method 1 is a cleaner way. Method 2 is sort of patching different PVs together.

Method 2 is the easiest one as you don't have to reboot.
For method 1 you will have to reboot if your root filesystem is residing on it. Otherwhise you might be able to force your kernel to reread the partition table with for example partprobe, kpartx, ...
Note that in RHEL 6 for example you can't force the reread at all. (there is some upstream development going on about this).
 
1 members found this post helpful.
Old 08-06-2012, 03:37 AM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,491

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
For 1) you have to manually delete the partition and reallocate it.
And get it completely correct or you risk destroying your filesystem.

2) has no such exposure, is achieved in simple steps, and is totally safe.

Your data, your choice.
 
Old 08-17-2012, 11:41 AM   #7
BradenIsSouth
LQ Newbie
 
Registered: Aug 2012
Posts: 1

Rep: Reputation: Disabled
Quote:
I have an inquiry similar to OP's.
My disk looks like this (and is a complete mess, somehow):
Code:
Number  Start   End     Size    Type      File system  Flags
 1      1049kB  913GB   913GB   primary   ntfs
 3      974GB   978GB   3585MB  extended
 5      974GB   978GB   3585MB  logical
 2      978GB   978GB   524MB   primary   ext4         boot
 4      978GB   1000GB  22.1GB  primary                lvm
1 is my Windows storage partition (this is an external hard drive from which I boot Fedora 17)
2 is GRUB
4 is the Fedora LVM
5 is a logical partition of 3, but I've not the slightest idea of the purpose of these partitions.
There is ~57GiB of unallocated space directly after the NTFS partition.

Now, how would one go about removing partition 3/5, moving 4 to the correct position and extending the LVM into unallocated space? Better yet, is this even feasible, or should I just deal with a 20GiB root filesystem?
EDIT:
3/5 was a swap partition from an old Ubuntu install, so I deleted that, formatted the ~60GiB of free space, then found a nice redhat GUI tool that let me add the partition to the LVM. Now my question is whether there are any risks with having an LVM that's discontinuous on the disk? My boot partition is now between the two LVM partitions.

Last edited by BradenIsSouth; 08-17-2012 at 11:59 AM.
 
Old 08-19-2012, 02:02 PM   #8
deadeyes
Member
 
Registered: Aug 2006
Posts: 605

Rep: Reputation: 79
Quote:
Originally Posted by BradenIsSouth View Post
EDIT:
3/5 was a swap partition from an old Ubuntu install, so I deleted that, formatted the ~60GiB of free space, then found a nice redhat GUI tool that let me add the partition to the LVM. Now my question is whether there are any risks with having an LVM that's discontinuous on the disk? My boot partition is now between the two LVM partitions.
That doesn't make a difference.
You shouldn't have any issues with that.
 
  


Reply

Tags
extend, lvm, resize


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 Mount Physical Volume/Logical Volume without a working Volume Group mpivintis Linux - Newbie 10 01-11-2014 08:02 AM
LVM free space problem after resizing the logical volume wdorninger Linux - Enterprise 0 11-06-2009 08:00 AM
Extending logical volume LogVol01 Insufficient allocatable logical exte swap space umeshsharma Linux - Newbie 4 06-22-2009 01:26 PM
LVM - Extending logical volume - Insufficient free space deim Linux - Newbie 0 04-07-2007 10:47 PM
how do I add partitions to drives that have Logical Volume (LVM) partitions? The MJ Linux - Software 5 08-17-2006 07:15 PM


All times are GMT -5. The time now is 09:07 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration