+ Post New Thread
Results 1 to 5 of 5
*nix Thread, Out of disk space (LVM) in Technical; It's been an awful long time since I've ever needed to extend disk space, could someone please help me with ...
  1. #1


    Join Date
    Jan 2006
    Posts
    8,202
    Thank Post
    442
    Thanked 1,032 Times in 812 Posts
    Rep Power
    339

    Out of disk space (LVM)

    It's been an awful long time since I've ever needed to extend disk space, could someone please help me with a procedure.

    I've added the disks to the SAN, and I've resized the LUN to +1TB
    The machine "sees" the extra disk space.

    Do I now need to increase the size of the physical volume (how?), then resize the logical volume, then resize the file system or am I supposed to add another physical volume, add the new PV to the volume group and then expand the logical volume and resize the file system.
    confused...

  2. #2

    jinnantonnixx's Avatar
    Join Date
    Mar 2011
    Location
    In the Calamatorium.
    Posts
    1,935
    Thank Post
    109
    Thanked 471 Times in 324 Posts
    Blog Entries
    2
    Rep Power
    266
    You add another PV consuming the new free space, then extend the volume group by adding the new PV.

    I've done exactly this quite recently. Almost incredibly, I took notes:
    Follow them to the letter and it works just fine (from experience)

    You might want to try a modern rescue image with a modern Gparted - it might be able to add the volume groups using the nice GUI.


    Note: these notes are written for my particular systems with two drives, but you'll get the principle.




    Extending a logical volume in a virtual machine running Red Hat or Cent OS (1006371)

    Purpose
    This article provides steps for extending the root partition residing in a logical volume created with Logical Volume Manager (LVM) in a virtual machine running Red Hat/Cent OS.
    Resolution
    To extend the logical volume:

    Note: These steps only apply to EXT3 file systems.

    Caution: VMware recommends having a complete backup of the virtual machine prior making these changes.
    Power off the virtual machine.
    Edit the virtual machine settings and extend the virtual disk size. For more information, see Increasing the size of a virtual disk (1004047). Probably don’t need this as the disks can be resized with the VMWare GUI.
    Boot with a GParted image and resize the partition. If you are using a version that will cope with LVM, you can skip the following few sections about resizing partitions.
    Power on the virtual machine.
    Identify the device name, which is by default /dev/sda, and confirm the new size by running the command:
    fdisk -l
    Create a new primary partition:
    Run the command:
    # fdisk /dev/sda (sdX depending the results of the step 4)
    If you get a message about invalid partition tables, use the ‘w’ command to write the changes. Reboot and continue.
    Press p to print the partition table to identify the number of partitions. By default there are 2: sda1 and sda2.
    Press n to create a new primary partition.
    Press p for primary.
    Press 3 for the partition number, depending the output of the partition table print.
    Press Enter two times.
    Press w to write the changes to the partition table.


    Restart the virtual machine.
    Run this command to verify that the changes were saved to the partition table and that the new partition has an 83 type:
    # fdisk -l

    Run this command to convert the new partition to a physical volume:

    # pvcreate /dev/sda3

    Run this command to extend the physical volume:

    # vgextend VolGroup00 /dev/sda3

    Note: To determine which volume group to extend, use the command vgdisplay.

    Run this command to verify how many physical extents are available to the Volume Group:

    # vgdisplay VolGroup00 | grep "Free"

    If you have used a modern GParted which can cope with LVM, you can drop in at this point as GParted will have already done the groundwork of extended the logical group.

    Run the following command to extend the Logical Volume:

    # lvextend -L+#G /dev/VolGroup00/LogVol00

    Where # is the number of Free space in GB available as per the previous command.

    Note: to determine which logical volume to extend, use the command lvdisplay.

    Run the following command to expand the ext3 filesystem online, inside of the Logical Volume:

    # ext2online (or resize2fs) /dev/VolGroup00/LogVol00

    Note: Use resize2fs instead of ext2online if it is not a Red Hat virtual machine.

    Run the following command to verify that the / filesystem has the new space available:

    # df -h /
    Last edited by jinnantonnixx; 3rd December 2013 at 09:59 AM.

  3. Thanks to jinnantonnixx from:

    CyberNerd (3rd December 2013)

  4. #3

    nephilim's Avatar
    Join Date
    Nov 2008
    Location
    Dunstable
    Posts
    11,660
    Thank Post
    1,612
    Thanked 1,864 Times in 1,382 Posts
    Blog Entries
    2
    Rep Power
    400
    Those instructions should be pinned as they are less hassle than the set I have!

  5. #4

    jinnantonnixx's Avatar
    Join Date
    Mar 2011
    Location
    In the Calamatorium.
    Posts
    1,935
    Thank Post
    109
    Thanked 471 Times in 324 Posts
    Blog Entries
    2
    Rep Power
    266
    If there are any errors in those notes, please point out the corrections or clarifications needed.


    This is a good paper on LVM.

    The Linux Logical Volume Manager | Red Hat

    LVMs are extremely flexible and resizing a running machine's / volume is interesting stuff.
    Last edited by jinnantonnixx; 3rd December 2013 at 10:28 AM.

  6. #5


    Join Date
    Jan 2006
    Posts
    8,202
    Thank Post
    442
    Thanked 1,032 Times in 812 Posts
    Rep Power
    339
    Awesome, Thanks.
    I followed half of that; and decided to do a mix of the instruction above and also try and increase the size of the physical volume.
    It is a production machine so it was a bit nerve racking. Basically I deleted the partition using fdisk. Then recreated the partition. I then used pvresize and the I followed the procedure above.
    All worked out well. Disk has gone from 360GB to 1.4TB

    fdisk /dev/sdb
    delete partition
    create new partition (starting at same cylinder)
    write changes
    run pvresize /dev/sdb1
    reboot
    lvextend -L+1000G /dev/mapper/VolGroup01-LogVol00
    e2fsck -f /dev/mapper/VolGroup01-LogVol00
    resize2fs /dev/mapper/VolGroup01-LogVol00

SHARE:
+ Post New Thread

Similar Threads

  1. SCDPM Out of Disk Space
    By Gongalong in forum Enterprise Software
    Replies: 12
    Last Post: 27th March 2014, 09:40 AM
  2. Help my server thinks its run out of disk space.
    By pickman in forum Wireless Networks
    Replies: 7
    Last Post: 12th October 2007, 09:45 AM
  3. Out of drive space on domain?
    By Samson in forum Windows
    Replies: 7
    Last Post: 5th June 2007, 10:14 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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