LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (http://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   How to add unallocated space to a logical volume? using LVM (http://www.linuxquestions.org/questions/linux-hardware-18/how-to-add-unallocated-space-to-a-logical-volume-using-lvm-4175420090/)

tauro_kpo 08-02-2012 09:07 PM

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

syg00 08-03-2012 03:29 AM

2.

No.

deadeyes 08-04-2012 05:13 PM

Quote:

Originally Posted by tauro_kpo (Post 4744595)
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.

tauro_kpo 08-06-2012 12:03 AM

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

deadeyes 08-06-2012 12:59 AM

Quote:

Originally Posted by tauro_kpo (Post 4746887)
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).

syg00 08-06-2012 02:37 AM

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.

BradenIsSouth 08-17-2012 10:41 AM

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.

deadeyes 08-19-2012 01:02 PM

Quote:

Originally Posted by BradenIsSouth (Post 4756831)
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.


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