Making all other blogs seem exciting!
RSS icon Home icon
  • ESX, Linux LVM, file system expansion and you.

    Posted on December 9th, 2009 ashinn No comments

    I see quite a few methods being used out there for logicial volume expansion. Everything from what I’m about to post all the way down to folks using cloning tools like Ghost and Clonezilla. Heres how I do it, and it works good for me. Note that I typically do these offline, for no other reason than I’ve biffed enough servers in my life to not be in a rush. If you’re needing 5-9’s uptime, look for another blog. It seems more than anything I have to expand / and so that also can play into this.

    Likely a good idea to visit the LVM man pages and/or this site if your LVM is a bit weak: read this and maybe also this.

    1. Shutdown the VM.
    2. Extend the VMDK you’re working with. You have a couple choices here. You can either extend it from the service console like so: vmkfstools -X 5G /path/to/the/vmdk (would add 5GB to that VMDK) or you can also extend it in the Virtual Infrastructure Client. If you use the service console, look at the options for vmkfstools for the exact syntax for your case.
    3. I think it goes without saying you should have backups and/or snapshots of the VM.
    4. Boot the LiveCD for your particular flavor of Linux. There are LVM LiveCD’s out there too, and also I bet a Knoppix disc might even work if in a pinch. I happen to run SLES & openSUSE pretty much exclusivly and the LiveCD’s work pretty well.
    5. Use fdisk and partition your new found space properly. Make sure you change the type to LVM (8e). If you’re not savvy with fdisk, you should likely stop now.
    6. So lets say the new partition you created is /dev/sda5. You now need to create a new physical volume, use the command: pvcreate /dev/sda5 and with any luck it’ll complete.
    7. Now you need to extend the volume group to the physical volume you just added. Use the command: vgextend *volumenamehere* /dev/sda5. Use vgdisplay if you don’t know which volume group you need to extend off the top of your head.
    8. Finally, its time to extend the logical volume itself. Use this command: lvextend -L 5GB /your/logical/volume/here. Use lvdisplay if you don’t know which LV you want to extend by heart. In this example I added 5GB to the volume. If you wanted to consume all space on the VG, you’d use something like this: lvextend -l +100%FREE /your/logical/volume/here
    9. At this point, if everything worked, you can expand the file system. On the systems I administrate we typically use XFS these days. XFS requires the filesystem to be online to grow. So while in the LiveCD you can quickly mount say /dev/system/root to /mnt and then execute xfs_growfs /mnt. Research the proper way to grow whatever file system YOU happen to use.
    10. Reboot the VM and make sure all is well.

    Till next time…

  • Manually reactivate LVM’s in Linux

    Posted on March 2nd, 2009 ashinn No comments

    I’m not sure what the deal is, but often when you boot Linux up single user you only get the root volume group activated. This could be totally normal behavior, and no big deal. When you have /usr /var and other portions of the file system broken up … it becomes a big deal.

    After looking around the lvm man page awhile, this worked for me.

    Before:

    # lvm lvscan
    Failed to find sysfs mont point
    inactive ‘/dev/var/var [7.99 GB] inherit
    ACTIVE ‘/dev/system/root [7.80 GB] inherit
    ACTIVE ‘/dev/system/swap [2.00 GB] inherit

    Execute this:

    # lvm vgsan
    # lvm vgchange -ay

    After:

    # lvm lvscan
    Failed to find sysfs mont point
    ACTIVE ‘/dev/var/var [7.99 GB] inherit
    ACTIVE ‘/dev/system/root [7.80 GB] inherit
    ACTIVE ‘/dev/system/swap [2.00 GB] inherit

    You may now mount volumes as normal for maintenance.