Linux

리눅스 폴더 복구

Naan 2020. 3. 17. 15:27
반응형

작업하다가... 

rm -Rf /etc

짜잔......

망했다...

복구 해보자.

 

wget http://sourceforge.net/projects/extundelete/files/extundelete-0.2.4.tar.bz2

 

Download extundelete from SourceForge.net

VPN은 해킹을 방지하고 온라인 트래픽 흐름을 위한 암호화된 터널이라고 상상해 보세요. 아무도 터널 안을 통해 볼 수 없으며 사용자의 인터넷 데이터를 손에 넣을 수 없습니다. NordVPN은 공용 Wi-Fi를 사용하거나, 밖에서 개인 계정과 직장 계정에 액세스하거나, 또는 자신의 인터넷 사용 기록을 비공개로 안전하게 유지합니다.

sourceforge.net

파일 다운 받고 압축 푼다음 설치

 

# tar -xvf extundelete-0.2.4.tar.bz2

# cd extundelete-0.2.4/
# ./configure
Configuring extundelete 0.2.4
configure: error: Can't find ext2fs library

 

에러 뜨면

# apt-get install e2fslibs -y

# apt-get install e2fslibs-dev -y

설치 

# ./configure 

~~~~~~~~~~~~

~~~~~~~~~~~~~~~

Configuring extundelete 0.2.4
Writing generated files to disk

# make && make install

 

 

etc 복구해보자!

 

# extundelete /dev/sdb4 --restore-directory /etc
NOTICE: Extended attributes are not restored.
WARNING: EXT3_FEATURE_INCOMPAT_RECOVER is set.
The partition should be unmounted to undelete any files without further data loss.
If the partition is not currently mounted, this message indicates
it was improperly unmounted, and you should run fsck before continuing.
If you decide to continue, extundelete may overwrite some of the deleted
files and make recovering those files impossible.  You should unmount the
file system and check it with fsck before using extundelete.
Would you like to continue? (y/n)
y
Loading filesystem metadata ... 3318 groups loaded.
Loading journal descriptors ... 28162 descriptors loaded.
Searching for recoverable inodes in directory /etc ...
7995 recoverable inodes found.
Looking through the directory structure for deleted files ...
7928 recoverable inodes still lost.

복구가 끝났다. 루트 경로에 RECOVERED_FILES 폴더 밑에 있을것이다.

# ls
bin   cdrom  etc   initrd.img      lib    lost+found  mnt  proc             root  sbin  srv  tmp  var
boot  dev    home  initrd.img.old  lib64  media       opt  RECOVERED_FILES  run   snap  sys  usr  vmlinuz

있다. 가보자

#cd RECOVERED_FILES/
# ls
etc

폴더가 복구 된것을 확인 할 수 있다.!!

 

복구 명령어는

 

전체복구
extundelete /dev/sdb3 –restore-all

폴더복구
extundelete /dev/sdb3 –restore-directory /etc

파일복구
extundelete /dev/sdb3 –restore-file /etc/hosts

 

 

반응형