*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 ...
3rd December 2013, 09:33 AM #1
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.
3rd December 2013, 09:52 AM #2
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)
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.
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:
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.
Thanks to jinnantonnixx from:
CyberNerd (3rd December 2013)
3rd December 2013, 09:55 AM #3
Those instructions should be pinned as they are less hassle than the set I have!
3rd December 2013, 10:24 AM #4
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.
3rd December 2013, 10:59 AM #5
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
create new partition (starting at same cylinder)
run pvresize /dev/sdb1
lvextend -L+1000G /dev/mapper/VolGroup01-LogVol00
e2fsck -f /dev/mapper/VolGroup01-LogVol00
By Gongalong in forum Enterprise Software
Last Post: 27th March 2014, 09:40 AM
By pickman in forum Wireless Networks
Last Post: 12th October 2007, 09:45 AM
By Samson in forum Windows
Last Post: 5th June 2007, 10:14 PM
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)