SUSE Support

Here When You Need Us

How to Expand a filesystem on a Multipath-Enabled LUN

This document (3129645) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Server 10

Situation

In many cases, when available LUN space is reached, and it is not desirable to restore data from backup, it is possible to offline expand a multipath-enabled LUN and resize the corresponding filesystem. This was originally tested with both ext3 and reiser filesystems directly on LUNs and on partitioned LUNs. This was later tested on xfs filesystems. This document is meant as a guideline and suggested resource for accomplishing this task.

Resolution

Of course, the existing device should be verified as multipathed. If the device has been consequently partitioned, then the following steps may be followed. However, if the device was not partitioned, and the filesystem was created on the raw device, then the partitioning steps should be skipped.

# multipath -l
36006016073c01400eee2a05e3e86dc11
[size=5 GB][features="0"][hwhandler="0"]
\_ round-robin 0 [active]
\_ 1:0:0:0 sdb 8:16 [active][ready]
\_ round-robin 0 [enabled]
\_ 1:0:1:0 sdc 8:32 [active][ready]

A note on expansion of the LUN: with most SANs, there exist multiple methods of expanding a LUN. Some use the terms 'striped' or 'concatenated'. Striping will destroy the existing filesystem! If the existing filesystem needs to be retained (and the existing data NOT restored from backup), the concatenation method should be used. This method will vary depending on SAN hardware and your SAN administrator. If a new LUN is created, please refer to TID #3000817 for instructions on dynamically adding storage for use with Multipath I/O. If an existing LUN is modified, these steps should then be followed:

Once the LUN has been expanded, it is suggested the server be restarted. If this is not possible, rescan-scsi-bus.sh can often be used to dynamically add the new LUN.  

1- Verify that the system sees the new LUN size.

# multipath -l
36006016073c01400eee2a05e3e86dc11
[size=10 GB][features="0"][hwhandler="0"]
\_ round-robin 0 [active]
\_ 1:0:0:0 sdb 8:16 [active][ready]
\_ round-robin 0 [enabled]
\_ 1:0:1:0 sdc 8:32 [active][ready]

2- The device should then be unmounted and the partition table modified. If modifying the partition table, be sure to use the exact same starting block for the extended partition as for the previously used partition. This is required for many filesystem types as the corresponding resize utility will not automatically resize the partition. However, this is NOT required if the raw device was initially used. At the very least, this should be done on the active path, and in some cases, MPIO should be completely disabled prior to making partition table changes. If partitioning is used, a reboot is required for the kernel to pick up the partition table changes.

# fdisk -l /dev/sdb

Disk /dev/sdb: 10.7 GB, 10737418240 bytes
166 heads, 62 sectors/track, 2037 cylinders
Units = cylinders of 10292 * 512 = 5269504 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 1018 5238597 83 Linux

# fdisk /dev/sdb

The number of cylinders for this disk is set to 2037.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): d
Selected partition 1

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2037, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-2037, default 2037):
Using default value 2037

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

3- Before expanding the filesystem, it should be checked and cleaned of any bad blocks or inodes.

# fsck -f /dev/sdb1
e2fsck 1.38 (30-Jun-2005)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sdb1: 40013/655360 files (0.0% non-contiguous), 93552/1309649 blocks

4- Now we're ready to resize the filesystem. Again, be sure to use the appropriate resize binary for the corresponding filesystem (ext3 or reiserfs).

# resize2fs /dev/sdb1
resize2fs 1.38 (30-Jun-2005)
Resizing the filesystem on /dev/sdb1 to 2620592 (4k) blocks.
The filesystem on /dev/sdb1 is now 2620592 blocks long.

Success!

# fdisk -l /dev/sdb

Disk /dev/sdb: 10.7 GB, 10737418240 bytes
166 heads, 62 sectors/track, 2037 cylinders
Units = cylinders of 10292 * 512 = 5269504 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 2037 10482371 83 Linux

5- Mount it up, and the system should be ready to go! A reboot or restart of MPIO may be required.

# mount /dev/disk/by-name/36006016073c01400eee2a05e3e86dc11p1 /expandme/

# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 11G 1.9G 8.2G 19% /
tmpfs 2.0G 20K 2.0G 1% /dev/shm
/dev/sda1 518M 39M 479M 8% /boot
/dev/dm-1 9.9G 286M 9.2G 3% /expandme

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:3129645
  • Creation Date: 05-Nov-2007
  • Modified Date:16-Mar-2021
    • SUSE Linux Enterprise Server

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

tick icon

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

tick icon

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

tick icon

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.