Showing posts with label Solaris. Show all posts
Showing posts with label Solaris. Show all posts

Monday, September 30, 2013

Recover a file with LSOF....

Just a quick and dirty of how to recover a file in LSOF.



lsof (List Open Files) is a *nix tool that will show open files and network connections. Of course, it's also available for OS X.
You can recover deleted files with it.
If you have ever deleted a file by mistake you can recover the deleted file. 
For example, to recover a missing messages log used by Syslog you can search for it via this command:
bash:~  lsof | grep messages
You should see something similar to:
syslogd   15328      root    2w      REG              253,2   1419873               983175 /var/log/messages.5 (deleted)
You want to find what is marked as deleted in parenthesis.  The process (15328) still has the file open. Without this process keeping the file open we would have lost the file permanently. This is important. Once the process stops, you won't be able to trace the file this way, so avoid rebooting or stopping the process entirely, until after you've recovered the lost file.

We can view the missing info by looking inside the proc filesystem, the process id (15328), and in the file descriptor (fd). The fd is found in the 4th entry, above (2w in this example):
bash:~  cat /proc/15328/fd/2
This outputs the contents the deleted messages.5 file. As you can see, the data is still there. Now, just redirect the contents back to /var/log/messages.5:
bash:~  cat /proc/15328/fd/2 > /var/log/messages.5
That's all there is to it. You have recovered the file with all the data back to its original location. You should also restart the process, writing to the file(s) recovered.
This is just one of many examples of how lsof can be very useful. Be sure to check out the Man pages and other docs.

Thursday, July 19, 2012

Virtualbox r18 blah...

I've been running Oracle's VirtualBox, instead of VMware, for some time now. I liked the "free" aspect of it, along with it's availability to almost everything I run as a host OS (Solaris, Linux and yes, even Windows, on occasion).


The latest upgrade (on the windows side) is a piece of work (POS, in other words) as upgrading, was a bear.


If it fails to upgrade and you get the odd (MSI not found error) when upgrading from r16 to r18, here's a fix that may work for you (did for me):


(Stolen from https://forums.virtualbox.org/viewtopic.php?f=6&t=45536&sid=a10eb1d37e85adc7b814470463b4b314&start=15)


After trying everything and having made sure that all certificates were in order and that all drivers could be installed perfectly fine, I finally found a solution for this problem that worked for me. It had nothing to do with the driver certificates, and all to do with the driver verification done by the installer.


To install VirtualBox with that error, do the following:


  1. Download the Orca MSI editor. http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&sqi=2&ved=0CFUQFjAA&url=http%3A%2F%2Fwww.technipages.com%2Fdownload-orca-msi-editor.html&ei=zxcIUIuiFePs2QWWm5DeBA&usg=AFQjCNGXxLvTAxxEIQiKhNrV3gWCn_paVg
  2. Start "cmd.exe" via the Start->Run and navigate to the directory you put your setup.exe.
  3. Execute "VirtualBox-4.1.16-78094-Win.exe -x"; adjust this to whatever version of Virtualbox you wish to install.
  4. The installer will tell you where it has extracted the files to. Go there and move them somewhere more accessible.
  5. Start Orca
  6. Open the MSI file for your platform that you've just extracted & copied. In my case this is "VirtualBox-4.1.16-r78094-MultiArch_amd64.msi"
  7. Enter the table "InstallExecuteSequence"
  8. Drop the row "MsiProcessDrivers"
  9. Save the MSI file.
  10. Verify that the MSI file's modified-date has changed (for some reason Orca sometimes does not save the file)
  11. Run the changed MSI.


After that, the install should work perfectly fine and ask you whether you really do want to install the drivers, even though they're not WHQL certified. Say yes to them all and enjoy using VirtualBox.


Orca MSI Editor: 
http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&sqi=2&ved=0CFUQFjAA&url=http%3A%2F%2Fwww.technipages.com%2Fdownload-orca-msi-editor.html&ei=zxcIUIuiFePs2QWWm5DeBA&usg=AFQjCNGXxLvTAxxEIQiKhNrV3gWCn_paVg



Oracle VirtualBox:
http://www.oracle.com/technetwork/server-storage/virtualbox/downloads/index.html

Tuesday, December 01, 2009

Some quick Solaris 10 Fault Manager Daemon notes

fmd - fault manager daemon commands:

# Display current faults:
fmdump faulty

# View fault files:
fmdump

# View error log files:
fmdump -e

# View previous log file:
fmdump /var/fmd/fmd/errlog.1

# Rotate log files - you may have to stop and start fmd if the process is
# too busy to rotate the files. This could be a catch 22, the fmd process
# must be running to rotate the files.

# Rotate error log files:
fmadm rotate errlog

# Rotate fault log files:
fmadm rotate fltlog

# Log files:
/var/fm/fmd
root@yourbox# ll
root sys 3 dir rwx------ 512 16:32:06 06/25/2009 ckpt
root root 1 file rw-r--r-- 44,427,432 12:55:28 11/18/2009 errlog
root root 1 file rw-r--r-- 1,774,698 12:05:24 11/18/2009 fltlog
root sys 2 dir rwx------ 512 12:05:24 11/18/2009 rsrc
root sys 2 dir rwx------ 512 09:24:38 06/24/2008 xprt
There are 5 items and 46.20MB (46,203,666 bytes) in /var/fm/fmd

# View fmd processes:
root@yourbox# ps -ef | grep fmd
root 9042 1 0 12:03:30 ? 2:25 /usr/lib/fm/fmd/fmd
root 25435 25261 0 12:54:51 pts/1 0:00 grep fmd

# Stop and start fmd:
svcadm disable svc:/system/fmd:default
svcadm enable svc:/system/fmd:default

Monday, November 30, 2009

Just a quick note about mounting ZFS resource in a non-global zone...

This is in response to a question that was posted in the SUN Solaris Experts group on LinkedIn:

I keep running into people who think that you have to reboot a non-global zone to add a ZFS mountpoint. Not true.

After you add the zfs resource to your zone.xml (use zonecfg, if you follow recomendation, heh) you perform the following on the Global Zone (not within the non-global zone). Be sure to define the type as "legacy":

root@global-zone# mount -F zfs your_zpool/your_filesystem_name /zones/non_global_zonename/root/your_mountpoint

Log into your zone and you should now see the new filesystem (DF or whatever).

Monday, November 02, 2009

ZFS Deduplication Is In!

If you've been waiting (as I have) for Dedup capability in ZFS, then the wait is close to over. See Jeff Bonwick's blog: http://blogs.sun.com/bonwick/en_US/entry/zfs_dedup

I can't wait to test it, as soon as I can find out how to get my hands on it, lol. It's not in Sol10 update 8, nor is it in the most recent snapshot of OpenSolaris, but I suspect it will be out soon.

Edit:

Seems my rss feed is slow. It's currently in OpenSolaris, as of last night!
http://mail.opensolaris.org/pipermail/onnv-notify/2009-November/010683.html

Wednesday, July 29, 2009

Solaris 10: Enable SMCwebserver For Easy ZFS Management.

You know, sometimes a GUI is nice to have around. I'm not "really" a "GUI Fanboy" when it comes to system management and administration, but there are those times when it's just easier to see things, presented in way that's easy to access and not have to run a handful of commands and scroll through a ton of output, etc.

A lot of you are probably already aware of the SMCwebserver http interface and are still trying to remove the bad taste from your mouths, from the Oct 08 release of Sol 10 that totally fraked the whole thing up. I am happy to report that, thus far, it seems it's working again, in the May 09 release (5/09 s10s_u7wos_08 release). Now lets see if a subsequent cluster patch breaks it again, rofl.

I digress...

So, for those who are un-aware of how to enable the service to accept connections, remotely, here's a quick and dirty:

/usr/sbin/svccfg -s svc:/system/webconsole setprop options/tcp_listen = true

/usr/sbin/svcadm refresh svc:/system/webconsole

/usr/sbin/smcwebserver stop

/usr/sbin/smcwebserver start

/usr/sbin/svcadm enable svc:/system/webconsole


That should do it. Now make sure your port (6789) is listening to "All" (*):
/usr/bin/netstat -an|grep 6789

*.6789 *.* 0 0 49152 0 LISTEN

Now open your web browser on your desktop machine (laptop, whatever) and go to the server:6789

(http://your.server.address:6789)

Go through all of the security exception notifications and log in with the account with proper credentials (like root, for example, though I suggest you set up another account, instead).

Have fun with it and here's the smcwebserver manpage: http://docs.sun.com/app/docs/doc/816-5166/smcwebserver-1m?a=view

-W