I have a disk on which CentOS is installed and running. The disk partitions look like this:
Disk /dev/sda: 42.9 GB, 42949672960 bytes 255 heads, 63 sectors/track, 5221 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System /dev/sda1 * 1 13 104391 83 Linux /dev/sda2 14 1044 8281507+ 8e Linux LVM
What I would like to do is increase the size of the second partition to be the entire disk, and then grow the logical volume(s) and the file systems on it. BTW, this is all on a VMware virtual disk, so I really can't screw things up, as I have a copy of the VMDK files and can start over again (and again, and again...). The disk was originally 8GB, and I just resized it with vmware-vdiskmanager.
I have tried to use parted to resize the partition, but I get the message "Error: Could not detect file system.", and I can't find a way to resize the partition with fdisk and sfdisk. Am I missing something obvious or is this not doable?
Thanks, Alfred
Alfred von Campe wrote:
I have a disk on which CentOS is installed and running. The disk partitions look like this:
Disk /dev/sda: 42.9 GB, 42949672960 bytes 255 heads, 63 sectors/track, 5221 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System /dev/sda1 * 1 13 104391 83 Linux /dev/sda2 14 1044 8281507+ 8e Linux LVM
What I would like to do is increase the size of the second partition to be the entire disk, and then grow the logical volume(s) and the file systems on it. BTW, this is all on a VMware virtual disk, so I really can't screw things up, as I have a copy of the VMDK files and can start over again (and again, and again...). The disk was originally 8GB, and I just resized it with vmware-vdiskmanager.
I have tried to use parted to resize the partition, but I get the message "Error: Could not detect file system.", and I can't find a way to resize the partition with fdisk and sfdisk. Am I missing something obvious or is this not doable?
I would just create an additional partition /dev/sda3 with the free space. This partition can be added to the PVS:
pvcreate /dev/sda3 vgextend VolGroup00 /dev/sda3 lvextend -L20G /dev/VolGroup00/diskname resize2fs /dev/VolGroup00/diskname 20G
Depends of course on how your volume group is named. See the man pages for details.
Don't mess with the LVM partition using parted, but you figured that one out yourself :-)
Theo
PS. If booted from a rescue disk, use lvscan to find the LVM group. Then activate the volume group by vgchange -a y
On Feb 6, 2007, at 13:03, Theo Band wrote:
I would just create an additional partition /dev/sda3 with the free space. This partition can be added to the PVS:
Of course, why didn't I think of that.
pvcreate /dev/sda3 vgextend VolGroup00 /dev/sda3 lvextend -L20G /dev/VolGroup00/diskname resize2fs /dev/VolGroup00/diskname 20G
Thanks for the recipe; this worked perfectly.
If booted from a rescue disk, use lvscan to find the LVM group.
Since the VG contained the root file system, I had to boot from a rescue disk (the CentOS 4.4 LiveCD ISO in my case) in order to do the resize2fs. But everything worked flawlessly.
Thanks again, I am up and running with the new, bigger filesystem. Now all I have left to fix is the annoying slow clock issue with running a Linux VM on a Windows host. All the documented workaround for this issue have not helped so far...
Alfred
On Tuesday 06 February 2007 21:10, Alfred von Campe wrote:
Since the VG contained the root file system, I had to boot from a rescue disk (the CentOS 4.4 LiveCD ISO in my case) in order to do the resize2fs. But everything worked flawlessly.
Just for completeness, ext2online resizes mounted filesystems just fine on Centos-4.
/Peter
On Tue, 2007-02-06 at 15:10 -0500, Alfred von Campe wrote:
On Feb 6, 2007, at 13:03, Theo Band wrote:
I would just create an additional partition /dev/sda3 with the free space. This partition can be added to the PVS:
Of course, why didn't I think of that.
pvcreate /dev/sda3 vgextend VolGroup00 /dev/sda3 lvextend -L20G /dev/VolGroup00/diskname resize2fs /dev/VolGroup00/diskname 20G
You can also use ext2online to avoid umounting the device A wiki page exists regarding lv extend : http://wiki.centos.org/TipsAndTricks/ExpandLV
Thanks for the recipe; this worked perfectly.
If booted from a rescue disk, use lvscan to find the LVM group.