发布新日志

  • Recover from rm

    2010-11-04 13:56:49

    Recover from rm

    In order to undelete a file, you must know the following things:
    • On which device your file was stored
    • What kind of file system was used (eg. ext2, reiserFS, vfat)
    To find it out, type 'mount | column -t'

    Or
    echo "DEVICE DIRECTORY FS-TYPE" > tmp; mount | cut -d" " -f1,3,5 | sort >> tmp; cat tmp | column -t | sed -e "1s/.*/`tput smso`&`tput rmso`/"

    The output should be something like this:

    bash$ mount | column -t
    /dev/hda5 on / type ext2 (rw)
    proc on /proc type proc (rw)
    usbdevfs on /proc/bus/usb type usbdevfs (rw)
    devpts on /dev/pts type devpts (rw)
    /dev/hda1 on /mnt/windows/C type vfat (rw,noexec,nosuid,nodev)
    /dev/hda6 on /mnt/windows/E type vfat (rw,noexec,nosuid,nodev)
    /dev/hdc5 on /mnt/oldwin type vfat (rw,noexec,nosuid,nodev)

    Now, of which (printed) directory was the directory of your deleted file a subdirectory? E.g. if your file was stored on /home/user , you'll have to look for '/', since no closer match can be found. Found it? Cool, right now it's a piece of cake to find the device on which the file was stored and the filesystem type of the device.

    If you really need to undelete a file, that's the way to do it:
    grep -a -B[size before] -A[size after] 'text' /dev/[your_partition]
    Replace [size before], [size after] and [your_partition] with something meaningfull. Don't know what your partition is? Read the Linux undelete
    .g.: If you want to undelete a letter (+- 200 lines) starting with "Hi mum" which was stored on /dev/hda1 you can try:
    grep -a -B2 -A200 "Hi mum" /dev/hda1
    Make sure you do this as root (System administrator)
     
     
    -------------Abstracted from http://adminlinux.blogspot.com/2006/09/recover-from-rm.html
  • SQL plus

    2010-06-12 17:54:10

    #!/bin/bash

       NO=3
       sqlplus u0510b/creditderivative@\"//172.20.30.13:1521/shacolb\" <<EOF >log.txt
          select jobid from f3jobrunning where jobname='Empty Task ${NO}';
          quit;
       EOF
Open Toolbar