Skip to content

리눅스 파일 복구 명령 debugfs

조회 수 25453 추천 수 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/d67/trackback
List of Articles
번호 제목 글쓴이 날짜 조회 수
107 리눅스 - zip 압축 해제 ADMINPLAY 2009-07-25 24646
106 콘솔에 남는 메세지로그파일로 남기기 ADMINPLAY 2009-07-19 22229
105 tar 분할 압축 및 해제 및 특정 디렉토리만 압축 ADMINPLAY 2009-07-18 21657
104 linux swap 용량 늘리기 ADMINPLAY 2009-07-18 20966
103 FreeBSD SSH 접속 안되요 ADMINPLAY 2009-07-14 23279
102 인증서문제 (modulus 비교) ADMINPLAY 2009-07-08 21862
101 [Fedora5]부트로더 설정하기 ADMINPLAY 2009-07-08 20646
100 리눅스 vsftp의 root 접속문제 ADMINPLAY 2009-07-07 21182
99 보안서버구축시 아파치 컴파일 중 "can not be used when ... ADMINPLAY 2009-07-04 22440
98 리눅스로그파일삭제 어떤걸삭제하나요? ADMINPLAY 2009-07-02 20401
97 리눅스에서 일정기간 이상된 파일 삭제하기 ADMINPLAY 2009-07-02 22312
96 리눅스 쓸데없는 파일,로그파일 주기적으로 삭제하기 ADMINPLAY 2009-07-02 23524
95 아파치 모듈 mod_status file ADMINPLAY 2009-07-01 22010
94 net-snmp-5.3.2.3 ADMINPLAY 2009-07-01 20104
93 MRTG 설치 ADMINPLAY 2009-07-01 20219
92 tar.gz 특정 디렉토리에 압축풀기 ADMINPLAY 2009-06-29 24928
91 압축 : tar / gzip / jar / tbz 사용법 ADMINPLAY 2009-06-29 21285
90 [APM] 리눅스에서 Apache, PHP, MySQL 등 제거 방법 ADMINPLAY 2009-06-29 39388
89 오라클시작 ADMINPLAY 2009-06-26 18741
» 리눅스 파일 복구 명령 debugfs ADMINPLAY 2009-06-24 25453

Copyright ADMINPLAY corp. All rights reserved.

abcXYZ, 세종대왕,1234

abcXYZ, 세종대왕,1234