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…

  • Dynamically rescan LUN’s on SLES

    Posted on February 24th, 2009 ashinn No comments

    I’m sure this is kids play to most people, but I’ve just not done much SAN work with Linux.

    We bought a new EMC CLARiiON CX4-240, and I was just tossing it random LUN’s to do speed & HA tests. When I added a LUN I’d see it in powermt, and I didn’t know what the equivalent of devfsadm was in Linux … SLES to be specific. What can I say, I worked with Solaris way too long.

    The first step is to run: powermt display

    # powermt display
    CLARiiON logical device count=3
    ================================================
    —– Host Bus Adapters ——— —— I/O Paths —– —— Stats ——
    ### HW Path Summary Total Dead IO/Sec Q-IOs Errors
    ================================================
    3 qla2xxx optimal 6 0 – 0 0
    4 qla2xxx optimal 6 0 – 0 0

    Note the 3/4 preceding the HBA’s.

    Now, execute this:

    # echo “- – -” > /sys/class/scsi_host/host3/scan
    # echo “- – -” > /sys/class/scsi_host/host4/scan

    Its my understand this also works on RHEL and others, but YMMV. This is all buried in the PowerPath manual too, but hopefully I’ve saved someone a bit of time.

    Till next time…