Managing COMSTAR logical units with sbdadm

With project COMSTAR, you can present logical units to one or more hosts connected via Ethernet or fibre channel. Logical units are managed with the sbdadm utility, which has options to add, delete, list, import and modify logical units. To create a logical unit using a ZFS volume, the path to the ZFS volume can be passed to the “create-lu” option:

$ zfs create -V 18g bits/testvol

$ sbdadm create-lu /dev/zvol/rdsk/bits/testvol

Created the following LU:

              GUID                    DATA SIZE           SOURCE
--------------------------------  -------------------  ----------------
600144f02d65840000004a04c6b90004      19327287296      /dev/zvol/rdsk/bits/testvol



If you would prefer to use a file instead of a volume, you can do that as well:

$ touch /foo

$ sbdadm create-lu -s 100g /foo

Created the following LU:

              GUID                    DATA SIZE           SOURCE
--------------------------------  -------------------  ----------------
600144f02d65840000004a117a790002      107374182400     /foo



In the example above, I used the COMSTAR thin provisioning support to create a 100GB logical unit using the file /tmp. After a logical unit is added, it can be listed with the sbdadm “list-lu” option:

$ sbdadm list-lu

Found 4 LU(s)

              GUID                    DATA SIZE           SOURCE
--------------------------------  -------------------  ----------------
600144f02d65840000004a117a790002      26843545600      /foo
600144f02d65840000004a04c6b90004      19327287296      /dev/zvol/rdsk/bits/testvol
600144f02d65840000004a049b880001      107374116864     /dev/zvol/rdsk/bits/nevada110disk1
600144f02d658400000049fba1bf0001      107374116864     /dev/zvol/rdsk/bits/centosnode1



If you decide that a logical unit is no longer needed, you can remove it with the sbdadm “delete-lu” option:

$ sbdadm delete-lu 600144f02d65840000004a04c6b90004

If you need to increase or decrease the size of a logical unit, you can use the sbdadm “modify-lu” option:

$ sbdadm modify-lu -s 25g 600144f02d65840000004a117a790002

LU modified Successfully.



There is also an “import-lu” option which can be used to import a volume or file into COMSTAR. Nice!

5 Comments

enki  on June 15th, 2009

Hi,
I tried to follow your guide, but it ended on abdadm. Can you kick me in right direction?

root@FS:~# zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
comstarvolumes 816G 975K 816G 0% ONLINE -
rpool 136G 5.21G 131G 3% ONLINE -
root@FS:~# zfs create -V 800G comstarvolumes/vol_1
cannot create ‘comstarvolumes/vol_1′: out of space
root@FS:~# zfs create -V 100G comstarvolumes/vol_1
root@FS:~# sbdadm create-lu /dev/zvol/local/comstarvolumes/vol_1
Unable to open device. Is the driver attached ?
root@FS:~# sbdadm create-lu /dev/zvol/rdsk/comstarvolumes/vol_1
Unable to open device. Is the driver attached ?
root@FS:~# stmfadm list-lu
stmfadm: list failed
root@FS:~# sbdadm create-lu /dev/zvol/rdsk/comstarvolumes/vol_1
Unable to open device. Is the driver attached ?
root@FS:~# sbdadm list
Unable to open device. Is the driver attached ?

matty  on June 15th, 2009

I think your pool is out of space:

cannot create ‘comstarvolumes/vol_1′: out of space

If you add some additional disk space (or remove stuff you don’t need), you should be golden.

enki  on June 16th, 2009

oh..not that one..altrough it should be possible to create 800GB pool on 816GB free space, I decided to just smaller one and that suceeded. Real problem is line below, in create-lu

enki  on June 16th, 2009

Huh..I am not sure what I changed except name, but it now works.

miguel  on December 12th, 2009

Hi, how can you grow a lun when using zvol?
when i’m using zvol when i change the size of the zvol the lun created on the zvol stays with the original size, how can i change the lun when i change the size of the zvol ?
PS: the strange thing is for example when i create a zvol with 15G and then the lun when is created keeps the same size of the zvol, but if i change the size of the lun for 40g it allows … I’m confused, shouldnt the size of the lun created on the zvol respect the zvol size ?

thanks,

miguel

Leave a Comment