Linux.com

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 rescan-scsi-bus.sh 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!

 

 

 

 

Comments

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 :(

Upcoming Linux Foundation Courses

  1. LFD331 Developing Linux Device Drivers
    25 Aug » 29 Aug - Virtual
    Details
  2. LFS422 High Availability Linux Architecture
    08 Sep » 11 Sep - Raleigh, NC
    Details
  3. LFS426 Linux Performance Tuning
    08 Sep » 11 Sep - New York
    Details

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