database.sarang.net
UserID
Passwd
Database
DBMS
MySQL
PostgreSQL
Firebird
Oracle
Informix
Sybase
MS-SQL
DB2
Cache
CUBRID
LDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
ㆍ자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
자유게시판 자유게시판 2539 게시물 읽기
 
No. 2539
rm - f 로 지운 화일 복구하기[퍼온글]
작성자
이상호(mooksys)
작성일
2002-03-05 14:49
조회수
1,986

삭제 파일 복구하기 debugfs - [원본]http://lse.pe.kr/의 woogi 님

 

 

우연히 알게되어 나름대로 제 방식대로 글을 쓰고 혹시나 해서 kltp.kldp.org 에서

찾아보니 있더군요.. 에고 팔 아퍼... ^^;;

 

아래는 제 방식대로의 Tip&Tech 입니다.

----------------------------------------------------------------------

리눅스에서의 파일 삭제는 신중을 기해야 한다. 왜냐면 삭제된 파일은 복구 할 수

없기 때문이다. 이것이 정석이였습니다.

 

물론 rm 의 소프트링크나 다른 삭제 프로그램으로 대체하는 프로그램들도 있습니다

만 rm 자체의 복구는 없다고 알고 있으신 분들이 대부분 일 겁니다.

 

해답은

 

debugfs 라는 명령어 입니다. (man page 참조)

 

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

 

가정1) /home/pds/portsentry.tar.gz 라는 파일이 있음.

가정2) /home 파티션은 hda8 입니다. (df -h 로 확인)

가정3) rm -f /home/pds/portsentry.tar.gz 명령으로 지웠음.

가정4) root 로 작업.

 

복구 절차.

 

1. #debugfs /dev/hda8

 

=> 설명 : hda8 파티션에 대해서 검사를 한다.

 

2. 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:

 

위와 같은 상태로 나오고 다시 대기상태로 됩니다. 실제로는 너무 많이 나오더군

요.. (내가 그렇게 많이 지웠었나? '.'a)

 

이제 이 목록중에서 하나를 선택해서 살려야 합니다. 다행히도 살리고자 하는 파일

은 가장 최근에 지운 파일이므로 가장 아래쪽에 있는 것이겠죠.

 

debugfs: dump <61239> /home/debugfs/portsentry.tar.gz

 

=> Inode 값을 <> 안에 적어줍니다. 뒤에는 복구할 파일 이름을 적어주시면 됩니다.

=> 복구할 파일은 다른 디렉토리로 지정해 주시는게 좋습니다. 별 상관은 없지만...

 

#cd /home/debugfs

#tar -zxvf portsentry.tar.gz // 정상적으로 압축이 풀리더군요.

 

=> 아주 훌륭하게 복구가 되었더군요. ^^v

 

임의로 portsentry.tar.gz 를 지워서 테스트를 한 것입니다.

 

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

이 글에 대한 댓글이 총 2건 있습니다.

고맙습니다. 좋은 팁이네요.

그동안 rm -f 로 지웠던 데이터는 포기하고 백업에서 찾아보는 구닥다리 방법만을 고수해 왔거든요.

이운억님이 2002-03-05 19:50에 작성한 댓글입니다.

고맙긴요..^^;;

운억님...오랜만이죠..^^;; 복 많이 받으세요..

이상호(mooksys)님이 2002-03-06 00:03에 작성한 댓글입니다.
[Top]
No.
제목
작성자
작성일
조회
2542이런 좋은 곳이.. [2]
허은경
2002-03-06
1669
2541노트북 바꿨습니다. [5]
이창용
2002-03-06
1751
2540[등산] 이번 주 일요일(3월 10일)에 관악산 등산갑시다. [12]
허정수
2002-03-05
2074
2547┕>등산 원칙 - 절대 급하게 올라가지 않는다!! [1]
문태준
2002-03-07 15:06:46
1673
2554 ┕>Re: 내일 아침 비가 와도 등산은 갑니다.
허정수
2002-03-09 22:11:41
1704
2539rm - f 로 지운 화일 복구하기[퍼온글] [2]
이상호
2002-03-05
1986
2538OCP 시험자료 부탁합니다. [1]
김윤희
2002-03-05
1793
2537게으름 [1]
최공훈
2002-03-05
1667
2534오늘은 종일 홈피 접속을 못했었습니다.
정재익
2002-03-04
1514
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2024 DSN, All rights reserved.
작업시간: 0.017초, 이곳 서비스는
	PostgreSQL v16.2로 자료를 관리합니다