Mounting ISO Files on Linux

Often these days, especially when working with operating system downloaded ISO images, it would be handy to be able to work directly with the contents of the ISO files rather than to burn them to CD and place them physically into a CDROM drive. Sometimes this is because the machine that you are working with is remote and sometimes because there is no physical CDROM drive. But often it is just inconvenient.

In Linux this operation is simple. We simply create a Linux MD device where we will mount the ISO file and then mount it using the loopback. In this case we will use the /mnt/iso location which is fairly standard:

mkdir -p /mnt/iso
mount -o loop -t iso9660 my_cd_image.iso /mnt/iso

An ISO is a Compact Disk image format so called because most computers today use the ISO9660 filesystem on CDROM media.  On Solaris system the older HSFS or High Sierra File System is often designated even when ISO9660 is used.  ISO9660 is an extension to High Sierra adding in important international support and standardization.

Simple SAMBA on Solaris 10

Having built a simple NFS file server off of a SUN SunFire V100 server with Solaris 10 Update 4 (8/7) my next task is to share the same directory via Microsoft’s CIFS (aka Server Message Block or SMB) protocol. In order to do this we will need the open source software package SAMBA. This is a very simple how-to and does not begin to cover the complexities of configuring SAMBA beyond a minimal single share configuration. SAMBA is an extremely powerful package with many features including, in the latest version from SUN in Update 4, the ability to integrate with Microsoft’s Active Directory or AD.

We will begin by installing the SUN SAMBA packages which are available on the Solaris 10 8/7 CD #2. These are installed by default with many of the installation options but are not installed with the “Core” option which is what I normally use to build Solaris servers. So we have to do the install separately. If you have the second installation CD inserted into the drive and mounted, as I do, as /mnt/cdrom then the following command should work for you exactly – just copy and paste. If your CDROM device is mounted elsewhere the you will need to change the command accordingly.

# pkgadd -d /mnt/cdrom/Solaris_10/Product/ *smb* SUNWlibpopt

This command installs the SUNWsmbac, SUNWsmbar, SUNWsmbau and SUNWlibpopt packages. If you install the three SAMBA and WINS packages without installing SUNWlibpopt you can expect to get this error in your /var/svc/log/network-samba:default.log:

Executing start method ("/usr/sfw/sbin/smbd -D") ]
ld.so.1: smbd: fatal: libpopt.so.0: open failed: No such file or directory

You can check the version of SAMBA that has been installed easily using the smbd -V command. Solaris 10 Update 4 includes the SAMBA 3.0.25a package.

# /usr/sfw/sbin/smbd -V
Version 3.0.25a

Once you have the correct packages all installed you can proceed to configure your SAMBA service. Do not get ahead of yourself and attempt to enable them at this stage as the /etc/sfw/smb.conf file is missing and you will get an error until it exists. We will need to create this file now and enter a basic configuration. Here is the configuration that I created:

[global]
workgroup = DEMO-SMBFS
server string = Sol10u4 CIFS Server
log file = /var/adm/samba_log.%m
security = SHARE
[backupdata]
comment = backupdata
path = /data
force user = samiller
force group = other
read only = No
guest ok = Yes

Once you have entered your configuration parameters into the smb.conf file you may want to test them using the testparm program included with SAMBA to be sure that the syntax of the file is correct. This program will automatically check to see that the file is in the correct location and that it appears to be a valid configuration file. This quick check is highly recommended.

# /usr/sfw/bin/testparm

As long as your configuration file has passed its check we can continue on our way and enable our SAMBA and WINS services. First reboot your server. I am sure that there is a simpler way to make these services available to us but rebooting is always easy and clean. When your server has restarted you can enable your services. The svcadm command should run silently. In order to check that the services have started correctly you will need to verify them with the svcs command.

# svcadm enable samba wins
# svcs samba wins

If both of your samba related services, samba and wins, return as “online” then you are up and running. If they fail to start you can gain additional information about them by using the -xv option to the svcs command.

# svcs -xv samba wins

At this point your CIFS/SMB file server should be functioning. If you want to attempt to access it from a Windows computer you can using the CIFS syntax such as \\samba_server_hostname\backupdata\.

Easy NFS Sharing on Solaris 10

If there is one service made easy with Solaris it is NFS. Originally developed and designed by SUN NFS is the industry standard UNIX file sharing mechanism today and is likely to remain the dominant player for some time due to its ubiquity, openness, time proven protocol, simplicity and ease of management not to mention the expanse skill base of administrators who use it every day.

If you are following along in my series on building my SunFire V100 with Solaris 10 Core 8/7 then you know that we have gotten all of our filesystems setup and have a large, 106.44GB, ZFS partition mounted as /data. In this very short tutorial we are going to take that directory and make it available to the universe via NFS. Let’s get started.

Firstly we have a very easy time because Solaris installs NFS even with the Core version of the operating system so no worries there. If you don’t believe me you can take a quick look under /etc/init.d/ and you should see your nfs.server daemon script lurking there. It isn’t running yet but it is installed and ready to go.

All we need to do for our simple NFS setup is to make an entry to the filesystem export table /etc/dfs/dfstab (analogous to /etc/exportfs in Linux), enable the NFS service and instruct the system to share the contents of the dfstab. So, start by adding the following line to dfstab:

share -F nfs -o public,nosuid,rw,anon=-1 -d "backup" /data

We can explore the intricacies of this configuration file at another time. The important bits are that you are sharing the directory /data as a readable and writing (rw) directory. If you want remote machines to only be able to read from this directory without being able to make changes use (ro) instead.

Next we need to enable the NFS service in Solaris 10. If you need to look up the instructions for doing this the SUN engineers have thoughtfully included directions right at the top of the /etc/dfs/dfstab file in the comments section. How handy. But so you don’t need to go looking there, here is the command.

# svcadm enable network/nfs/server

There is one last step. Before we can actually use our newly configured NFS shared we need to tell Solaris to go ahead and share the directories. “How do we do that?”, you ask. Simple. Just shareall!

# shareall

At this point your /data directory is available to other NFS enabled computers. Wasn’t that easy? Yes it was.

Getting Started with ZFS on Solaris

If you have been following along with my series on the SunFire V100 you know that I have installed Solaris 10 Core 8/7 onto it (adding in SSH and BASH packages to make it actually useful in the real world) and have put the root volume under the control of the Solaris Volume Manager or SVM which has mirrored it under RAID 1. Now the final task for disk management is to create the ZFS storage that will exist on the large, remaining section of the disks.

Getting Starting – Prepping the Disks

Since we are not working with dedicated drive devices to use for ZFS we need to prepare some slices that we will be assigning to our ZFS pool or zpool. To complete the use of my disk space I use the format command to add a 106.44GB partition (that is block 10822 – 65533) to slice 5 on both of my drives. Now we have the space ready to be added to our first zpool.

Creating the ZPool

A zpool refers to a group of virtual (or physical) devices that will be incorporated together as a single entity under ZFS. The zpool system is analogous to logical volume management and is used instead of SVM for ZFS. Since we are working with just two drives here – as that is all that can be held by the entry-level V100 server – we are limited to working with mirrored pools. If we had three or more devices then we could opt to use RAIDZ. RAIDZ is SUN’s ZFS answer to RAID 5 but with better performance. Read Jeff Bonwick’s post for more detailed information. He explains it best.

For our simple mirroring purposes, we just use the zpool create command and select our zpool name, I chose “datapool”, and list your two slices. If you are following along on a V100 then everything should be exactly the same as mine. Feel free to use any name that makes sense for your pool.

# zpool create datapool mirror c0t0d0s5 c0t2d0s5

If all goes well you should now have your very first zpool. You can learn more about the state of your pool using zpool list and zpool status.

Creating a ZFS Filesystem

Creating our first ZFS filesystem is very easy. For my needs, I am only looking to create a single ZFS filesystem which spans the entire available space and will be eventually mounted simply as /data. For this I just need to use the simple zfs create command. Since we will probably want to be able to work with this new filesystem in the traditional manner using the commands mount and umount and by making a simple entry in the /etc/vfstab then we also need to complete the additional step of setting the mountpoint property to “legacy”. And, of course, make your mountpoint while you are at it.

# zfs create datapool/data
# zfs set mountpoint=legacy datapool/data
# mkdir /data

Add Your New ZFS Filesystem to /etc/vfstab

All that needs to be done is to open up your /etc/vfstab and add in the following line and ask Solaris to re-read the filesystem table.

datapool/data - /data zfs - yes -
# mount /data

That’s it. Now it is time to enjoy your new ZFS filesystem. Go ahead and move some shiny new files on there and try it out. Unless you are like me and would like to compress the files going onto your new partition in which case we have one last task to perform. Let’s issue the zfs set command to set our compress to on. This is very simple and straightforward.

# zfs set compress=on datapool/data

Okay, you did it. Now your filesystem is ready to be used. Enjoy.

ZFS Resources:

September 21, 2007: Oreo Day

I just realized that I never posted for Wednesday, September 19th.  Oh well.  I have no idea by now what happened then.  Nothing important, I am sure.  I went to work.  I ate dinner.  Yada yada yada.  You all know the drill.

Today is my work from home day this week.  I had to reschedule it from my usual Thursday because Oreo’s daycare providers are getting married tomorrow and they needed today off.  So Oreo is stuck at home with me today.  Yay!  Next week is going to be really tough for him though.  We aren’t sure what we are going to do about that.

It was a pretty busy day at work.  I didn’t get a chance to eat until almost two and I just ran across the street to Queen Pizza II and ran back and ate at my desk.  I did manage to do a little cleaning around the apartment, some dishes, some laundry and some cleaning out of the refridgerator.  But overall, not a lot of anything other than just sitting at me desk all day.

I ended up getting stuck working quite late – until after seven.  Dominica and I have a party to attend tonight and this made it very tough.  We didn’t manage to leave the apartment until almost eight by the time that I was able to get dressed and ready to go.

Tonight is a friend’s baby shower in Edison, New Jersey.  It takes about forty-five minutes to get down there at this time of night even though it isn’t very far away.  Getting through Newark to the interstate and then on to the Garden State Parkway and then all of the local roads in Edison really takes a while.

We had a good time at the baby shower.  It was not like traditional baby showers that we are used to where it is very uncomfortable for men to attend.  This was a totally coed and nothing weird or embarrassing baby shower with really awesome food from Moghul in Edison.  I haven’t had their food for months and boy was it good.  I have been telling Dominica about their food for a long time but she has never been able to get it before and she really enjoyed it.

We were exhausted by the time that we got home – around eleven.  Boy are we ever getting old.  It was straight off to bed for us.  I only barely get to sleep in tomorrow as I have to be online and working by eight.  I have a bit of work to do tomorrow so it is going to be a busy day.