Rm -rf 복구 - Rm -rf boggu

rm 으로 삭제한 파일 복구하기

페이지 정보

작성자 최고관리자
댓글 0건 조회 4,205회 작성일 21-02-10 16:57

  • 목록

본문

//kori.xmecca.com <--- 요기서 퍼온 글입니다.

--------------------------------------------------------------------------------
리눅스에서의 파일 삭제는 신중을 기해야 한다. 왜냐면 삭제된 파일은 복구 
할 수 
없기 때문이다. 이것이 정석이였습니다.

물론 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

  • 이전글1. 아파치 2.0 에 대하여 (httpd2) 21.02.10
  • 다음글레드헷 리눅스9에서 2차 DNS 설정 21.02.10

댓글목록

등록된 댓글이 없습니다.

Toplist

최신 우편물

태그