- Восстановление удаленных файлов Linux
- Немного теории
- 1. Safecopy
- 2. TestDisk
- 3. PhotoRec
- Выводы
- Top 5 Software for Linux data recovery
- Top 5 software for Linux data recoveryпјљThis tutorial displays 5 most important data recovery software programs that are available in the market.
- Part 1: 5 Linux Data Recovery Software
- 1. Mondo Rescue
- 2. Test Disk
- 3. Safe Copy
- 4. Photo Rec
- 5. DD rescue
- Part 2: Tips to manage Hard Drive on Linux
- Part 3: Free Data Recovery Software for Windows and Mac
Восстановление удаленных файлов Linux
Иногда случается, что мы случайно удаляем еще нужные нам файлы. Особенно это опасно в терминале Linux, поскольку здесь файлы удаляются не в корзину, а стираются с диска сразу и навсегда.
Понятно, что нужно аккуратно обращаться с командами удаления файлов, но что делать если уже все удалено, а файлы были важные и их нужно срочно восстановить? В некоторых случаях это возможно. В нашей сегодняшней статье мы рассмотрим восстановление удаленных файлов linux.
Немного теории
Каждый файл занимает определенное пространство на жестком диске, но файловая система для предоставления доступа к файлу дает нам ссылки на его начало, по которым любая программа может получить уже содержимое всего файла. Было бы неэффективно, если бы удаление файла приводило к полному перезаписыванию его области на диске.
Вместо этого, файловая система просто удаляет ссылку на эту область со своей базы, а затем помечает пространство, где находился файл, неразменным. Но на самом деле там еще остались все ваши файлы. Из этого делаем вывод, что если после удаления файловую систему очень быстро переключить в режим только для чтения, то все удаленные файлы могут быть восстановлены.
Если же вы работали с этой файловой системой и данные на диске были перезаписаны другими, то вы уже ничего сами не спасете. Возможно, вы слышали, что спецслужбы могут восстанавливать несколько раз перезаписанные данные по остаточному магнитному следу на диске. Это действительно так. Но для решения такой задачи нужно специальное оборудование, здесь недостаточно нескольких программ, нужен специальный лазер, который может считать магнитный след по краям дорожки и другая аппаратура. Так что про этот метод для себя можете забыть.
Ну а мы остановимся на программном восстановлении, когда данные были формально удалены, но физически еще находятся на диске в целостности и сохранности. Дальше рассмотрим несколько утилит, которые помогут восстановить удаленные файлы Linux.
1. Safecopy
Safecopy — это довольно простой инструмент для восстановления данных, который просто копирует данные из одного места в другое. Утилита, как таковая, не восстанавливает отдельные файлы. Она просто позволяет скопировать данные из поврежденного устройства на нормальное.
Разница между этой утилитой и другими программами копирования в том, что Safecopy не завершается при обнаружении каких-либо ошибок, будь то плохая операция чтения или поврежденный сектор. У нее есть множество дополнительных опций для настройки, а также возможность создания образа файловой системы из поврежденного носителя. Данные восстанавливаются тщательно и быстро, насколько это возможно.
Утилиту можно установить из официальных репозиториев вашего дистрибутива. Пользователи Ubuntu могут воспользоваться такой командой:
sudo apt install safecopy
Здесь вы не восстановите удаленные файлы, но вы можете скопировать поврежденные данные. Например, для видео несколько повреждений не играют большой роли. Для запуска восстановления файлов в linux с раздела /dev/sda1 выполните:
sudo safecopy /dev/sda1 /home/files/
Все файлы, которые удастся скопировать будут в /home/files/.
2. TestDisk
TestDisk — это очень мощный инструмент для восстановления данных. Он не пытается скопировать данные из поврежденного устройства, а позволяет исправить ошибки и проблемы на уровне разделов, которые могут мешать работе с вашими данными.
Утилита может восстанавливать потерянные разделы, исправлять таблицу разделов GPT и MBR, делать резервные копии дисков, восстанавливать загрузочные записи, а главное восстанавливать удаленные файлы с файловых систем NTFS, FAT, exFAT и файловых систем семейства Ext. Также вы можете копировать файлы даже с удаленных разделов для тех же файловых систем.
Способ работы утилиты очень сильно отличается в зависимости от нужного действия. Здесь вас ждет псевдографический мастер, который проведет вас через все шаги. Установить testdisk можно так же само из официальных репозиториев. В Ubuntu используйте для этого команду:
sudo apt install testdisk
Поскольку тема нашей статьи — восстановление файлов linux, рассмотрим как это делается с помощью этой утилиты. Запустите программу:
На первом шаге мастера выберите Create New Log:
Дальше выберите диск, с которым будем работать:
Выберите таблицу разделов на диске:
Для работы с файловой системой выберите пункт Advanced:
Далее выберите раздел, затем команду list:
Тут вы увидите все файлы, которые есть на этом разделе. Удаленные, но подлежащие восстановлению файлы будут помечены красным.
Работать с этой утилитой удобнее, чем с Photorec, потому что здесь вы можете выбрать только один нужный файл, а не восстанавливать сразу кучу мусора. Чтобы скопировать файл просто выберите его, нажмите c и выберите папку для сохранения. Правда, вы же понимаете, что для восстановления нужно, чтобы файлы были не перезаписаны, где-то чуть перезапишется и все.
3. PhotoRec
Наша последняя программа ориентирована в первую очередь на поиск и восстановление удаленных видео, фото, документов и архивов. Можно сказать, что это программа восстановления удаленных файлов linux. Преимущество PhotoRec заключается в том, что она полностью игнорирует файловую систему и смотрит на сырые данные, а это значит, что она все равно будет работать, даже если файловая система повреждена или переформатирована, но только в быстром режиме, там где стираются лишь заголовки.
Во избежание каких-либо проблем, здесь используется доступ только для чтения, этого вполне достаточно для восстановления данных. Но как я говорил раньше, вам нужно остановить все операции записи, как только вы поняли, что нужно восстановить файл. В противном случае нужные данные могут быть перезаписаны чем-то новым и вы уже не сможете их восстановить.
В утилиты есть несколько настроек. Вы можете указать расширения файлов, которые нужно найти, размер, дату изменения и так далее. Установить программу можно так же как и TestDisk — из официальных репозиториев.
Например, в Ubuntu выполните:
sudo apt install photorec
Что касается использования, то тут похожий на testdisk интерактивный интерфейс. Запустите утилиту командой:
Выберите диск, с которым нужно работать:
Выберите файловую систему:
Выберите способ сканирования (неразмеченное пространство/весь раздел) Затем выберите папку для сохранения результата:
Дождитесь завершения процесса:
Программа восстановит много файлов, и скорее всего больше чем вам нужно. Причем главная ее проблема в том, что имена файлов не сохраняются и вам придется еще поискать, чтобы найти есть ли там то что нужно.
Выводы
Эти три инструмента охватывают широкий спектр задач по восстановлению файлов Linux. Здесь вы сможете выполнить не только восстановление удаленных файлов Linux из ext4, но и исправить жесткий диск или скопировать файлы с поврежденных носителей.
А какие ваши любимые утилиты для восстановления данных? Какими вы пользуетесь? Напишите в комментариях!
На десерт видео от Discovery о том, как работает жесткий диск:
Источник
Top 5 Software for Linux data recovery
Top 5 software for Linux data recoveryпјљThis tutorial displays 5 most important data recovery software programs that are available in the market.
David Darlington
Sep 14, 2021 • Filed to: Windows Computer Solutions • Proven solutions
Data recovery is to make sure that the contents of the hard drive are restored without any issue and problem either with the help of the built-in functionalities of the computer or by installing any third-party software program. The best way to avoid the crisis is by making sure that enough preparation has been done in this regard so that the Disaster Recovery or DR plan could be launched. This tutorial has been written to make sure that the user gets the knowledge about the 5 most important data recovery software programs that are available in the market. It will also make sure that the user gets to know the interface so that the implementation of different commands becomes easy and effective.
Part 1: 5 Linux Data Recovery Software
The list that will be mentioned later comprises of those programs which are not only of high quality but also make sure that the data recovery is made simple and straightforward for all those users who are using Linux but are not tech-savvy at all. These Linux data recovery programs are stand-alone and for the same reason, they work on their own without any other software program installation. It means that only installing any of the 5 programs mentioned will make sure that the data is recovered from those sectors of the Linux operating system from where it cannot be accessed or recovered using the traditional methods.
1. Mondo Rescue
This program can be regarded as the best Linux data recovery software that is available for the disaster recovery of the Linux OS. It supports all old and new versions of Linux starting from i386 to FreeBSD. The best features according to which the users have rated this program are that it also supports the external storage devices such as tapes and CD/DVDs as storage devices for the data backup.
Advantages and disadvantages
- The non-raidВ file system can be backup using this program and when it comes to restoration it can be done in the form of a raid file system which also includes the root partition.
- TheВ hard disk partitionsВ can be restructured.
- The interface of the program is complex and for a normal user, it is very difficult to use.
2. Test Disk
Everyone loves to get free programs online and for all such users. Test Disk is a boon as it is free to use and no charges apply. It has been exclusively developed to make sure that the lost disk partitions are recovered all those sectors of the disk that are no bootable are fixed to make sure that they become bootable again. The error fixing caused by viruses and malware can also be fixed using this tool which makes the Linux data recovery very swift and easy.
Advantages and disadvantages
- The partition table can be fixed by using this software and if the partition has been deleted accidentally then it can also be recovered.
- NTFSВ boot sector backup recovery is also possible.
- The program is open-sourced which makes that several developers are updating which causes bugs and errors sometimes. It also causes faulty recovery of data.
3. Safe Copy
Yet another powerful and awesome tool that makes sure that the Linux data recovery is fast and reliable. Safe copy as its name suggests makes sure that as much data volume as possible is recovered without any issue and problem. This tool also uses the external storage media such as CD, DVD, and Bluray as the source of the data recovery which is one of the best features offered.
Advantages and disadvantages
The following are some of the advantages and disadvantage of using the tool for Linux data recovery:
- It gives new life to the file that is located on the damaged media.
- The overall usage of the tool is very easy and the data recovery can be done in just a few clicks.
- It specifies and skips the hard disk sizes which might cause issues in recovering data from the source.
4. Photo Rec
It is another stunning tool that has been developed to make sure that the data is recovered fromВ the damaged and old hard drives, CD-ROMS, DVD ROMS which are malfunctioning. As the name suggests this program is also used to make sure that the data is recovered from the digital camera memory as well which is actually in the form of pictures. It directly goes for the data ignoring the file system in place due to which data from severely damaged media can also be restored without any issue and problem.
Advantages and disadvantages
- The interface of the program increases its usability as a novice user can also operate the program easily.
- As mentioned before the data recovery from badly damaged media is also possible without any issue.
- Again the tool is open source which makes it is a bad choice for all those users who are of advanced level due to glitches and bugs that are encountered.
5. DD rescue
It is one of the most intelligent Linux data recovery programs that are free and open-sourced. The contents from the block disk are copied to the other drive by this program and during this process, if the read data encounters errors then the program does its best to make sure that the data is backed up immediately to the destination drive. The only thing user needs to do is to make sure that the log file is read and run in reverse.
Advantages and disadvantages
- The tool works automatically and the data restoration is very effective and efficient.
- The bad sectors of the disk that need fixtures and detected by the program and highlighted.
- The log file can be used to read multiple commands that copy different areas of the files. It makes the process messy and muddled at times.
Part 2: Tips to manage Hard Drive on Linux
Following is a list of most important commands to make sure that the hard disk is managed effectively using the Linux OS:
- View partitions of hard drivesВ # fdisk -l /dev/sdaВ command is to be used.
- Once the partition is created it can be formatted using theВ # mkfs.ext3 /dev/sda7В command.
- To view the size of the partitionВ # fdisk -s /dev/sda7 4843566В command should be run.
- Partition table issues lead to most of the issues in hard drives running on Linux OS. The code might be ling for the novice users but it has to be run in the same manner to avoid the hard drive related issues in Linux:
$ fdiskВ /dev/sda
The number of cylinders for this disk is set to 9729.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): p
Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xf6edf6ed
Device BootВ В В В В StartВ В В В В В В В EndВ В В В В BlocksВ В IdВ System
/dev/sda1В В В В В В В В В В В В В В 1В В В В В В В 1959В В В 15735636В В В cВ W95 FAT32 (LBA)
/dev/sda2В В В В В В В В В В В 1960В В В В В В В 5283В В В 26700030В В В fВ W95 Ext’d (LBA)
/dev/sda3В В В В В В В В В В В 5284В В В В В В В 6528В В В 10000462+В В 7В HPFS/NTFS
/dev/sda4В В В В В В В В В В В 6529В В В В В В В 9729В В В 25712032+В В cВ W95 FAT32 (LBA)
/dev/sda5В В *В В В В В В В 1960В В В В В В В 2661В В В В 5638752В В 83В Linux
/dev/sda6В В В В В В В В В В В 3265В В В В В В В 5283В В В 16217586В В В bВ W95 FAT32
/dev/sda7В В В В В В В В В В В 2662В В В В В В В 3264В В В В 4843566В В 83В Linux
Partition table entries are not in disk order
Command (m for help): x
Expert command (m for help): f
Done.
Expert command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Part 3: Free Data Recovery Software for Windows and Mac
Here I would like to recommend a professional data recovery software for you.RecoveritВ andВ Recoverit for Mac, a safe and effective data recovery software, retrieves your lost videos, photos, music, documents, emails, etc. from your PC’s hard drive as well as from USB drives, external hard drives, and other storage devices.
- Completely recover deleted, formatted, and lost data.
- Recover documents, images, videos, audio, emails, and archives.
- Recover data from Windows and Mac hard drives and most storage devices.
- Preview lets you enjoy data recovery in advance.
- An easy-to-use wizard, no prior recovery skills needed
Источник