Expanding Disk Space on RH Server 6
We have a VM that is hooked up with 500GB of SAN space as a RMD device. We expanded the space on the backend by 200GB but of course Liux doesn't see this space as of yet. Is there a way to expand this disk to see the rest of the 200GB of space without destroying the data that is currently on it?
Thank you
Responses
In general, RHEL only reads the disk partitioning at bootup. You can use tools like blockdev to force a reread, but that tool only works if the disk is idle. Obviously, with the root disk/volume group, it's not generally feasible to put the LUN into an idle state. That leaves you with rebooting the box to see the geometry change.
You haven't really told us much about your system - things like which RedHat point-release or how the LUN is currently managed under the active OS (e.g., are the root filesystems sitting on top of LVMs in a root volume group?). Thus, the rest of this is suggestions based on similar tasks I've executed (and making assumptions based on environments I've typically supported).
Assuming you're using LVM for the root filesystems...
Once rebooted, you can then create a new partition on the remainder of the disk, then add that partition to your root volume group (via vgextend). Once the space is seen in the root volume group, you can use lvresize and resize2fs to grow existing volumes/filesystems to consume the newly-seen space.
If you prefer that your root volume group consist of one, contiguous partition, things get trickier. Basically, you'll need to nuke the partition currently allocated to your root volume group, then reconstitute it - resetting the ending-block to the end of the disk. To do this, you typically need to boot the system off of alternate media (rescue DVD or a net-booted kernel). This should leave the root LUN in a repartitionable state. Do the repartitioning, then reboot. As part of the reboot, LVM should do a pvrescan and see that there's new free space in the root volume group. Once LVM sees the new space, you should then be able to lvextend and resize2fs any root volumes/filesystems that you want or you can create new volumes/fileystems within the LUN.
If you've any active LVMs and/or filesystems on /dev/sdb, you'll need to dismount (umount /path/to/FS) and offline the LVM(s) (lvchange -a n /dev/VGNAME/LVNAME). Once that's done, you can use the blockdev command to get the kernel to reread the device geometry. Once that's done, you can repartition the device as needed, and expand your LVs and filesystems.
Hi Allen,
Why use classical partitioning instead of LVM?
Is this an Unix migration or a migration from an old Linux server issue.
resizing a classical partition is can lead to trouble, if it is done incorrect.
Please open a Red Hat support case requesting an advise.
@Tom: If I understand the output of df -h /dev/sdb1, it is a non-LVM setup.
Kind regards,
Jan Gerrit Kootstra
Whoa. Lot more readable on browser at home. Completely missed the df output in the jumble that my browser at work showed.
Eegh. Doesn't leave a lot of options for expansion: the only option that doesn't require a "restore from backups" method is redefine the partition's end and expand the filesystem.
Does beg the question: if this is a bare SAN LUN, why isn't it at least being multi-pathed?
I always cringe when I see people do this style of resize (delete partition + recreate with different end point), but you're right on all accounts.
My approach (given the resources) would be to bring in a new LUN at the new desired size.
Configure new LUN with LVM / partition it
Mount new LUN as /db2
Copy/migrate the contents of /db1 to /db2
Remount /db2 as /db1
Remove the old /db1 LUN (/dev/sdb1)
In doing this I would also configure the new LUN with LVM, so next time this happens you can manage it more easily!
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
