Restaurar arquivo ou diretório apagado em file system ext3
Após acidentalmente apagar os arquivos de minha partição de backup, relato aqui minha experiência na recuperação dos dados. O artigo trata de recuperação de arquivos em partições com sistema de arquivos ext3 usando o ext3grep.
[ Hits: 61.508 ]
Por: Glauber GF em 30/11/2010 | Blog: http://www.vivaolinux.com.br/~mcnd2
Running ext3grep version 0.8.0
ext3grep: invalid option -- h
No action specified; implying --superblock.
Usage: ext3grep [options] [--] device-file
Options:
--version, -[vV] Print version and exit successfully.
--help, Print this help and exit successfully.
--superblock Print contents of superblock in addition to the rest.
If no action is specified then this option is implied.
--print Print content of block or inode, if any.
--ls Print directories with only one line per entry.
This option is often needed to turn on filtering.
--accept filen Accept "filen" as a legal filename. Can be used multi-
ple times. If you change any --accept you must remove
BOTH stage* files!
--journal Show content of journal.
--show-path-inodes Show the inode of each directory component in paths.
Filters:
--group grp Only process group "grp".
--directory Only process directory inodes.
--after dtime Only entries deleted on or after "dtime".
--before dtime Only entries deleted before "dtime".
--deleted Only show/process deleted entries.
--allocated Only show/process allocated inodes/blocks.
--unallocated Only show/process unallocated inodes/blocks.
--reallocated Do not suppress entries with reallocated inodes.
Inodes are considered "reallocated" if the entry
is deleted but the inode is allocated, but also when
the file type in the dir entry and the inode are
different.
--zeroed-inodes Do not suppress entries with zeroed inodes. Linked
entries are always shown, regardless of this option.
--depth depth Process directories recursively up till a depth
of "depth".
Actions:
--inode-to-block ino Print the block that contains inode "ino".
--inode ino Show info on inode "ino".
If --ls is used and the inode is a directory, then
the filters apply to the entries of the directory.
If you do not use --ls then --print is implied.
--block blk Show info on block "blk".
If --ls is used and the block is the first block
of a directory, then the filters apply to entries
of the directory.
If you do not use --ls then --print is implied.
--histogram=[atime|ctime|mtime|dtime|group]
Generate a histogram based on the given specs.
Using atime, ctime or mtime will change the
meaning of --after and --before to those times.
--journal-block jblk Show info on journal block "jblk".
--journal-transaction seq
Show info on transaction with sequence number "seq".
--dump-names Write the path of files to stdout.
This implies --ls but suppresses it's output.
--search-start str Find blocks that start with the fixed string "str".
--search str Find blocks that contain the fixed string "str".
--search-inode blk Find inodes that refer to block "blk".
--search-zeroed-inodes Return allocated inode table entries that are zeroed.
--inode-dirblock-table dir
Print a table for directory path "dir" of directory
block numbers found and the inodes used for each file.
--show-journal-inodes ino
Show copies of inode "ino" still in the journal.
--restore-inode ino[,ino,...]
Restore the file(s) with known inode number "ino".
The restored files are created in ./RESTORED_FILES/
with their inode number as extension (ie, inode.12345).
--restore-file "path" Will restore file "path". "path" is relative to root
of the partition and does not start with a "/" (it
must be one of the paths returned by --dump-names).
The restored directory, file or symbolic link is
created in the current directory as ./"path".
--restore-all As --restore-file but attempts to restore everything.
The use of --after is highly recommended because the
attempt to restore very old files will only result in
them being hard linked to a more recently deleted file
and as such polute the output.
--show-hardlinks Show all inodes that are shared by two or more files.
Procuraremos no device (/dev/sda4) onde se encontravam os arquivos com a opção "--search" no diretório "06-Usuários", que notamos que tinha sido apagado.
.-- File type in dir_entry (r=regular file, d=directory, l=symlink)
| .-- D: Deleted ; R: Reallocated
Indx Next | Inode | Deletion time Mode File name
==========+==========+----------------data-from-inode------+-----------+=========
0 1 d 1228801 drwxr-xr-x .
1 2 d 2 drwxr-xr-x ..
2 3 d 1228802 drwxrwxrwx 11-Filmes
3 4 d 1228920 drwxrwxrwx 01-Biblioteca
4 5 d 1229154 drwxrwxrwx 02-Currículos
5 6 d 1229171 drwxrwxrwx 03-Fotos
6 7 d 4047372 drwxrwxrwx 05-Músicas
7 8 d 5251448 D 1289089604 Sat Nov 6 22:26:44 2010 drwxrwxrwx 06-Usuários
8 9 d 5252816 drwxrwxrwx 10-Windows
9 10 d 5424119 D 1289089624 Sat Nov 6 22:27:04 2010 drwxrwxrwx 12-Documentários
10 11 d 5424151 drwxrwxrwx 04-Linux
11 end d 5653482 drwxrwxrwx 07-Vídeos_comedias
WARNING: inode 1228801 was reallocated!
Podemos ver com o resultado do comando acima que o "D" foram os diretórios que foram apagados.
Operadoras de Banda Larga com Medição de Velocidade
AutoCAD 2007 vs. DraftSight v1r3.1 2013
Transações Financeiras (Warsaw vs User Agent Overrider) - Itaú Bankline 30 horas
Deixando a Área de Trabalho animada com slides no GNOME
ownCloud - Em poder de suas mãos (Private Cloud)
Configuração de Servidor NFSv4 no CentOS 6
Permissões - referência rápida
Como atualizar o Ubuntu Dapper (6.06) para Edgy (6.10)
Criando discos virtuais em máquinas remotas
IA Turbina o Desktop Linux enquanto distros renovam forças
Como extrair chaves TOTP 2FA a partir de QRCODE (Google Authenticator)
Linux em 2025: Segurança prática para o usuário
Desktop Linux em alta: novos apps, distros e privacidade marcam o sábado
IA chega ao desktop e impulsiona produtividade no mundo Linux
Atualizando o Fedora 42 para 43
Como saber se o seu e-mail já teve a senha vazada?
Como descobrir se a sua senha já foi vazada na internet?
Preciso recuperar videos *.mp4 corrompidos (6)
É normal não gostar de KDE? (11)
Secure boot, artigo interessante, nada técnico. (2)









