Home Linux Community Community Blogs General Linux Resizing a SAN attached volume without rebooting

Resizing a SAN attached volume without rebooting

Ever needed to add some extra space to that LUN on your server, but doing so you think you might need a reboot for the server to recognise the additional space?

The following set of steps talks through what needs doing to avoid that reboot!

Firstly, I should make it clear that this article assumes that any volumes needing expansion are additional volumes and do not include the disk or volume containing the running operating system, the steps required to extend OS partition are different. Also a warning point, several of these steps carry potential risk for data loss if you are unsure or make an error, always have a backup handy before manipulating your filesystems and devices

Here is the scenario: I have a SAN-based data volume named "/my_data" which is currently 20GB in size. I need to extend this filesystem to a new size of 40GB.

My first job is to log into my SAN appliance and extend the LUN containing "/my_data", as there are many SAN vendors and technologies available I have omitted describing this step in any detail. Suffice to say in my SAN administration console I will add an additional 20GB to the LUN containing "/my_data" to make it a total of 40GB

One warning point for my current SAN is that I need to umount "/my_data" so that it is not being accessed whilst the SAN extends the LUN. Once this task is completed we are ready to move back onto our Linux Server to prepare the volume for its new space.

If we now remount "/my_data" we will see that it still shows as having still only 20GB available, for the purposes of this article the disk device we are presenting to the operating system from the SAN shows in the server logs as /dev/sdb1, and is mounted at "/my_data".

1.  mount /dev/sdb1 /my_data

2. df /my_data which shows 20GB. - Utils like fdisk at this point will also still see the old value.

3. unmount /my_data again to perform the next step.

Running scripts like will also normally fail to pick up the changes.

Next step is to type the following command into the shell, Here is the magic bit that means we dont have to reboot:

echo 1 > /sys/block/sdb/device/rescan (where sdb is your chosen disk device number).

As the command suggests this instructs the system to rescan the specified device, and check for changes.

After this operation completes using fdisk or something like YaST partition manger will reveal the extra space. However, this doesnt mean that the new space is available for use yet, the filesystem that is already on the disk needs to be told about the extra space.

You can then use GParted(Very user friendly) or your preferred partition manager to extend the extra space into partition /dev/sdb1. When this is done, re-issuing the mount command will reflect the new space, all of which was possible with no reboot!






Subscribe to Comments Feed
  • E Said:

    Hello, How do I know if a FileSystem is using SAN or Local Disk? is there a unix command I can run? df only list all of fileSystems but it does not mention which is which..thanks a lot in advance. I know it's simple question but I don't know the answer and no one I asked seems to know either :(

  • MMD Said:

    This article helped me. Thanks. Wrote a small ioscan script and saved at /usr/local/bin # cat ioscan #!/bin/bash # Disk scanner: Written by MMD : Edited 05/21/2015 # Scanning for new disks find /sys/devices -name scan -exec sh -c 'echo "- - -" > {}' \; # Re-scanning multipath disks to reflect correct disk size for DISK in `multipath -ll | grep "active ready running" | awk {'print $3'}` do for DIR1 in `find /sys/devices -name ${DISK} -type d` do find ${DIR1}/device/ -name rescan -exec sh -c 'echo 1 > {}' \; done done sleep 1 # Multipath reloading and listing if [ -x /sbin/multipath ] ; then /etc/init.d/multipathd reload ; sleep 2 ; multipath -ll else fdisk -l | grep Disk | grep -v "Disk identifier:" fi

Upcoming Linux Foundation Courses

  1. LFS201 Essentials of System Administration
    12 Jan » 30 Mar - Online Self-Paced
  2. LFD331 Developing Linux Device Drivers
    01 Jun » 05 Jun - Virtual (GUARANTEED TO RUN)
  3. LFD320 Linux Kernel Internals and Debugging
    08 Jun » 12 Jun - San Jose - CA + Virtual (GUARANTEED TO RUN)

View All Upcoming Courses

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board