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!

This article was posted by Matty on 2009-05-18 11:16:00 -0400 -0400