Skip to contentSkip to conversation

LUN resizing

DISCUSSION Stefan Voelkel 4 participants 9 messages Nov 25, 2003 – Nov 28, 2003 SCSI

lore
Share & tools
lore
#0 lore raw

Hello,

a hypothetical question:

I have a Linux box connected to a Fibre SAN. Now I'd like to resize one LUN and tell my Linux box what happened. In other words can I _live_ resize a SCSI disk?

[ let's not talk about which filesystems are capable of live resizing :) ]

* Is this possible at all, eg does the SCSI Standard include something to enable a device to tell the host about the changed geometry (SENSE DATA, ...) ?
* Is it possible with Linux, eg does the block layer/scsi layer support it? any problems with the partition code?
* If there are problems, are they solveable, any plans on working on them or is already someone working on this?

Two options come to my mind:
* LVM, just define a new LUN, add it to the group, and resize
* echo remove-single-device ... > /proc/scsi/scsi (would not be life)

regards
Stefan

Signature · 6 lines
--------------------------------------------------------------------
Stefan Völkel                            [email protected]
Millenux GmbH                              mobile: +49.170.79177.17
Lilienthalstraße 2                          phone: +49.711.88770.300
70825 Stuttgart-Korntal                       fax: +49.711.88770.349
     -= linux without limits -=- http://linux.zSeries.org/ =-
#1 lore raw
Quoted 10 lines · Stefan Voelkel

I have a Linux box connected to a Fibre SAN. Now I'd like to resize one LUN and tell my Linux box what happened. In other words can I _live_ resize a SCSI disk?

[ let's not talk about which filesystems are capable of live resizing :) ]

* Is this possible at all, eg does the SCSI Standard include something to enable a device to tell the host about the changed geometry (SENSE DATA, ...) ?

The pull command is READ_CAPACITY. For pushing this information, there's nothing really standard, although some type of proprietary AEN could be adapted.

Quoted 4 lines

* Is it possible with Linux, eg does the block layer/scsi layer support it? any problems with the partition code?
* If there are problems, are they solveable, any plans on working on them or is already someone working on this?

You simply do

echo 1 > /sys/bus/scsi/<device>/rescan

It will re-read the capacity and partition table (as long as the device is unmounted and none of the partitions open).

James

#2 lore raw
Quoted 6 lines · James Bottomley

You simply do

echo 1 > /sys/bus/scsi/<device>/rescan

It will re-read the capacity and partition table (as long as the device is unmounted and none of the partitions open).

OK, I actually tried this, you need two steps. The one above will reread the capacity. After that you send a BLKRRPART ioctl to the device to re-read the partition table. (but, obviously, something else will have to update the partition table to see the new device size)

James

#8 lore raw
In reply to James Bottomley
Quoted 6 lines · James Bottomley

You simply do

echo 1 > /sys/bus/scsi/<device>/rescan

It will re-read the capacity and partition table (as long as the device is unmounted and none of the partitions open).

i guess that kinda defeats the purpose of online resizing; the idea is that the partitions DO remain mounted and the partitions with a refcount against them!

cheers,

lincoln.

#3 lore raw
In reply to James Bottomley
Quoted 5 lines · James Bottomley
Quoted 4 lines · James Bottomley

You simply do

echo 1 > /sys/bus/scsi/<device>/rescan

Quoted 7 lines
Quoted 2 lines

It will re-read the capacity and partition table (as long as the device is unmounted and none of the partitions open).

OK, I actually tried this, you need two steps. The one above will reread the capacity. After that you send a BLKRRPART ioctl to the device to re-read the partition table. (but, obviously, something else will have to update the partition table to see the new device size)

Ok, that is a step in the right direction, as it will not disrupt operations of other devices on the same bus.

But I want to be able to do it with a mounted partition, something like "device size hotpluging". I don't know if that is the right term, but think of the 2.7 memory hotplug plans.

* in the SAN I add space to my LUN
* then I hit my linux box on the head to get it to send a read_capacity and update the size of the device.
* run a nifty tool that creates a new partition table and writes it to the device.
* use newly gained space

so what we actually need is:

* a way to force the scsi stack to send out a read_capacity and act on it (perhaps another /sys/ entry?), perhaps a hotplug event that creates a new partition table, eg add the new space as "unused" at the end of the device, write that table and ioctl() to reread it.
* a way to fiddle around with live partitions, a userspace tool with a way to tell the kernel supsend/reactivate io on that block device. it would have to take care of the filesystems residing on the device.

regards
Stefan

Signature · 6 lines
--------------------------------------------------------------------
Stefan Völkel                            [email protected]
Millenux GmbH                              mobile: +49.170.79177.17
Lilienthalstraße 2                          phone: +49.711.88770.300
70825 Stuttgart-Korntal                       fax: +49.711.88770.349
     -= linux without limits -=- http://linux.zSeries.org/ =-
#4 lore raw
Quoted 9 lines · Stefan Voelkel

* a way to force the scsi stack to send out a read_capacity and act on it (perhaps another /sys/ entry?), perhaps a hotplug event that creates a new partition table, eg add the new space as "unused" at the end of the device, write that table and ioctl() to reread it.
* a way to fiddle around with live partitions, a userspace tool with a way to tell the kernel supsend/reactivate io on that block device. it would have to take care of the filesystems residing on the device.

No way. You're better of using a proper volume manager instead of doing this paritioning mess.

#5 lore raw
Quoted 11 lines · Christoph Hellwig
Quoted 9 lines · Stefan Voelkel

* a way to force the scsi stack to send out a read_capacity and act on it (perhaps another /sys/ entry?), perhaps a hotplug event that creates a new partition table, eg add the new space as "unused" at the end of the device, write that table and ioctl() to reread it.
* a way to fiddle around with live partitions, a userspace tool with a way to tell the kernel supsend/reactivate io on that block device. it would have to take care of the filesystems residing on the device.

Quoted 2 lines

No way. You're better of using a proper volume manager instead of doing this paritioning mess.

True, let's forget about the partitions: mount /dev/sda /home.

Signature · 6 lines
--------------------------------------------------------------------
Stefan Völkel                            [email protected]
Millenux GmbH                              mobile: +49.170.79177.17
Lilienthalstraße 2                          phone: +49.711.88770.300
70825 Stuttgart-Korntal                       fax: +49.711.88770.349
     -= linux without limits -=- http://linux.zSeries.org/ =-
#6 lore raw
Quoted 4 lines · Stefan Voelkel
Quoted 2 lines

No way. You're better of using a proper volume manager instead of doing this paritioning mess.

True, let's forget about the partitions: mount /dev/sda /home.

Indeed. If you're resizing luns they're most likely virtualized alreday anyway :)

#7 lore raw
In reply to Stefan Voelkel
Quoted 1 line · Stefan Voelkel

True, let's forget about the partitions: mount /dev/sda /home.

OK, Let's try again in simpler terms.

The problem you are trying to solve has three components:

1. Filesystem resize
2. parition resize
3. SCSI device resize

1 and 3 are solved (for a subset of fs). A solution to 2 is to use the Linux device mapper (a mini volume manager) to replace the use of gendisk partitions. Then your entire stack constructed this way will be resizable.

The place to begin finding out about DM is the development lists:

[email protected]

With a list archive at:

http://lists.sistina.com/pipermail/dm-devel/

James