Expand LUN's "online"

Is it possible to expand LUNs in 10.x while the OS is “online”?

We can do this with NetWare and Windows, but from my reading, it seems that if you expand the LUN on Suse, you need to restart the entire server, so it can see the newly sized LUN (NOT newly CREATED LUN, but an existing LUN that was dynamically made larger via the SAN or RAID controller).

then once you restarted the server, you have to unmount the device, expand the partition and then remount and reboot?

Surely that’s not the case? (would seem odd for a server OS to have to be constantly rebooted just to grow disk space in this day and age).

Hi,

If you mean expanding the file system so that it can use the new storage space assigned in the LUN where it is located,
normally it is likely. It is upon the fs type.

For example, ext3, reiser and xfs file systems can be easily extended while mounted by means of ext2online, resize_resiserfs and xfs_growfs respectively:

ext2online -v <mount-point>

resize_reiserfs -f /dev/<device-name>

xfs_growfs <mount-point>

Notice that in the case of reiser file system, the command needs the device name, not the directory where it is mounted.

Keep in mind too that if those file systems live on LVM logical volumes instead of physical ones, you will have also to extend them before doing the fs resizing running lvresize.

Word of caution: Get backups before running those commands. Even when they are stable and trusty tools, be on the safe side.
Look also to the respective man pages for more details about each command.

Regards.

Well, the only problem with that is that until the OS sees the expanded LUN, the fs won’t let you do anything with it.

LUN was 20 GB
Now it’s 30 GB

OS still sees it as a 20GB LUN, so you can’t expand it with any file system (because it sees 0 free space)

The questions were:

  1. How to get the OS to see the expanded LUN without a reboot of the server? (NetWare and Windows this is possible, but I’ve yet to find any Linux command that will do this–rescan-scsi-bus.sh only looks for NEW LUNs, not changed LUNs)

  2. Once that’s done, how to expand the fs. In this case, it would be EVMS, so I imagine I could use EVMSGUI and expand there, but until the OS sees the new space, EVMS thinks there’s no more space left to expand.

On Mon, 2008-08-25 at 12:26 +0000, kjhurni wrote:
> Well, the only problem with that is that until the OS sees the expanded
> LUN, the fs won’t let you do anything with it.
>
> LUN was 20 GB
> Now it’s 30 GB
>
> OS still sees it as a 20GB LUN, so you can’t expand it with any file
> system (because it sees 0 free space)

>From an LVM perspective is would have been better to add
the new LUN to the VG which has the LV being expanded.

So… don’t expand LUNs, expose new ones, add them to the vg
and expand. You can then expand the LV online and resize
the filesystem while still online.

This may not help you out in your case… depends on
your LVM setup… but for the future you’ll know…

>
> The questions were:
>
> 1) How to get the OS to see the expanded LUN without a reboot of the
> server? (NetWare and Windows this is possible, but I’ve yet to find any
> Linux command that will do this–rescan-scsi-bus.sh only looks for NEW
> LUNs, not changed LUNs)

> 2) Once that’s done, how to expand the fs. In this case, it would be
> EVMS, so I imagine I could use EVMSGUI and expand there, but until the
> OS sees the new space, EVMS thinks there’s no more space left to expand.
>
>

The problem with the above is that you can only have so many LUNs on any SAN. It’s generally not good practice to keep adding LUNs to expand drive space. We’ve got a Xiotech magnitude with over 40 LUNs on it. We’ve expanded those LUN’s well over 100 times in the past 4 years. If I had to create a new LUN every time I expanded, we would’ve run out of LUN space a long time ago.

IMO, this seems to be a major shortcoming in Suse Linux (or any Linux for that matter) that you have NO ability to re-scan a LUN to see the new size while the OS is online. I can’t believe that an enterprise class server OS requires a reboot just because you changed a LUN.

But apparently that seems to be the case.

echo “- - -” >/sys/class/scsi_host/host0/scan

While I get no errors with that command, it doesn’t appear to do anything.

Still sees the LUN as its original size.

Try this… (It works on SUSE)

It assumes qlogic fibre cards, I’m sure there is similar syntax for emulex cards.

you will need to check the dmesg for the result.

If you are running the ‘multipath’ daemon, it will need to be restarted (can be done live with /etc/init.d/multipathd restart).

I’m not sure what happens with “third party” mutipath drivers (e.g IBM RDAC).

You will need to put this in a ‘executable’ shell script…

#!/bin/bash
for HOST in ls /sys/class/scsi_host; do echo ‘- - -’ > /sys/class/scsi_host/$HOST/scan; done
CPATH=pwd
cd /dev
for DEVICE in ls sd[a-z] sd?[a-z]; do echo ‘1’ > /sys/block/$DEVICE/device/rescan; done
cd $CPATH

Regards
Darren

Sorry for the late reply. Just now finding this discussion. Here are my notes on how to do this. Skips step 4 & 5 if not using LVM. Skip step 3 if not using devmapper mulitpathing.

1) Must grow the disks on the SAN array first

2) Must have Linux recognize the disks with a device rescan

echo 1 > /sys/block/sdX/device/rescan

For multipath devices, find all sd?? devices corresponding to this mpath device (use ‘multipath -ll’ command), and do this rescan for all of them:

for i in sdao sdas sdaw sde
do
echo 1 > /sys/block/${i}/device/rescan
done

3) Must have device-mapper update it’s internal tables for this multipath device

multipathd -k"resize map <multipath_device>"

<multipath_device> can be “mpath14” or a dm WWID

Older versions of device-mapper-multipath require a manual table reload. See the dmsetup command (dmsetup table, dmsetup suspend, dmsetup reload, dmsetup resume).

**4) Resize the PVs
**
pvresize /dev/dm-XX

Run ‘pvs’ command before and after to see if the PV has grown.

5) Extend the logical volume

lvextend -l 100%VG -v /dev/vg01/lvol01

**6) Resize the file system
**
resize2fs /dev/vg01/lvol01

or

resize2fs /dev/mapper/mpathXX

a. command form is resize2fs <device> <size>
b. <size> can have K, M or G, or can be left out to allocate all space
c. can grow ext3 fs online
d. can shrink, but fs must be dismounted
e. command will take a long time for multi-TB file systems
f. you can watch it grow with the df -h command (once the resize command says “Performing an on-line resize…”)

I see the original poster is using EVMS. Sorry, not very familiar with EVMS. :frowning: Things will be different once step #3 is done.