Tuesday, October 21, 2008

Creating New File Systems In Local Zones On Solaris 10

Hey There,

A while ago (back in May, 2008, I believe), we took a look at working with storage pools using ZFS on Solaris 10. As we know, ZFS stands for the Zettabyte File System and not the Zone File System (which some folks think it does. Not criticizing. It makes more sense than a lot of other things you might get from those initials ;). The point being, we never stopped to take a look at zones and lay down some simple procedures for working with them. Since this blog attempts to serve as some sort of a reference (hopefully folks come here and find some help or usable information/advice), today I thought we'd start taking a look at Solaris zones. Today, we'll start looking at Solaris 10 zones by looking at "local zones." There are many important distinctions to be made between local and global zones in Solaris, but, for now, let's just leave the meaning as vague as possible. Global = All Zones. Local = Specific Zones. Perhaps I could make it simpler to understand than that. Suggestions are, of course, always welcome. But, enough dwelling on that...

Here's one of (I'm sure) many ways to add a new filesystem to a Solaris 10 local zone. Note that all of this work needs to be done "from" the global zone.

1. Once you've logged onto your global zone (usually just the main host name, like you would log in to any other zone-less version of Solaris), create the volume and filesystem "on the global zone" using standard filesystem creation commands. For this instance, we'll assume VxFS (the Veritas File System), but you could use any filesystem Solaris supports. If you are using VxFS, Solaris Volume Manager or however you prefer to do your disk partitioning and management, it's always a good idea to try to include the name of your local zone in the disk group, etc. This way, in the future, you'll never have to wonder what belongs to which when you have 15 zones on the same box!

2. Add an entry for your new local zone in /etc/vfstab file on the global zone. You should use best practice and make the mount point under /zones/MyNewZone/root. So if you wanted to add a filesystem name "DONG" to the "DING" local zone, your mount point would be:


3. Now, still on the global zone, modify the "DING" local zone:

host # zonecfg –z DING
zonecfg:DING> add fs
zonecfg:DING:fs> set dir=/DONG
zonecfg:DING:fs> set special=/dev/vx/dsk/DINGdg/DONGvol
zonecfg:DING:fs> set raw=/dev/vx/rdsk/DINGdg/DONGvol
zonecfg:DING:fs> set type=vxfs
zonecfg:DING:fs> end
zonecfg:DING:fs> commit
zonecfg:DING:fs> quit

4. Next, mount your new "DONG" filesystem while still in the global zone:

host # mount /zones/DING/root/DONG

5. Now, hop on out of the global zone (or log out, whichever works for you ;). Then, login to the "DING" local zone and you should be able to see your new filesystem:

/dev/vx/dsk/DINGdg/DONGvol 6547824 24356 6523468 1% /DONG

NOTE: The only exceptions to the "create your local zones in the global zone ONLY" rule, have to do with NFS, and the like, filesystems. When you are adding a filesystem of this type to your local zone, you need to add it while "in" the local zone.

Tomorrow, we'll take a look at maintaining/modifying your new "DING" local zone. Until then, enjoy the peace and quiet :)


, Mike

Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.