Skip to content

리눅스 파일 복구 명령 debugfs

조회 수 25454 추천 수 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/d31/trackback
List of Articles
번호 제목 글쓴이 날짜 조회 수sort
307 grep 옵션, egrep 옵션 차이점 ADMINPLAY 2010-02-17 26266
306 리눅스 파일/디렉토리 개수 알기 ADMINPLAY 2010-05-19 26207
305 rsync : protocol version mismatch -- is your shell clean? ADMINPLAY 2009-05-17 26191
304 .vimrc 설정 설정, 색상 (VI 설정 색상) ADMINPLAY 2009-03-21 26177
303 리눅스에서 윈도우 공유폴더 접근하기. samba ADMINPLAY 2011-07-12 25881
302 장비를 복제해서 옮겼을 경우 네트워크가 eth0_rename 되... ADMINPLAY 2012-01-31 25796
301 linux - cp 덮어쓰기옵션 ADMINPLAY 2012-02-24 25692
300 CentOS ffmpeg yum install ADMINPLAY 2012-02-07 25577
299 리눅스 TIP ADMINPLAY 2009-03-09 25525
298 리눅스 - tar 압축 사용법 ADMINPLAY 2010-02-20 25482
297 iSCSI 설정하기 ADMINPLAY 2011-04-24 25470
» 리눅스 파일 복구 명령 debugfs ADMINPLAY 2009-06-24 25454
295 MS-DOS 배치파일 문법 ADMINPLAY 2012-01-16 25390
294 백 그라운드, 포그라운드 전환 ADMINPLAY 2009-06-04 25183
293 CentOS 5.4 Samba 서버 <-> 윈도우7에서 접근 문제 시스템관리짱 2011-03-04 25160
292 [FreeBSD]CPU, 메모리, HDD확인 및 네트워크 설정 ADMINPLAY 2012-01-17 25081
291 리눅스 시스템 관리자를 위한 즐겨찾기 ADMINPLAY 2009-05-22 24981
290 netstat 의 Send-Q, Recv-Q의 의미 ADMINPLAY 2009-02-09 24976
289 오라클11g 설치 (in centOS 5.1) ADMINPLAY 2010-04-28 24943
288 tar.gz 특정 디렉토리에 압축풀기 ADMINPLAY 2009-06-29 24928

Copyright ADMINPLAY corp. All rights reserved.

abcXYZ, 세종대왕,1234

abcXYZ, 세종대왕,1234