Monday, March 29, 2010

DTrace. Quick start.


OpenSolaris and ISO images

You have an OpenSolaris box and you also want to archive some things on DVD (well, just in case). Here the things everyone on Solaris should know (in case you don't):
  1. First, make an ISO out of the directory that allows full 31 character filenames, instead to truncate them 8.3 format which is compatible with MS-DOS. You also might consider "joliet-long" option in order to allow Joliet filenames to be up to 103 Unicode characters. This breaks the Joliet specs, but appears to work. The following example is just a straight-forward:
    mkisofs -J -l -o foobar.iso /path/to/the/folder
  2. Second, you want to test and verify it. In Solaris, prior to mounting, you should make a block device from the file, first. In this case, lofiadm is your friend in this way:
    pfexec lofiadm -a foobar.iso
    Please note that you will need to escalate a privileges, because it will create a new device in /dev/lofi directory. To know all the list, simply run lofiadm as is. In this example it appears as "/dev/lofi/1" device.
  3. Now is a time to mount the device. Create some directory (e.g. /tmp/foobar) and mount the device (not the .iso file):
    pfexec mount -F hsfs /dev/lofi/1 /tmp/foobar/
    Things looks OK? :)
  4. Un-mount your filesystem and remove mount point to cleanup the mess behind you:
    pfexec umount /tmp/foobar; rmdir /tmp/foobar
  5. Remove block device (same mess):
    pfexec lofiadm -d /dev/lofi/1
  6. I usually don't burn CD/DVD's on a server remotely due to a number of issues with that, but if you like, you can do it. Normally, you want to use "cdrw" on Solaris (SUNWcdrw package in IPS, in case you haven't it installed) like this:
    cdrw -C -i /path/to/your/foobar.iso
    This will also detect automatically you're burning DVD or CD, will check the size and so on.
  7. Probably remove your .iso image as well. :-)
That's was a Solaris way and is slightly different that on a typical Linux box.

Friday, March 26, 2010, show me a plain text!

I hate HTML messages. Especially, when you ask your mates not to send HTML for simple text. They do. You won't shoot em, because you will have to do their job as well (this leads to lack of sleep). So there is other way: force display a plain text. Normally, there is no checkbox in Preferences, but still "eats" this preference in plist, like this:
Cool. So we can do this:
defaults write PreferPlainText -bool TRUE

Now restart and you've done.