Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Extending a volume group with currently unallocated space?

  1. #1
    Join Date
    Jun 2009
    Location
    Finland
    Posts
    5

    Default Extending a volume group with currently unallocated space?

    Hello,

    I installed OpenSuse 11.0 late last year and I left little less than half of my drive unallocated. The idea was to install Windows Vista there later. However, I installed Vista to VirtualBox and it seems to work well enough there so I don't think I will proceed with a "native" install for now anyway.

    Since half of the drive is now unused I would like to reclaim this unallocated space to Linux. I'm using LVM and assuming that it can be done.

    Before I start playing around with the partitioning tools, I would be grateful if someone could have a look at my "plan" as there is a good chance of wiping everything and I've never done this before.

    My current partition table as listed by fdisk -l is as follows:

    Code:
    Device      Boot      Start    End         Blocks   Id  System
    /dev/sda1   *           1       9           72261   83  Linux
    /dev/sda2              10   71807       576717435   8e  Linux LVM
    I was thinking of the following:

    1) Create a new partition starting from 71708 to the end of the drive

    2) Initialize the partition for use by LVM (YaST2 or pvcreate directly)

    3) Extend the existing volume group with the physical volume (partition) created in step 1 using vgextend, if not possible using YaST2 (LVM Configuration / Add Volume?)

    4) Adjust the logical volumes as necessary so that the new space is used.

    Hopefully I'm not totally off the track - this is my first Linux installation with LVM.

    Help is greatly appreciated,

    nissu

  2. #2
    Join Date
    Jun 2008
    Location
    West Yorkshire, UK
    Posts
    3,611

    Default Re: Extending a volume group with currently unallocated spac

    I'm slightly puzzled as to what you are trying to do; normally you create a Volume Group containing certain physical disks; you then create logical volumes within that group.

    Are you saying that you have a Volume Group within which you have only created logical volumes for part of the Volume Group? If so, there shouldn't be a problem in creating more logical volumes within that Volume Group.

  3. #3
    Join Date
    Jun 2009
    Location
    Finland
    Posts
    5

    Default Re: Extending a volume group with currently unallocated spac

    Quote Originally Posted by john_hudson View Post
    I'm slightly puzzled as to what you are trying to do; normally you create a Volume Group containing certain physical disks; you then create logical volumes within that group.

    Are you saying that you have a Volume Group within which you have only created logical volumes for part of the Volume Group? If so, there shouldn't be a problem in creating more logical volumes within that Volume Group.
    Ok, I'm trying to clarify my question a bit.

    I have a one terabyte drive, of which I have partitioned only 550 gigabytes. I have one volume group (550 gigabytes), inside which I have logical volumes. The logical volumes fill up all the available space in the volume group, i.e. 550 gigabytes.

    Almost half of my hard drive is now totally unused and unpartitioned, because I thought I would install Vista there later, which I'm not going to do.

    I would like to know if there is any (easy) way to make the unused half accessible, preferably so that in the end I could just extend the logical volume for /home.

  4. #4
    Join Date
    Jun 2008
    Location
    West Yorkshire, UK
    Posts
    3,611

    Default Re: Extending a volume group with currently unallocated spac

    I have never done this so this is based on theory; normally a Volume Group is defined by the UUIDs that it contains. If you did it that way, you presumably gave a UUID to that part of the disk that was not in the Volume Group.

    Can you identify each part of your system by UUID and identify which UUID relates to the Volume Group?

  5. #5
    Join Date
    Jun 2009
    Location
    Finland
    Posts
    5

    Default Re: Extending a volume group with currently unallocated spac

    Quote Originally Posted by john_hudson View Post
    I have never done this so this is based on theory; normally a Volume Group is defined by the UUIDs that it contains. If you did it that way, you presumably gave a UUID to that part of the disk that was not in the Volume Group.

    Can you identify each part of your system by UUID and identify which UUID relates to the Volume Group?
    This is what I was able to gather using lvm:
    Code:
    # lvm vgdisplay
      --- Volume group ---
      VG Name               system
      System ID
      Format                lvm2
      Metadata Areas        1
      Metadata Sequence No  4
      VG Access             read/write
      VG Status             resizable
      MAX LV                0
      Cur LV                3
      Open LV               3
      Max PV                0
      Cur PV                1
      Act PV                1
      VG Size               550.00 GB
      PE Size               4.00 MB
      Total PE              140800
      Alloc PE / Size       140800 / 550.00 GB
      Free  PE / Size       0 / 0
      VG UUID               6i5IGK-fCoB-g2rh-5352-Z137-Qvaz-65pd3Z
    Code:
    # lvm pvdisplay
      --- Physical volume ---
      PV Name               /dev/sda2
      VG Name               system
      PV Size               550.00 GB / not usable 635.00 KB
      Allocatable           yes (but full)
      PE Size (KByte)       4096
      Total PE              140800
      Free PE               0
      Allocated PE          140800
      PV UUID               Nd1SjI-pbEk-K04U-26mJ-NB8w-d4Ne-S059Bj
    I just realised that I could install OpenSUSE into VirtualBox, create a similar lvm scheme (i.e. leave half of the hard drive unused) and experiment safely with the lvm tools there.

  6. #6
    Join Date
    Jun 2008
    Location
    West Yorkshire, UK
    Posts
    3,611

    Default Re: Extending a volume group with currently unallocated spac

    My interpretation of that information is that the issue is what in the old days was called block size. The PE size is 4Mb and the maximum number have been allocated on the disk.

    One reason for partitioning physical disks used to be to keep block size down to avoid wasting space particularly with short files.

    I presume as physical disk sizes get larger, it will once more be advantageous to partition them to use the space more efficiently.

  7. #7
    Join Date
    Jun 2009
    Location
    Finland
    Posts
    5

    Default Re: Extending a volume group with currently unallocated spac

    Quote Originally Posted by john_hudson View Post
    My interpretation of that information is that the issue is what in the old days was called block size. The PE size is 4Mb and the maximum number have been allocated on the disk.
    Hmm, I don't know. I'm quite sure I have lots of unpartitioned space on my drive

    Have a look at the image below:


  8. #8
    Join Date
    Jun 2009
    Location
    Finland
    Posts
    5

    Default Re: Extending a volume group with currently unallocated spac

    Quote Originally Posted by nissu View Post
    I just realised that I could install OpenSUSE into VirtualBox, create a similar lvm scheme (i.e. leave half of the hard drive unused) and experiment safely with the lvm tools there.
    I had a go at this. I installed OpenSUSE 11.0 into VirtualBox with a 40 gigabyte virtual disk. I left about half of it unpartitioned, just like I've done on my real physical hard drive.

    This was the starting point after installation:



    As you can see, the drive is not used after cylinder 3000.

    I started the system in repair mode using the installation CD, fiddled with Expert Partitioner, i.e. added a new partition with the type Linux LVM, added that to my volume group, extended existing logical volumes to use all available space and ended up with this:



    The above is what I wanted. I had to increase swap to 3 gigs, because otherwise the tool claimed that you have no swap, even though it was listed.

    Clicking Next at this point offered a quite weird description of what the tool was about to do:



    Not surprisingly I ended up with a system which didn't boot anymore. I reverted back to a working snapshot of the virtual machine and tried again.

    On the next attempt I did everything in small steps, i.e. created the new partition, selected Next in Expert Partitioner, accepted the confirmation and then added the physical volume to volume group, again selecting Next in Expert Partitioner, and so on. This time the orange confirmation boxes started to make sense. Create a new partition xxx? Extend existing volume group? No complaints about missing swap either.

    It seems that the virtual machine installation works fine now and all of the virtual drive is utilised. I'm not going to try this on my real installation without backups though..

    Thanks for your time John - it could be that I was not able to describe properly what I wanted to achieve, but it seems to be doable, although you have to be very careful with the Expert Partitioner.

  9. #9

    Default Re: Extending a volume group with currently unallocated spac

    it's a little bit tricky to extend a VG but it works (for me) like this:
    Create a new VG on the partition(s) you want to add, do NOT add any LV to this group.
    open a terminal session and merge this new group with the existing group (vgmerge -v (-t) existing new) see man pages for vgmerge and lvm
    unmount the VG
    with the YAST partitioner or from a command line (vgresize or so, see man page lvm) resize the VG to it's new size and mount it again.
    If you can not unmount the partition because it's /usr or so, do this procedure from a live CD. You can download a live CD from opensuse.org

    With this method i could expand my /usr and /home partitions with left over space from an old Windows installation :-) .

    have fun and sorry 4 bad english ;-)
    Arthur

  10. #10

    Default Re: Extending a volume group with currently unallocated space?

    I hear what you are asking and I am attempting to do the same thing right now..
    Have you ever received or learned how to do what you were/are seeking?

    The difference is I do not have any of the 4 partitions remaining to create a new partition.
    What I see I have to do is, extend the existing partition (sd4) onto the unused disk space.
    I do not see a way using 'fdisk) to extend the end of an existing partition.
    So I believe I may delete the partition as long as I recreate it using the exact START value
    and the new END Value. (I did this and was able to mount my filesystem!! phew) BUT
    the Volume group still believes the VG is 550GB not the 1TB, so somehow I need to extend the
    VG or tell the VG the disk it resides on is 1TB not 550GB.. (How I do not know), and next
    I would extend the LV and the FS withint the LV..

    (AIX can do this, dynamically with a command... but why would I expect LVM to work the same
    on Linux? sarcasitcally rhetorical)


    Quote Originally Posted by nissu View Post
    Hello,

    I installed OpenSuse 11.0 late last year and I left little less than half of my drive unallocated. The idea was to install Windows Vista there later. However, I installed Vista to VirtualBox and it seems to work well enough there so I don't think I will proceed with a "native" install for now anyway.

    Since half of the drive is now unused I would like to reclaim this unallocated space to Linux. I'm using LVM and assuming that it can be done.

    Before I start playing around with the partitioning tools, I would be grateful if someone could have a look at my "plan" as there is a good chance of wiping everything and I've never done this before.

    My current partition table as listed by fdisk -l is as follows:

    Code:
    Device      Boot      Start    End         Blocks   Id  System
    /dev/sda1   *           1       9           72261   83  Linux
    /dev/sda2              10   71807       576717435   8e  Linux LVM
    I was thinking of the following:

    1) Create a new partition starting from 71708 to the end of the drive

    2) Initialize the partition for use by LVM (YaST2 or pvcreate directly)

    3) Extend the existing volume group with the physical volume (partition) created in step 1 using vgextend, if not possible using YaST2 (LVM Configuration / Add Volume?)

    4) Adjust the logical volumes as necessary so that the new space is used.

    Hopefully I'm not totally off the track - this is my first Linux installation with LVM.

    Help is greatly appreciated,

    nissu

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •