Skip to content

리눅스 파일 복구 명령 debugfs

조회 수 25455 추천 수 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/111/trackback
List of Articles
번호 제목 글쓴이 날짜 조회 수sort
287 CentOS Samba 설정 ADMINPLAY 2010-11-08 24884
286 가볍고 강력한 SNMP를 이용한 모니터링 프로그램입니다. file ADMINPLAY 2009-10-31 24859
285 리눅스 - htop file ADMINPLAY 2010-09-12 24838
284 favicon 만들기 ADMINPLAY 2009-09-30 24835
283 네트워크 관리자를 위한 통합 모니터링 툴 - N.E.W.T file [2] ADMINPLAY 2009-10-31 24705
282 리눅스 - zip 압축 해제 ADMINPLAY 2009-07-25 24646
281 [CentOS] ffmpeg 설치 ADMINPLAY 2012-02-07 24495
280 리눅스 Proxy Server[Squid] 설정법[RedHatLinux8.0] ADMINPLAY 2009-11-26 24408
279 커널 컴파일 장애 처리 perl: warning: Please check that... ADMINPLAY 2009-08-08 24379
278 대용량 하드 디스크 파티셔닝 (GPT 파티션) ADMINPLAY 2009-06-04 24364
277 lighttpd와 Apache의 성능 차이 file [2] l2zeo 2012-03-08 24246
276 [Flash] 크로스 도메인 설정 방법 ADMINPLAY 2010-08-31 24233
275 로드밸런싱의 ‘꽃’, L4/L7 스위치 관심 집중 ADMINPLAY 2009-11-30 24151
274 kernel panic 발생 시 자동으로 리부팅 설정 ADMIN 2008-12-10 24084
273 하드웨어정보 확인(lshw) file ADMINPLAY 2008-11-03 24038
272 MRTG 소스 설치 ADMINPLAY 2010-05-11 24028
271 리눅스에서 특정 파일을 제외하고 삭제하기 ADMIN 2008-11-03 23970
270 VI 에디터 유니코드(UTF-8)로 인코딩 전환 ADMINPLAY 2010-04-02 23966
269 리눅스 공유 메모리의 설정 (세마포어) ADMINPLAY 2010-04-28 23950
268 젠투리눅스에서 잃어버린 암호를 다시 설정하기 ADMINPLAY 2010-04-15 23899

Copyright ADMINPLAY corp. All rights reserved.

abcXYZ, 세종대왕,1234

abcXYZ, 세종대왕,1234