Expanding Disk Space on RH Server 6

Latest response

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.

Using fdisk -l this is the output I get

Disk /dev/sda: 42.9 GB, 42949672960 bytes
64 heads, 32 sectors/track, 40960 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00096aa9

Device Boot Start End Blocks Id System
/dev/sda1 * 2 501 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 502 40960 41430016 8e Linux LVM
Partition 2 does not end on cylinder boundary.

Disk /dev/sdc: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf5f60001

Device Boot Start End Blocks Id System
/dev/sdc1 1 13054 104856223+ 83 Linux

Disk /dev/sdb: 751.6 GB, 751619276800 bytes
255 heads, 63 sectors/track, 91379 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x743a16b5

Device Boot Start End Blocks Id System
/dev/sdb1 1 65270 524281243+ 83 Linux

df -h

/dev/sdb1 493G 389G 79G 84% /db1

The output of df -h as you can see /dev/sdb1/ (which is the one we want to expand)currently sits at 500GB and we just want it to see the rest of the 200GB we allocated to it.

We are on RH Enterprise 6.4

If there is any other info you need in order to assist me please let me know or if you can point me to a how-to that would be great as well.

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!

Happy to report we got the drive expanded by deleting the partition that we were going to use to expand the drive and recreating the end point.

Thanks for the help guys. Much appreciated.

Silly question: since you're using a LUN presented from the SAN, is that LUN available via redundant paths? If so, have you considered multipathd to protect your server against individual path-failures?

My guess is that the multipathing is configured at the hypervisor layer (eg. VMWare) and not exposed to the VM.

Gah. Totally spaced on noticing the VM part. We generally avoid RDMs in our virtualization environments. So, when I see direct presentation of LUNs to an OS, I assume physical. :p

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.