A word of warning: if you're using an older version of GlobalSAN (such as version 3), in order to successfully install this new version you've got to completely remove the older software by using the uninstaller which comes with the older package. If you no longer have it, please download it once more, uninstall it and then install the new version.
Showing posts with label iscsi. Show all posts
Showing posts with label iscsi. Show all posts
Sunday, 11 April 2010
GlobalSAN iSCSI initiator for Mac OS/X v. 4 has been released
As I told you in another blog post, I'm using GlobalSAN iSCSI initiator for Mac OS/X to remotely connect to my time machine disk, which happens to be a ZFS volume managed by a Solaris host. Studio Network Solutions has just released GlobalSAN version 4: alongside some UI enhancements, this new version of the GlobalSAN software takes advantage of Snow Leopard characteristics. A screenshot of the new GlobalSAN UI is the following:
Wednesday, 17 February 2010
Mac OS X as an iSCSI initiator: Time Machine on ZFS
As I described in previous posts, I setup an iSCSI target with Solaris COMSTAR backed by a ZFS volume. I want to use this volume as a disk for Mac OS X Time Machine. This way, I'll get the best of the two technologies: a pretty looking and easy to manage Time Machine for backing up my MacBook backed by an enterprise-level, redundant and scalable ZFS volume published as an iSCSI target over my private LAN.
No more consumer disks on a table, no more poor hardware-implemented file system sharing protocol. No more worries to lose a disk. Just Solaris, ZFS, COMSTAR and a LAN.
Mac OS X as an iSCSI initiator
Although it's a subject most spoken of, Apple hasn't released yet the necessary components for Mac OS X to be an iSCSI initiator. Fortunately there exists a solid and free solution by Studio Network Solutions: globalSAN iSCSI Initiator for OS X. Just download it, install it, restart your OS X and a new panel will appear in your System Settings:
Connecting to a target
Connecting to a target is really easy: just use the globalSAN iSCSI GUI to add the target:
The target name is obviously retrieved from your target configuration.
Using the disk
If you read the previous post, you'll know that this target is backed by a ZFS volume which must be formatted before being used. With the Disk Utility you can format the new disk:
Using the disk with the Time Machine
To use the new disk with the Time Machine you just follow the usual procedure:
Conclusion
That's it. Using a ZFS volume as a disk for Mac OS X Time Machine is just a few clicks away. Next time you plan to buy a new external hard disk, just wait and take into account that a robust enterprise-level solution is available with not much more than the necessary budget to purchase a couple of consumer disks.
Setting up Solaris COMSTAR and an iSCSI target for a ZFS volume
COMSTAR stands for Common Multiprotocol SCSI Target: it basically is a framework which can turn a Solaris host into a SCSI target. Before COMSTAR made its appearance, there was a very simple way to share a ZFS file system via iSCSI: just setting the shareiscsi property on the file system was sufficient, such as you do to share it via NFS or CIFS with the sharenfs and sharesmb properties.
The official COMSTAR documentation is very detailed and it's the only source of information about COMSTAR I use. If you want to read more about it, please check it out.
If the service is disable, enable it:
After that, check that the service is up and running:
Each logical unit, then, is backed by some sort of storage device; Solaris and COMSTAR will let you create logical units backed by one of the following storage technologies:
In this case, we'll choose the ZFS volume as our favorite backing storage technology.
The previous command creates a 250GB volume called macbook0-tm on pool tank-esata. As expected you will find the raw device corresponding to this new volume:
To get the GUID of the logical unit you can use the sbdadm or the stmfadm commands:
To create the simple mapping for this logical unit, we run the following command:
If you're running the new COMSTAR iSCSI transport implementation, you can now create a target with the following command:
I will opt for static discovery because I've got a very small number of targets and I want to control which initiators connect to my target. To configure static discovery just run the following command:
# devfsadm -i iscsi
COMSTAR brings a more flexible and better solution: it's not as easy as using those ZFS properties, but it is not that hard, either. Should you need more complex setup and features, COMSTAR includes a wide set of advanced features such as:
- Scalability.
- Compatibility with generic host adapters.
- Multipathing.
- LUN masking and mapping functions.
The official COMSTAR documentation is very detailed and it's the only source of information about COMSTAR I use. If you want to read more about it, please check it out.
Enabling the COMSTAR service
COMSTAR runs as a SMF-managed service and enabling is no different than usual. First of all, check if the service is running:
# svcs \*stmf\*
STATE STIME FMRI
disabled 11:12:50 svc:/system/stmf:default
If the service is disable, enable it:
# svcadm enable svc:/system/stmf:default
After that, check that the service is up and running:
# svcs \*stmf\*
STATE STIME FMRI
online 11:12:50 svc:/system/stmf:default
# stmfadm list-state
Operational Status: online
Config Status : initialized
ALUA Status : disabled
ALUA Node : 0
Creating SCSI Logical Units
You're not required to master the SCSI protocols to setup COMSTAR but knowing the basics will help you understand the next steps you'll go through. Oversimplifying, a SCSI target is the endpoint which is waiting client (initiator) connections. For example, a data storage device is a target and your laptop may be an initiator. Each target can provide multiple logical units: each logical unit is the entity that performs "classical" storage operations, such as reading and writing from and to disk.
Each logical unit, then, is backed by some sort of storage device; Solaris and COMSTAR will let you create logical units backed by one of the following storage technologies:
- A file.
- A thin-provisioned file.
- A disk partition.
- A ZFS volume.
In this case, we'll choose the ZFS volume as our favorite backing storage technology.
Why ZFS volumes?
One of the wanders of ZFS is that it isn't just another filesystem: ZFS combines the volume manager and the file system providing you best of breed services from both world. With ZFS you can create a pool out of your drives and enjoy services such as mirroring and redundancy. In my case, I'll be using a RAID-Z pool made up of three eSATA drives for this test:
enrico@solaris:~$ zpool status tank-esata
pool: tank-esata
state: ONLINE
scrub: scrub completed after 1h15m with 0 errors on Sun Feb 14 06:15:16 2010
config:
NAME STATE READ WRITE CKSUM
tank-esata ONLINE 0 0 0
raidz1-0 ONLINE 0 0 0
c7t0d0 ONLINE 0 0 0
c8t0d0 ONLINE 0 0 0
c8t1d0 ONLINE 0 0 0
errors: No known data errors
Inside pools, you can create file systems or volumes, the latter being the equivalent of a raw drive connected to your machine. File systems and volumes use the storage of the pool without any need for further partitioning or slicing. You can create your file systems almost instantly. No more repartition hell or space estimation errors: file systems and volumes will use the space in the pool, according to the optional policies you might have established (such as quotas, space allocation, etc.)
ZFS, moreover, will let you snapshot (and clone) your file systems on the fly almost instantly: being a Copy-On-Write file system, ZFS will just write modification on the disk, without any overhead and when the blocks are no more referenced, they'll be automatically freed. ZFS snapshot are Solaris a much optimized version of Apple's time machine.
Creating a ZFS volume
Creating a volume, provided you've already have a ZFS pool, it's as easy as:
# zfs create -V 250G tank-esata/macbook0-tm
The previous command creates a 250GB volume called macbook0-tm on pool tank-esata. As expected you will find the raw device corresponding to this new volume:
# ls /dev/zvol/rdsk/tank-esata/
[...snip...] macbook0-tm [...snip...]
Creating a logical unit
To create a logical unit for our ZFS volume, we can use the following command:# sbdadm create-lu /dev/zvol/rdsk/tank-esata/macbook0-tm
Created the following LU:
GUID DATA SIZE SOURCE
-------------------------------- ------------------- ----------------
600144f00800271b51c04b7a6dc70001 268435456000 /dev/zvol/rdsk/tank-esata/macbook0-tm
Logical units are identified by a unique ID, which is the GUID shown in sbdadm output. To verify and get a list of the available logical units we can use the following command:
# sbdadm list-lu
Found 1 LU(s)
GUID DATA SIZE SOURCE
-------------------------------- ------------------- ----------------
600144f00800271b51c04b7a6dc70001 268435456000 /dev/zvol/rdsk/tank-esata/macbook0-tm
Indeed, it finds the only logical unit we created so far.
Mapping the logical unit
The logical unit we created in the previous section is not available to any initiator yet. To make your logical unit available, you must choose how to map them. Basically, you've got two choices:
- Mapping it for all initiators on every port.
- Mapping it selectively.
In this test, taking into account that it's a home setup on a private LAN, I'll go for simple mapping. Please, choose carefully your mapping strategy according to your needs. If you need more information on selective mapping, check the official COMSTAR documentation.
To get the GUID of the logical unit you can use the sbdadm or the stmfadm commands:
# stmfadm list-lu -v
LU Name: 600144F00800271B51C04B7A6DC70001
Operational Status: Offline
Provider Name : sbd
Alias : /dev/zvol/rdsk/tank-esata/macbook0-tm
View Entry Count : 0
Data File : /dev/zvol/rdsk/tank-esata/macbook0-tm
Meta File : not set
Size : 268435456000
Block Size : 512
Management URL : not set
Vendor ID : SUN
Product ID : COMSTAR
Serial Num : not set
Write Protect : Disabled
Writeback Cache : Enabled
Access State : Active
To create the simple mapping for this logical unit, we run the following command:
# stmfadm add-view 600144f00800271b51c04b7a6dc70001
Configuring iSCSI target ports
As outlined in the introduction, with COMSTAR a new iSCSI transport implementation has been introduced that replaces the old implementation. Since the two implementation are incompatible and only one can run at a time, please check which one you're using. Nevertheless, consider switching to the new implementation as soon as you can.
The old implementation is registered as the SMF service svc:/system/iscsitgt:default and the new implementation is registered as svc:/network/iscsi/target.
enrico@solaris:~$ svcs \*scsi\*
STATE STIME FMRI
disabled Feb_03 svc:/system/iscsitgt:default
online Feb_03 svc:/network/iscsi/initiator:default
online Feb_16 svc:/network/iscsi/target:default
If you're running the new COMSTAR iSCSI transport implementation, you can now create a target with the following command:
# itadm create-target
Target iqn.1986-03.com.sun:02:7674e54f-6738-4c55-d57d-87a165eda163 successfully created
If you want to check and list the targets you can use the following command:
# itadm list-target
TARGET NAME STATE SESSIONS
iqn.1986-03.com.sun:02:7674e54f-6738-4c55-d57d-87a165eda163 online 0
Configuring the iSCSI target for discovery
The last thing left to do to have your iSCSI target configured for discovery. Discovery is the process which an initiator use to get a list of available targets. You can opt for one of the three iSCSI discovery methods:
- Static discovery: a static target address is configured.
- Dynamic discovery: targets are discovered by initiators using an intermediary iSNS servers.
- SendTargets discovery: configuring the SendTargets option on the initiator.
I will opt for static discovery because I've got a very small number of targets and I want to control which initiators connect to my target. To configure static discovery just run the following command:
# devfsadm -i iscsi
Next steps
Configuring a target is a matter of few commands. It took me much more time to write down this blog post than having my COMSTAR target running.
The next steps wil be having an initiator connect to your target. I detailed how to configure a Mac OS/X instance as an iSCSI initiator on another post.
Using ZFS with Apple's Time Machine
The many of us who got accustomed to the ZFS wonders won't willingly trade ZFS for another file system, ever. But even though many ZFS users are running Solaris on their machines, including laptops, as I am, there are cases in which running another OS is desirable: that's when I seek the best option to integrate the other systems I'm running with Solaris and ZFS.
In the simplest case using some file system protocol such as NSF or CIFS is sufficient (and desirable): that's how I share the ZFS file systems where I archive my photos, my video, my music and so on. Sharing such file systems with another UNIX, Windows or Mac OS/X (just to cite some), it's just some commands away.
In other occasions accessing a file system is not sufficient: that's the case with Apple's Time Machine, which is expecting a whole disk for its own sake connected locally.
Fortunately, integrating ZFS and Time Machine is pretty easy if you're running a COMSTAR-enabled Solaris. Although setting up COMSTAR is a very well documented topic by the Solaris and OpenSolaris documentation, I'll give you a walk through the necessary steps to get the job done and having your time machine making its backup on a ZFS volume. You'll end up with the benefits of both world: a multidimensional time machine which will take advantage of ZFS snapshotting and cloning capabilities.
The steps I'll detail in the following posts are:
- Setting up Solaris COMSTAR and configuring an iSCSI target port for a ZFS volume.
- Setting up Mac OS/X as an iSCSI initiator and configuring Time Machine.
With such a solution, you will need no USB/FireWire/anything-else drive hanging around. You won't need to rely on consumer drives which implement some kind of file system sharing protocol which, as explained earlier, won't fit into the time machine use case.
Just a network connection and a box to install Solaris, ZFS and COMSTAR, and you'll provide a scalable, enterprise-level, easy to maintain solution for your storage needs.
Labels:
apple,
comstar,
iscsi,
mac os x,
opensolaris,
solaris,
time machine,
zfs
Subscribe to:
Posts (Atom)