Tuesday, March 3, 2009

How to undelete any open, deleted file on linux / solaris

Wow, I like that:

Chris Dew wrote up a neat trick on how to recover files if deleted on Linux, yet still open by a process.

This works on Solaris as well.  =)

$:~:uname -a
SunOS somehost.com 5.10 Generic_127112-11 i86pc i386 i86pc

$:~:echo “sup prefetch.net folks?” > testfile
$:~:tail -f testfile &
[1] 17134

$:~:rm testfile
$:~:ls /proc/17134/fd/
0  1  2
$:~:cat /proc/17134/fd/0
sup prefetch.net folks?
$:~:cp !$ ./testfile
cp /proc/17134/fd/0 ./testfile
$:~:cat testfile
sup prefetch.net folks?

Again, it’s from the awsome: http://prefetch.net/blog/index.php/2009/02/25/how-to-undelete-any-open-deleted-file-on-linux-solaris/

Quality VS Quantity – Great Dashboard!

I’ve  stumbled upon this article within my Google Reader subscriptions, I think it really worths reading:

QUALITY vs quantity, UX process.

Check email ONLY:

  • 10AM
  • 1PM
  • 4PM

Send any time
Set email to check every 3 hours.
NO email on evenings.
NO email on weekends.
EMERGENCY? = Use phone.

FOCUS 1-3 Activities max/day
LOG 1-3 Succinct status bullets every day on team wiki

MINIMIZE chat
MAXIMIZE single-tasking

OUT by 5:30PM
~No excuses~

Read on: http://lifehacker.com/5161561/simple-guidelines-for-workday-quality-over-quantity

When that file was deleted?!! Nice Tool for Linux

It happens a lot when you just wish if you be able to track file deletions and manipulations on your file system to know the root cause of a specific problem.

Imagine if you get this output on your log file:

[21/Feb/2009 11:21:18] IN_CREATE /tmp/services
[21/Feb/2009 11:21:18] IN_CLOSE_WRITE /tmp/services
[21/Feb/2009 11:21:18] * /tmp/services is closed
[21/Feb/2009 11:21:25] IN_DELETE /tmp/services
[21/Feb/2009 11:21:25] * /tmp/services is deleted
[21/Feb/2009 11:21:35] IN_CREATE /tmp/foo
[21/Feb/2009 11:21:35] IN_CLOSE_WRITE /tmp/foo
[21/Feb/2009 11:21:35] * /tmp/foo is closed
[21/Feb/2009 11:21:46] IN_DELETE /tmp/foo
[21/Feb/2009 11:21:46] * /tmp/foo is deleted


So how can you get that?



There is a Linux utility called iwatch that can be downloaded from this url:http://iwatch.sourceforge.net/index.html



You simply trigger the command by: $ iwatch -v /tmp



And you get the output above.



You can also have that send the output to your mailbox:



$ iwatch -v -m 2luqman@luqmanux.com /tmp



Thanks to matty, who posted this tip at his blog and I used it here using his article, read on the full article here: http://prefetch.net/blog/index.php/2009/02/28/monitoring-file-activity-on-linux-hosts/