system rescue basic

1. add init=/bin/sh to grub or lilo to quickly bootup system , but ctrl-c or ctrl-z might not work
2. mount -t proc none /proc to get command like ps to work, or anything else use /proc file system
3. mount -o remount,rw /
4 .fuser -am /mnt/muic
fuser -km /mnt/music
ps axwwl | grep processidnumber
lsof /mnt/music

5. dd if=/dev/hda of=filename bs=512 count=1
restore partition table:
dd if=filename of=/dev/hda bs=1 count=64 skip=446 seek=446

to cloning bad disk
dd if=/dev/hda of=/dev/hdb conv=noerror,sync
ddrescue --max-retries=-1 /dev/hda /dev/hdb

6. recover lost partition
gpart /dev/hdb (guess partition table)
gpart -b filename -W /dev/hda /dev/hda
note: scan /dev/hda ,backup the existing MBR, then write to /dev/hda

7. in case the bad block on hard disk is in journal file system, so remove journal might help
tune2fs -f -O ^has_journal /dev/hda1
tune2fs: attempt to read block from file system resulted in short read while reading journal inode

# debugfs /dev/hda1
debugfs: features
defugfs : open /dev/hda1
debugfs: quit