Skip to content

리눅스 파일 복구 명령 debugfs

조회 수 25492 추천 수 0 2009.06.24 06:36:52
 

아래와 같이 debugfs을 이용하여 rm명령으로 삭제하신 파일들을 복구하실수 있습니다.
예전 도스시절의 Undelete와 비슷하다가 생각하시면 됩니다. 복구에 성공하세요...
 rm 명령 자체의 복구기능은 없다. 이경우 ext2 , ext3파일시스템
에 한해서 debugfs 명령을 통하여 rm명령으로 삭제한데이타를 복구할수 있다.

실제 사용예를 들어 설명하겠습니다.

■ 1. rm명령으로 데이타를 삭제
가정1) ls /home/pds/portsentry.tar.gz
가정2) df -h ( /home  ---- /dev/hda8)
가정3) rm -f /home/pds/portsentry.tar.gz

 

■ 2. 데이타 복구하기

2.1 삭제한 파일이 속한 파티션 검사
fc5#> debugfs /dev/hda8  (/dev/hda8 파티션에 대해서 검사)

2.2 lsdel명령으로 삭제된 파일 조회

debugfs:  (대기상태를 뜻함. 삭제된 파일을 열람하기 위해 이곳에서 lsdel 입력 & 엔터)
-----------------------------------------------------------
     ...... 윗 부분 생략 ......
debugfs: lsdel
99 deleted inodes found.
Inode Owner Mode Size Blocks Time deleted
108123 0 100644 239 1/ 1 Thu Jan 3 01:25:33 2002
18417 0 100644 426625 420/ 420 Thu Jan 3 01:26:34 2002
45007 0 100644 343 1/ 1 Thu Jan 3 01:29:59 2002
28691 0 100400 879 1/ 1 Thu Jan 3 01:38:29 2002
18394 0 40755 0 1/ 1 Thu Jan 3 01:58:54 2002
..
.
14356 0 100644 2325 3/ 3 Fri Jan 25 16:13:24 2002
61239 0 100644 43034 44/ 44 Fri Jan 25 16:13:31 2002
debugfs:
------------------------------------------------------------
위와 같이 삭제된 inode에 대한 정보들이 출력되고 난후 다시 대기상태(debugfs: )로
바뀌게된다.

 

2.3 dump으로 삭제된 파일 복구하기
이제 이 목록중에서 하나를 선택해서 복구를 하면된다. 가장 최근에 지운 파일이
위의 출력 리스트에서 제일 아랫쪽에 위치하게 된다.

---------------------------------------------------------------------------
debugfs: dump <61239> /home/debugfs/portsentry.tar.gz
            (Inode값)  (삭제된 파일을 복구하고자 하는 위치 및 파일명)
(Inode 값을 <> 안에 입력하고, 그 뒤에는 복구할 파일 이름을 입력. )
---------------------------------------------------------------------------

fc5#> cd /home/debugfs
fc5#> tar -zxvf portsentry.tar.gz  ( 복구가 되었다면 정상적으로 압축해제 됨.)


debugfs: 상태에서 사용할 수 있는 명령어는 help 를 입력하면 알수 있다.(debugfs:help)
끝내는 것은 q, quit 입니다.


아래는 debugfs: 에서 사용가능한 명령어들이다.
---------------------------------------------------------------------
Available debugfs requests:

show_debugfs_params, params
Show debugfs parameters
open_filesys, open Open a filesystem
close_filesys, close Close the filesystem
feature, features Set/print superblock features
dirty_filesys, dirty Mark the filesystem as dirty
init_filesys Initalize a filesystem (DESTROYS DATA)
show_super_stats, stats Show superblock statistics
ncheck Do inode->name translation
icheck Do block->inode translation
change_root_directory, chroot
Change root directory
change_working_directory, cd
Change working directory
list_directory, ls List directory
show_inode_info, stat Show inode information
link, ln Create directory link
unlink Delete a directory link
mkdir Create a directory
rmdir Remove a directory
rm Remove a file (unlink and kill_file, if
appropriate)
kill_file Deallocate an inode and its blocks
clri Clear an inode's contents
freei Clear an inode's in-use flag
seti Set an inode's in-use flag
testi Test an inode's in-use flag
freeb Clear a block's in-use flag
setb Set a block's in-use flag
testb Test a block's in-use flag
modify_inode, mi Modify an inode by structure
find_free_block, ffb Find free block(s)
find_free_inode, ffi Find free inode(s)
print_working_directory, pwd
Print current working directory
expand_dir, expand Expand directory
mknod Create a special file
list_deleted_inodes, lsdel
List deleted inodes
write Copy a file from your native filesystem
dump_inode, dump Dump an inode out to a file
cat Dump an inode out to stdout
lcd Change the current directory on your native
filesystem
rdump Recursively dump a directory to the native
filesystem
help Display info on command or topic.
list_requests, lr, ? List available commands.
quit, q Leave the subsystem.
-----------------------------------------------------------------
 
 

수펴유저코리아 : 임근식 님

profile

일요일은 짜빠게뤼~ 먹는날~^^

엮인글 :
http://adminplay.com/1944/447/trackback
List of Articles
번호 제목 글쓴이 날짜sort 조회 수

<video>의 속성과 메소드

FreeBSD 참고 명령문 ( H/W 정보 확인 방법)

GBIC(지빅) 이 뭘까?? file

GSLB(Global Service Load Balancing)

linux bonding (네트워크 2개를 1개의 인터페이스로 구성)

TaskSet 으로 Process의 사용 CPU를 지정해 보자!

CentOS 4.x 에서 yum 실패 대처

Centos 6.0 사용장비 교체후 eth0,1이 eth2,3으로 밀리거...

스퀴드(squid) 로그 로테이트 방법

Squid 의 캐시 저장 기간 설정 ( refresh_pattern )

rsync 를 이용하여 동기화 할때 특정 폴더 2개 이상 제외하기

allowScriptAccess 설정

  • l2zeo
  • 2012-05-05
  • 조회 수 8453

HTML5 멀티미디어 태그 - <video>,<audio>,<embed>

squid.conf : Reverse Proxy

ssh 특정 ip or 특정대역폭만 접속 허용

lighttpd와 Apache의 성능 차이 file [2]

  • l2zeo
  • 2012-03-08
  • 조회 수 24282

squid.conf

[squid] 캐시 로그 결과 값(access_log)

linux - cp 덮어쓰기옵션

ffmpeg 설치 및 활용

Copyright ADMINPLAY corp. All rights reserved.

abcXYZ, 세종대왕,1234

abcXYZ, 세종대왕,1234