Dimensione: 456
Commento:
|
Dimensione: 21267
Commento: ok fino a "Tratto da [[http://www.forensicswiki.org/wiki/Ddrescue|Forensics Wiki]]:"
|
Le cancellazioni sono segnalate in questo modo. | Le aggiunte sono segnalate in questo modo. |
Linea 1: | Linea 1: |
#acl GiuseppeTerrai:read,write,revert GruppoConsiglio:read,write,revert GruppoAdmin:admin,read,write,revert -All:read -Known:read | |
Linea 3: | Linea 2: |
#LANGUAGE it [[BR]] [[Include(GiuseppeTerrasi/Prove3)]] {{{ #!frame align=clear }}} appoggiarsi anche su queste http://www.debian.org/vote/howto_proposal http://www.debian.org/vote/howto_follow http://www.debian.org/vote/2010/vote_002 http://www.debian.org/vote/2010/vote_001 concernet |
#language it [[Indice(depth=1)]] = Introduzione = I file eliminati o persi accidentalmente possono essere recuperati da qualunque dispositivo di memorizzazione, ottico o di massa, con l'uso di programmi specifici molti dei quali disponibili nei [:Repository:repository] di '''Ubuntu'''. Questa guida spiega come recuperare i propri dati. Occorre sottolineare che il modo migliore per evitare la perdita dei dati è di effettuare con cadenza regolare delle copie di backup e a questo proposito si invita a leggere le relative [:AmministrazioneSistema/Backup:guide]. = Premessa = Se il dispositivo ha un guasto meccanico, per il recupero dei dati, si consiglia di lavorare su una sua immagine al fine di non danneggiarlo ulteriormente con operazioni di scrittura che potrebbero rendere i dati irrecuperabili se sovrascritti. Qualora si verificasse questa evenienza è raccomandabile spegnere immediatamente il computer e in seguito utilizzarlo solo mediante sistemi ''live'' in modo da potere analizzare i dispositivi soggetti a problematiche operando a [:Hardware/DispositiviPartizioni/MontarePartizioni:"partizioni smontate"]. Viceversa, se il guasto non è di natura meccanica, è possibile recuperare i dati direttamente dal dispositivo. Per potere eseguire il recupero è necessario disporre di un altro dispositivo di archiviazione. Questo dovrà essere di capienza pari o superiore. Considerare la necessità di ulteriore spazio qualora sia richiesto di intervenire mediante la creazione di un'immagine. Per avviare il sistema in modalità ''live'' è sufficiente [http://www.ubuntu-it.org/index.php?page=Ottenere_Ubuntu disporre] di una copia di '''Ubuntu Desktop Editition''' da potere avviare con il [:Installazione/Grafica:CD-ROM] o da un [:Installazione/DaSupportoUsb:dispositivo USB]. In alternativa, qualora si disponga si poca ram o si è privi di una connessione ad internet, è possibile utilizzare [http://ubuntu-rescue-remix.org/ Ubuntu rescue remix] oppure [http://www.sysresccd.org/Main_Page System Rescue Cd] i quali dispongono molti dei programmi di seguito menzionati. Qualora le applicazioni di seguono esposte non riescano a raggiungere il risultato desiderato, a seconda dell'importanza dei dati presenti, si consideri anche la possibilità di richiedere una consulenza professionale in merito. Questo perché l'[http://it.wikipedia.org/wiki/Informatica_forense informatica forense] è una scienza molto vasta e molte applicazioni non sono accessibili ad un pubblico "casalingo" a causa dei loro costi molto elevati. = Recuperare le partizioni = Se è stato fatto un errore durante il partizionamento e la partizione non compare più nella tabella delle partizioni, a patto che non si siano scritti dei dati sullo spazio specifico della tabelle delle partizioni, i dati saranno ancora presenti e recuperabili. == GNU Parted == E' possibile recuperare le partizioni utilizzando il comando ''parted''. Innanzitutto, quando si modifica la tabella delle partizioni sul disco rigido, è necessario assicurarsi che nessuna partizione sul disco sia montata, compreso lo [:Hardware/DispositiviPartizioni/PartizioniUbuntu#swap:spazio di swap]. Per smontare lo spazio di swap e avviare '''Parted''' procedere come segue: * Avviare una delle distribuzioni live citate in precedenza. * Digitare in una finestra di [:AmministrazioneSistema/RigaDiComando:terminale] il seguente comando: {{{ sudo swapoff -a }}} * Eseguire '''Parted''' digitando in un terminale il seguente comando: {{{ sudo parted /dev/sda }}} dove `/dev/sda` è il dispositivo da recuperare. * Utilizzare l'opzione di recupero: {{{ rescue Inizio File }}} dove "Inizio" è l'area del disco in cui si ritiene che la partizione inizi e "Fine" indica la sua fine. Nel caso in cui '''parted''' trovi una partizione potenziale, verrà chiesta conferma per la sua aggiunta nella tabella delle partizioni. == Testdisk == In alternativa a '''Parted''' è possibile [:AmministrazioneSistema/InstallareProgrammi:installare] [apt://testdisk testdisk]. Avviare la scansione dei dispositivi con '''Testdisk''' digitando in una finestra di terminale il seguente comando: {{{ sudo testdisk }}} Utilizzare i menù per recuperare le partizioni. == Gpart == Un altro modo per controllare e ricreare la tabella delle partizioni consiste nell'[:AmministrazioneSistema/InstallareProgrammi:installare] ed utilizzare [apt://gpart gpart]. * Digitare in una finestra di terminale il seguente comando {{{ sudo gpart /dev/sda }}} dove `/dev/sda` è il dispositivo da recuperare. * È possibile ripristinare la tabella delle partizioni, solo dopo aver verificato con la massima attenzione (viceversa si invita a scrivere su un altro dispositivo), digitando in una finestra di terminale il seguente comando {{{ sudo gpart -W /dev/sda /dev/sda }}} = Creare un immagine di un dispositivo = Per ottenere l'immagine di un dispositivo danneggiato, in preparazione del salvataggio dei file, è disponibile il programma '''GNU ddrescue''' installabile tramite il pacchetto [apt://gddrescue gddrescue]. In seguito il suo comando sarà ''ddrescue''. Per una breve panoramica delle sue funzionalità e per approfondimenti si invita alla lettura del [http://www.gnu.org/software/ddrescue/ddrescue_it.html seguente documento]. Prima di procedere, bisogna tenere presente che i filesystem di tipo [:Hardware/DispositiviPartizioni/MontarePartizioni/Fat:Fat] dispongono di un limite di 4GiB alla dimensione di ciascun file. E' tipico delle unità USB disporre di questo tipo di filesystem. Se si è a conoscenza che l'immagine finale sarà superiore a tale dimensione è necessario utilizzare file system che supporti capacità superiori come ad esempio [:Hardware/DispositiviPartizioni/MontarePartizioni/Ext3:Ext3] o altri. Per utilizzare '''GNU ddrescue''' digitare in una finestra di terminale un comando avente la seguente sintassi: {{{ ddrescue [options] partizione_da_recuperare destinazione_immagine destinazione_file_di_log }}} Quindi, ad esempio {{{ sudo ddrescue -r 3 /dev/sda /media/usbdrive/image /media/usbdrive/logfile }}} In questo caso il comando ''ddrescue'' di recuperare l'immagine dal dispositivo `dev/sda` e di salvarla in `/media/usbdrive/image`; inoltre, creerà un file di log in `/media/usbdrive/logfile`. L'opzione `-r 3` rappresenta il numero di tentativi di lettura che ''ddrescue'' farà qualora incontri degli errori. `-1` invita il programma ad eseguire un numero infinito di tentativi. Il passo successivo potrebbe essere: {{{ sudo ddrescue -r 3 -C /dev/sda /media/usbdrive/image /media/usbdrive/logfile }}} In questo caso è stata aggiunta l'opzione `-C` che invita il programma circoscrivere la lettura all'interno dei file già presenti nel registro (o file di log) creato in precedenza . Tratto da [[http://www.forensicswiki.org/wiki/Ddrescue|Forensics Wiki]]: {{{ ---- First you copy as much data as possible, without retrying or splitting sectors: {{{ddrescue --no-split /dev/hda1 imagefile logfile }}} Now let it retry previous errors 3 times, using uncached reads: {{{ddrescue --direct --max-retries=3 /dev/hda1 imagefile logfile }}} If that fails you can try again but retrimmed, so it tries to reread full sectors: {{{ddrescue --direct --retrim --max-retries=3 /dev/hda1 imagefile logfile }}} ---- }}} Altri esempi: These two examples are taken directly from the ddrescue info pages. Example 1: Rescue an ext2 partition in /dev/hda2 to /dev/hdb2 {{{ ddrescue -r3 /dev/hda2 /dev/hdb2 logfile e2fsck -v -f /dev/hdb2 mount -t ext2 -o ro /dev/hdb2 /mnt }}} Example 2: Rescue a CD-ROM in /dev/cdrom {{{ ddrescue -b 2048 /dev/cdrom cdimage logfile }}} write cdimage to a blank CD-ROM = Estrarre il filesystem da un immagine recuperata = Ora che il drive è stato ripreso, è possibile ripristinare il filesystem dall'immagine. Se il filesystem non è recuperabile, è possibile tentare di recuperare i singoli file. == Montare le partizioni sull'immagine == Se è stato recuperato l'intero disco, è possibile montare le singole partizioni sull'immagine utilizzando l'opzione "Offset" montanto il filesystem "in loop". '''mmls''', disponibile nel pacchetto [apt://sleuthkit sleuthkit] è in grado di mostrare le partizioni che si trovano all'interno di un'immagine: {{{ mmls file -b DOS Partition Table Offset Sector: 0 Units are in 512-byte sectors Slot Start End Length Size Description 00: ----- 0000000000 0000000000 0000000001 0512B Primary Table (#0) 01: ----- 0000000001 0000000031 0000000031 0015K Unallocated 02: 00:01 0000000032 0001646591 0001646560 0803M DOS FAT16 (0x06) 03: 00:00 0001646592 0002013183 0000366592 0179M DOS FAT16 (0x06) }}} Come è possibile vedere il programma mostra più partizioni. In questo esempio, vogliamo montare la partizione DOS a partire dal blocco 32. Per calcolare il numero di byte, moltiplicare per 512: {{{ $ bc bc 1.06 Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc. This is free software with ABSOLUTELY NO WARRANTY. For details type `warranty'. 32 * 512 16384 quit }}} Nota: Per disporre di un interfaccia grafica per ''sleuthkit'' installare il pacchetto [apt://autopsy autopsy]. Per approfondimenti sul programma si rimanda al [http://www.sleuthkit.org/autopsy/desc.php sito ufficiale]. Mount the partition: {{{ sudo mount -o loop,offset=16384 file mnt }}} (32 multiplied by 512 byte blocks = 16384) For mounting a typical NTFS partition created by Windows use: {{{ sudo mount -t ntfs -o r,force,loop,offset=32256 file mnt }}} (63 multiplied by 512 byte blocks = 32256) == Estrarre singoli file dalla partizione recuperata == === Foremost === Foremost è un tool da riga di comando in grado di recuperare file da un certo numero di file system, inclusi i fat, ext3 e NTFS. Può essere installato ed eseguito dal cd live. Fare il boot da un cd live, abilitare i repository universe e installare [apt://foremost foremost] Foremost è in grado di recuperare file da una immagine del disco o dal disco direttamente. Se l'unità ha subito problemi di hardware, utilizzare gnuddrescue per l'immagine del primo disco. (fare anchor a gddrescue). Supponendo che il file persi sono su `/dev/hda`, è necessario creare una cartella scrivibile su un altro disco in cui è possibile inserire i file recuperati (un disco esterno USB capiente ad esempio, di seguito `dev/sdb`). Montare il disco esterno e creare al suo interno una cartella chiamata `foremost`: {{{ sudo mount /dev/sdb1 /recovery sudo mkdir /recovery/foremost }}} Avviare '''foremost''' digitando in una finestra di terminale il seguente comando: {{{ sudo foremost -i /dev/hda -o /recovery/foremost }}} Per avviare '''foremost''' su un file immagine semplicemente sostituire il percorso {{{ sudo foremost -i image -o /recovery/foremost }}} I file recuperati saranno di proprietà dell'utente root. Per cambiare i permessi: {{{ sudo chown -R youruser:youruser /recovery/foremost }}} Use the -w switch to obtain only an audit of recoverable files: {{{ sudo foremost -w -i /dev/hda -o /recovery/foremost }}} To recover only specific file types, use the -t switch: {{{ sudo foremost -t jpg -i /dev/hda -o /recovery/foremost }}} Available types: || '''Filetype''' || '''Comment''' || || jpg || Support for the JFIF and Exif formats including implementations used in modern digital cameras. || || gif |||| || png |||| || bmp || Support for windows bmp format. || || avi |||| || exe || Support for Windows PE binaries, will extract DLL and EXE files along with their compile times. || || mpg || Support for most MPEG files (must begin with 0x000001BA) || || wav |||| || riff || This will extract AVI and RIFF since they use the same file format (RIFF). note faster than running each separately. || || wmv || Note may also extract -wma files as they have similar format. || || mov |||| || pdf |||| || ole || This will grab any file using the OLE file structure. This includes PowerPoint, Word, Excel, Access, and StarWriter || || doc || Note it is more efficient to run OLE as you get more bang for your buck. If you wish to ignore all other ole files then use this. || || zip || Note is will extract .jar files as well because they use a similar format. Open Office docs are just zip’d XML files so they are extracted as well. These include SXW, SXC, SXI, and SX? for undetermined OpenOffice files. || || rar |||| || htm |||| || cpp || C source code detection, note this is primitive and may generate documents other than C code. || || all || Run all pre-defined extraction methods. [Default if no -t is specified] || === Scalpel === Scalpel is a fast file carver that reads a database of header and footer definitions and extracts matching files from a set of image files or raw device files. It is similar to foremost and may have some improvements. By default, all file types in the database (/etc/scalpel/scalpel.conf) are commented out. To specify which filetypes you want to carve, you need to edit the file and uncomment each line. sudo scalpel FILE -o Directory Where FILE is the image file (or device) and Directory is the output directory. === Magic Rescue === Another program that scans for files using "magic bytes" to identify their presence and type, and which can be extended for many file types using "recipes", can be obtained by installing, using [[InstallingSoftware| any method]], the package {{{magicrescue}}}. Note that most of the provided recipes need other software installed to work, so open the desired recipes in {{{/usr/share/magicrescue/recipes/}}} using a text editor and read the comments contained. If you want to recover (for example) ''gzip'' files and ''PNG'' images from a partition named /dev/sda1, you can run {{{ mkdir ~/output sudo magicrescue -r gzip -r png -d ~/output /dev/hdb1 }}} This will write all recovered files in a directory {{{output}}} inside your home directory. === Photorec === '''PhotoRec''' è un programma di recupero dati progettato per recuperare immagini perse dalla memoria della fotocamera digitale o anche da dischi fissi. Successivamente il supporto è stato esteso anche per file non audio o video. Consente la ricerca di 80 diversi tipi di file. '''PhotoRec''' è parte del pacchetto [apt://testdisk testdisk]. To run Photorec on an image file, do: {{{ sudo photorec imagefilename }}} To recover files directly from a device, run photorec without any arguments and you will be given a menu of available devices: {{{ sudo photorec }}} See [http://www.psychocats.net/ubuntucat/recovering-windows-files-with-a-ubuntu-cd-iii-deleted-files/ this link] for a detailed description of how to use Photorec. === recoverjpeg === '''recoverjpeg''' è un programma specifico per l'identificazione e il recupero delle immagini in formato `.jpeg`. Installare il pacchetto [apt://recoverjpeg recoverjpeg] e avviarlo digitando in una finestra di terminale il seguente comando: {{{ sudo recoverjpeg /dev/hda1 }}} sostituendo `/dev/hda1` con il dispositivo sul quale si desidera indagare. I file recuperati verranno salvati nella propria cartella '''Home'', with names following the pattern {{{image*.jpg}}}. == Ntfsprogs == [https://help.ubuntu.com/community/DataRecovery/NtfsUndelete NtfsUndelete] can recover deleted files from an NTFS file-system. The Windows and LiveCd versions have a very nice intuitive gui but the linux one is probably stronger and does not have a front-end gui at the moment. Briefly, it has 3 modes 1. "Scan", searches for deleted files and find info about them 1. "Undelete", see note below ... 1. "Copy", err i am not sure what this does as i am not a wizard The best simple guide i have found so far 24-11-2010) is [http://www.sucka.net/2010/04/recover-deleted-files-with-ntfsundelete-from-a-ubuntu-livecd/ questa]. Obviously with a name like that i was careful about where i opened the page but it was fine. When undeleting chose which files to undelete and where to undelete them too. By default this appears to be the desktop of the OS you are booted into, whether that is a LiveCd or on a different partition or drive. For a LiveCd or LiveUsb you will need to move them onto Usb-stick or safe partition before rebooting as the desktop gets forgotten on LiveCds unless you are using a "Persistent image". To search {{{ ntfsundelete /dev/sda2 }}} To undelete, although this might be a little wrong, the"-" at the end worries me. {{{ ntfsundelete /dev/sda2 -u -i 3689 -o work.doc -d ~ }}} For better information on using ntfsundelete please see the separate page [https://help.ubuntu.com/community/DataRecovery/NtfsUndelete NtfsUndelete], particularly the External Links there. == Sleuth Kit and Autopsy == (Obtained the following from http://www.sleuthkit.org/autopsy/desc.php) The Autopsy Forensic Browser is a graphical interface to the command line digital investigation analysis tools in The Sleuth Kit. Together, they can analyze Windows and UNIX disks and file systems (NTFS, FAT, UFS1/2, Ext2/3). The Sleuth Kit and Autopsy are both Open Source and run on UNIX platforms. As Autopsy is HTML-based, you can connect to the Autopsy server from any platform using an HTML browser. Autopsy provides a "File Manager"-like interface and shows details about deleted data and file system structures. === Autopsy === Autopsy can be run from the "live" CD, but you must specify an address to which you can connect remotely. You must also specify an external disk on which it can save the extracted information. For example, assuming you have an external disk mounted to {{{/media/disk}}} with an autopsy folder on it and your IP address is {{{192.168.0.1}}}, you can run: {{{ sudo autopsy -d /media/disk/autopsy 192.168.0.1 }}} === Sleuthkit === Extract unallocated (deleted) blocks from a disk or disk image. Example: {{{ dls inputimage > outputimage }}} Use any data carving tool to search the output image for files. List file and directory names in a forensic image. fls lists the files and directory names in the image and can display file names of recently deleted files for the directory using the given inode. This includes deleted files. If you have imaged your filesystem to a file named "loopfile", you can list the contents by running: {{{ fls loopfile -r -f fat -i raw r/r 3: test (Volume Label Entry) r/r * 5: sample.docx r/r * 7: sample.pptx r/r * 9: sample.xlsx }}} Copy file by inode. icat opens the named image(s) and copies the file with the specified inode number to standard output. Example: fls has shown you the inode number of some files on an image. To recover a file by using th einode number run: {{{ icat -r -f fat -i raw loopfile 5 > sample.docx }}} sorter - Sort files in an image into categories based on file type. Sorter is a Perl script that analyzes a file system to organize the allocated and unallocated files by file type. Example: This will sort all the files found in /dev/sdc1 and put image files in a directory named "out": {{{ sudo sorter -h -s -i raw -f fat -d out -C /usr/share/sleuthkit/windows.sort /dev/sdc1 }}} Here is a description of a script that will pull all files from an image using fls and icat: http://forums.gentoo.org/viewtopic-t-365703.html Another, similar script which attempts to "rebuild" the filesystem directory structure plus file content: http://matt.matzi.org.uk/2008/07/03/reconstructing-heavily-damaged-hard-drives/ == Cleaning up == from:[[http://www.linux.com/articles/56588|How to recover lost files after you accidentally wipe your hard drive]] Sort certain types of files: {{{ sudo mkdir recovery/VID recovery/JPG find recovery/ -name "*.avi" | xargs -i mv {} recovery/VID/ find recovery/ -name "*.mpg" | xargs -i mv {} recovery/VID/ find recovery/ -name "*.jpg" | xargs -i mv {} recovery/JPG/ }}} Eliminate small photos: {{{ sudo mkdir recovery/SMALL find recovery/JPG/ -name "*.jpg" -size -1024k | xargs -i mv {} recovery/SMALL/ }}} Rename jpegs according to exif data: {{{ find JPG/ -name "*.jpg" | xargs -i jhead -nf%Y%m%d-%H%M%S {} }}} Then, remove duplicates. {{{ find /var/recovery/JPG/ -name "*a.jpg" | xargs -i mv {} /var/recovery/JPG/DUPS/ }}} Copy files with matching strings: {{{ cd recovery mkdir ../copy/ grep -l "enter the string of text here" *.doc | xargs -i cp {} ../copy/ }}} = Ulteriori risorse = * [https://help.ubuntu.com/community/DataRecovery Documento originale] * http://www.sleuthkit.org/informer/sleuthkit-informer-14.html#recover * http://goinggnu.wordpress.com/2008/02/14/recover-deleted-files-from-memory-card * http://www.linuxquestions.org/questions/linux-hardware-18/can-i-use-linux-to-recover-files-from-corrupted-hard-drive-784550/ ---- CategoryHomepage |
Introduzione
I file eliminati o persi accidentalmente possono essere recuperati da qualunque dispositivo di memorizzazione, ottico o di massa, con l'uso di programmi specifici molti dei quali disponibili nei [:Repository:repository] di Ubuntu. Questa guida spiega come recuperare i propri dati.
Occorre sottolineare che il modo migliore per evitare la perdita dei dati è di effettuare con cadenza regolare delle copie di backup e a questo proposito si invita a leggere le relative [:AmministrazioneSistema/Backup:guide].
Premessa
Se il dispositivo ha un guasto meccanico, per il recupero dei dati, si consiglia di lavorare su una sua immagine al fine di non danneggiarlo ulteriormente con operazioni di scrittura che potrebbero rendere i dati irrecuperabili se sovrascritti. Qualora si verificasse questa evenienza è raccomandabile spegnere immediatamente il computer e in seguito utilizzarlo solo mediante sistemi live in modo da potere analizzare i dispositivi soggetti a problematiche operando a [:Hardware/DispositiviPartizioni/MontarePartizioni:"partizioni smontate"]. Viceversa, se il guasto non è di natura meccanica, è possibile recuperare i dati direttamente dal dispositivo.
Per potere eseguire il recupero è necessario disporre di un altro dispositivo di archiviazione. Questo dovrà essere di capienza pari o superiore. Considerare la necessità di ulteriore spazio qualora sia richiesto di intervenire mediante la creazione di un'immagine.
Per avviare il sistema in modalità live è sufficiente [http://www.ubuntu-it.org/index.php?page=Ottenere_Ubuntu disporre] di una copia di Ubuntu Desktop Editition da potere avviare con il [:Installazione/Grafica:CD-ROM] o da un [:Installazione/DaSupportoUsb:dispositivo USB]. In alternativa, qualora si disponga si poca ram o si è privi di una connessione ad internet, è possibile utilizzare [http://ubuntu-rescue-remix.org/ Ubuntu rescue remix] oppure [http://www.sysresccd.org/Main_Page System Rescue Cd] i quali dispongono molti dei programmi di seguito menzionati.
Qualora le applicazioni di seguono esposte non riescano a raggiungere il risultato desiderato, a seconda dell'importanza dei dati presenti, si consideri anche la possibilità di richiedere una consulenza professionale in merito. Questo perché l'[http://it.wikipedia.org/wiki/Informatica_forense informatica forense] è una scienza molto vasta e molte applicazioni non sono accessibili ad un pubblico "casalingo" a causa dei loro costi molto elevati.
Recuperare le partizioni
Se è stato fatto un errore durante il partizionamento e la partizione non compare più nella tabella delle partizioni, a patto che non si siano scritti dei dati sullo spazio specifico della tabelle delle partizioni, i dati saranno ancora presenti e recuperabili.
GNU Parted
E' possibile recuperare le partizioni utilizzando il comando parted.
Innanzitutto, quando si modifica la tabella delle partizioni sul disco rigido, è necessario assicurarsi che nessuna partizione sul disco sia montata, compreso lo [:Hardware/DispositiviPartizioni/PartizioniUbuntu#swap:spazio di swap].
Per smontare lo spazio di swap e avviare Parted procedere come segue:
- Avviare una delle distribuzioni live citate in precedenza.
Digitare in una finestra di [:AmministrazioneSistema/RigaDiComando:terminale] il seguente comando:
sudo swapoff -a
Eseguire Parted digitando in un terminale il seguente comando:
sudo parted /dev/sda
dove /dev/sda è il dispositivo da recuperare.
Utilizzare l'opzione di recupero:
rescue Inizio File
dove "Inizio" è l'area del disco in cui si ritiene che la partizione inizi e "Fine" indica la sua fine. Nel caso in cui parted trovi una partizione potenziale, verrà chiesta conferma per la sua aggiunta nella tabella delle partizioni.
Testdisk
In alternativa a Parted è possibile [:AmministrazioneSistema/InstallareProgrammi:installare] [apt://testdisk testdisk].
Avviare la scansione dei dispositivi con Testdisk digitando in una finestra di terminale il seguente comando:
sudo testdisk
Utilizzare i menù per recuperare le partizioni.
Gpart
Un altro modo per controllare e ricreare la tabella delle partizioni consiste nell'[:AmministrazioneSistema/InstallareProgrammi:installare] ed utilizzare [apt://gpart gpart].
Digitare in una finestra di terminale il seguente comando
sudo gpart /dev/sda
dove /dev/sda è il dispositivo da recuperare.
È possibile ripristinare la tabella delle partizioni, solo dopo aver verificato con la massima attenzione (viceversa si invita a scrivere su un altro dispositivo), digitando in una finestra di terminale il seguente comando
sudo gpart -W /dev/sda /dev/sda
Creare un immagine di un dispositivo
Per ottenere l'immagine di un dispositivo danneggiato, in preparazione del salvataggio dei file, è disponibile il programma GNU ddrescue installabile tramite il pacchetto [apt://gddrescue gddrescue]. In seguito il suo comando sarà ddrescue.
Per una breve panoramica delle sue funzionalità e per approfondimenti si invita alla lettura del [http://www.gnu.org/software/ddrescue/ddrescue_it.html seguente documento].
Prima di procedere, bisogna tenere presente che i filesystem di tipo [:Hardware/DispositiviPartizioni/MontarePartizioni/Fat:Fat] dispongono di un limite di 4GiB alla dimensione di ciascun file. E' tipico delle unità USB disporre di questo tipo di filesystem. Se si è a conoscenza che l'immagine finale sarà superiore a tale dimensione è necessario utilizzare file system che supporti capacità superiori come ad esempio [:Hardware/DispositiviPartizioni/MontarePartizioni/Ext3:Ext3] o altri.
Per utilizzare GNU ddrescue digitare in una finestra di terminale un comando avente la seguente sintassi:
ddrescue [options] partizione_da_recuperare destinazione_immagine destinazione_file_di_log
Quindi, ad esempio
sudo ddrescue -r 3 /dev/sda /media/usbdrive/image /media/usbdrive/logfile
In questo caso il comando ddrescue di recuperare l'immagine dal dispositivo dev/sda e di salvarla in /media/usbdrive/image; inoltre, creerà un file di log in /media/usbdrive/logfile. L'opzione -r 3 rappresenta il numero di tentativi di lettura che ddrescue farà qualora incontri degli errori. -1 invita il programma ad eseguire un numero infinito di tentativi.
Il passo successivo potrebbe essere:
sudo ddrescue -r 3 -C /dev/sda /media/usbdrive/image /media/usbdrive/logfile
In questo caso è stata aggiunta l'opzione -C che invita il programma circoscrivere la lettura all'interno dei file già presenti nel registro (o file di log) creato in precedenza .
Tratto da Forensics Wiki:
---- First you copy as much data as possible, without retrying or splitting sectors: {{{ddrescue --no-split /dev/hda1 imagefile logfile
Now let it retry previous errors 3 times, using uncached reads:
ddrescue --direct --max-retries=3 /dev/hda1 imagefile logfile
If that fails you can try again but retrimmed, so it tries to reread full sectors:
ddrescue --direct --retrim --max-retries=3 /dev/hda1 imagefile logfile
}}}
Altri esempi:
These two examples are taken directly from the ddrescue info pages.
Example 1: Rescue an ext2 partition in /dev/hda2 to /dev/hdb2
ddrescue -r3 /dev/hda2 /dev/hdb2 logfile e2fsck -v -f /dev/hdb2 mount -t ext2 -o ro /dev/hdb2 /mnt
Example 2: Rescue a CD-ROM in /dev/cdrom
ddrescue -b 2048 /dev/cdrom cdimage logfile
write cdimage to a blank CD-ROM
Estrarre il filesystem da un immagine recuperata
Ora che il drive è stato ripreso, è possibile ripristinare il filesystem dall'immagine. Se il filesystem non è recuperabile, è possibile tentare di recuperare i singoli file.
Montare le partizioni sull'immagine
Se è stato recuperato l'intero disco, è possibile montare le singole partizioni sull'immagine utilizzando l'opzione "Offset" montanto il filesystem "in loop". mmls, disponibile nel pacchetto [apt://sleuthkit sleuthkit] è in grado di mostrare le partizioni che si trovano all'interno di un'immagine:
mmls file -b DOS Partition Table Offset Sector: 0 Units are in 512-byte sectors Slot Start End Length Size Description 00: ----- 0000000000 0000000000 0000000001 0512B Primary Table (#0) 01: ----- 0000000001 0000000031 0000000031 0015K Unallocated 02: 00:01 0000000032 0001646591 0001646560 0803M DOS FAT16 (0x06) 03: 00:00 0001646592 0002013183 0000366592 0179M DOS FAT16 (0x06)
Come è possibile vedere il programma mostra più partizioni. In questo esempio, vogliamo montare la partizione DOS a partire dal blocco 32. Per calcolare il numero di byte, moltiplicare per 512:
$ bc bc 1.06 Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc. This is free software with ABSOLUTELY NO WARRANTY. For details type `warranty'. 32 * 512 16384 quit
Nota: Per disporre di un interfaccia grafica per sleuthkit installare il pacchetto [apt://autopsy autopsy]. Per approfondimenti sul programma si rimanda al [http://www.sleuthkit.org/autopsy/desc.php sito ufficiale].
Mount the partition:
sudo mount -o loop,offset=16384 file mnt
(32 multiplied by 512 byte blocks = 16384)
For mounting a typical NTFS partition created by Windows use:
sudo mount -t ntfs -o r,force,loop,offset=32256 file mnt
(63 multiplied by 512 byte blocks = 32256)
Estrarre singoli file dalla partizione recuperata
Foremost
Foremost è un tool da riga di comando in grado di recuperare file da un certo numero di file system, inclusi i fat, ext3 e NTFS. Può essere installato ed eseguito dal cd live.
Fare il boot da un cd live, abilitare i repository universe e installare [apt://foremost foremost]
Foremost è in grado di recuperare file da una immagine del disco o dal disco direttamente. Se l'unità ha subito problemi di hardware, utilizzare gnuddrescue per l'immagine del primo disco. (fare anchor a gddrescue).
Supponendo che il file persi sono su /dev/hda, è necessario creare una cartella scrivibile su un altro disco in cui è possibile inserire i file recuperati (un disco esterno USB capiente ad esempio, di seguito dev/sdb).
Montare il disco esterno e creare al suo interno una cartella chiamata foremost:
sudo mount /dev/sdb1 /recovery sudo mkdir /recovery/foremost
Avviare foremost digitando in una finestra di terminale il seguente comando:
sudo foremost -i /dev/hda -o /recovery/foremost
Per avviare foremost su un file immagine semplicemente sostituire il percorso
sudo foremost -i image -o /recovery/foremost
I file recuperati saranno di proprietà dell'utente root. Per cambiare i permessi:
sudo chown -R youruser:youruser /recovery/foremost
Use the -w switch to obtain only an audit of recoverable files:
sudo foremost -w -i /dev/hda -o /recovery/foremost
To recover only specific file types, use the -t switch:
sudo foremost -t jpg -i /dev/hda -o /recovery/foremost
Available types:
Filetype |
Comment |
jpg |
Support for the JFIF and Exif formats including implementations used in modern digital cameras. |
gif |
|
png |
|
bmp |
Support for windows bmp format. |
avi |
|
exe |
Support for Windows PE binaries, will extract DLL and EXE files along with their compile times. |
mpg |
Support for most MPEG files (must begin with 0x000001BA) |
wav |
|
riff |
This will extract AVI and RIFF since they use the same file format (RIFF). note faster than running each separately. |
wmv |
Note may also extract -wma files as they have similar format. |
mov |
|
ole |
This will grab any file using the OLE file structure. This includes PowerPoint, Word, Excel, Access, and StarWriter |
doc |
Note it is more efficient to run OLE as you get more bang for your buck. If you wish to ignore all other ole files then use this. |
zip |
Note is will extract .jar files as well because they use a similar format. Open Office docs are just zip’d XML files so they are extracted as well. These include SXW, SXC, SXI, and SX? for undetermined OpenOffice files. |
rar |
|
htm |
|
cpp |
C source code detection, note this is primitive and may generate documents other than C code. |
all |
Run all pre-defined extraction methods. [Default if no -t is specified] |
Scalpel
Scalpel is a fast file carver that reads a database of header and footer definitions and extracts matching files from a set of image files or raw device files. It is similar to foremost and may have some improvements.
By default, all file types in the database (/etc/scalpel/scalpel.conf) are commented out. To specify which filetypes you want to carve, you need to edit the file and uncomment each line.
sudo scalpel FILE -o Directory
Where FILE is the image file (or device) and Directory is the output directory.
Magic Rescue
Another program that scans for files using "magic bytes" to identify their presence and type, and which can be extended for many file types using "recipes", can be obtained by installing, using any method, the package magicrescue.
Note that most of the provided recipes need other software installed to work, so open the desired recipes in /usr/share/magicrescue/recipes/ using a text editor and read the comments contained.
If you want to recover (for example) gzip files and PNG images from a partition named /dev/sda1, you can run
mkdir ~/output sudo magicrescue -r gzip -r png -d ~/output /dev/hdb1
This will write all recovered files in a directory output inside your home directory.
Photorec
PhotoRec è un programma di recupero dati progettato per recuperare immagini perse dalla memoria della fotocamera digitale o anche da dischi fissi. Successivamente il supporto è stato esteso anche per file non audio o video. Consente la ricerca di 80 diversi tipi di file. PhotoRec è parte del pacchetto [apt://testdisk testdisk].
To run Photorec on an image file, do:
sudo photorec imagefilename
To recover files directly from a device, run photorec without any arguments and you will be given a menu of available devices:
sudo photorec
See [http://www.psychocats.net/ubuntucat/recovering-windows-files-with-a-ubuntu-cd-iii-deleted-files/ this link] for a detailed description of how to use Photorec.
recoverjpeg
recoverjpeg è un programma specifico per l'identificazione e il recupero delle immagini in formato .jpeg.
Installare il pacchetto [apt://recoverjpeg recoverjpeg] e avviarlo digitando in una finestra di terminale il seguente comando:
sudo recoverjpeg /dev/hda1
sostituendo /dev/hda1 con il dispositivo sul quale si desidera indagare.
I file recuperati verranno salvati nella propria cartella Home, with names following the pattern image*.jpg.
[https://help.ubuntu.com/community/DataRecovery/NtfsUndelete NtfsUndelete] can recover deleted files from an NTFS file-system. The Windows and LiveCd versions have a very nice intuitive gui but the linux one is probably stronger and does not have a front-end gui at the moment. Briefly, it has 3 modes The best simple guide i have found so far 24-11-2010) is [http://www.sucka.net/2010/04/recover-deleted-files-with-ntfsundelete-from-a-ubuntu-livecd/ questa]. Obviously with a name like that i was careful about where i opened the page but it was fine. When undeleting chose which files to undelete and where to undelete them too. By default this appears to be the desktop of the OS you are booted into, whether that is a LiveCd or on a different partition or drive. For a LiveCd or LiveUsb you will need to move them onto Usb-stick or safe partition before rebooting as the desktop gets forgotten on LiveCds unless you are using a "Persistent image". To search To undelete, although this might be a little wrong, the"-" at the end worries me. For better information on using ntfsundelete please see the separate page [https://help.ubuntu.com/community/DataRecovery/NtfsUndelete NtfsUndelete], particularly the External Links there.
(Obtained the following from http://www.sleuthkit.org/autopsy/desc.php) The Autopsy Forensic Browser is a graphical interface to the command line digital investigation analysis tools in The Sleuth Kit. Together, they can analyze Windows and UNIX disks and file systems (NTFS, FAT, UFS1/2, Ext2/3). The Sleuth Kit and Autopsy are both Open Source and run on UNIX platforms. As Autopsy is HTML-based, you can connect to the Autopsy server from any platform using an HTML browser. Autopsy provides a "File Manager"-like interface and shows details about deleted data and file system structures.
Autopsy can be run from the "live" CD, but you must specify an address to which you can connect remotely. You must also specify an external disk on which it can save the extracted information. For example, assuming you have an external disk mounted to /media/disk with an autopsy folder on it and your IP address is 192.168.0.1, you can run:
Extract unallocated (deleted) blocks from a disk or disk image. Example: Use any data carving tool to search the output image for files. List file and directory names in a forensic image. fls lists the files and directory names in the image and can display file names of recently deleted files for the directory using the given inode. This includes deleted files. If you have imaged your filesystem to a file named "loopfile", you can list the contents by running: Copy file by inode. icat opens the named image(s) and copies the file with the specified inode number to standard output. Example: fls has shown you the inode number of some files on an image. To recover a file by using th einode number run: sorter - Sort files in an image into categories based on file type. Sorter is a Perl script that analyzes a file system to organize the allocated and unallocated files by file type. Example: This will sort all the files found in /dev/sdc1 and put image files in a directory named "out": Here is a description of a script that will pull all files from an image using fls and icat: http://forums.gentoo.org/viewtopic-t-365703.html Another, similar script which attempts to "rebuild" the filesystem directory structure plus file content: http://matt.matzi.org.uk/2008/07/03/reconstructing-heavily-damaged-hard-drives/
from:How to recover lost files after you accidentally wipe your hard drive Sort certain types of files: Eliminate small photos: Rename jpegs according to exif data: Then, remove duplicates. Copy files with matching strings:
[https://help.ubuntu.com/community/DataRecovery Documento originale] http://www.sleuthkit.org/informer/sleuthkit-informer-14.html#recover http://goinggnu.wordpress.com/2008/02/14/recover-deleted-files-from-memory-card Ntfsprogs
ntfsundelete /dev/sda2
ntfsundelete /dev/sda2 -u -i 3689 -o work.doc -d ~
Sleuth Kit and Autopsy
Autopsy
sudo autopsy -d /media/disk/autopsy 192.168.0.1
Sleuthkit
dls inputimage > outputimage
fls loopfile -r -f fat -i raw
r/r 3: test (Volume Label Entry)
r/r * 5: sample.docx
r/r * 7: sample.pptx
r/r * 9: sample.xlsx
icat -r -f fat -i raw loopfile 5 > sample.docx
sudo sorter -h -s -i raw -f fat -d out -C /usr/share/sleuthkit/windows.sort /dev/sdc1
Cleaning up
sudo mkdir recovery/VID recovery/JPG
find recovery/ -name "*.avi" | xargs -i mv {} recovery/VID/
find recovery/ -name "*.mpg" | xargs -i mv {} recovery/VID/
find recovery/ -name "*.jpg" | xargs -i mv {} recovery/JPG/
sudo mkdir recovery/SMALL
find recovery/JPG/ -name "*.jpg" -size -1024k | xargs -i mv {} recovery/SMALL/
find JPG/ -name "*.jpg" | xargs -i jhead -nf%Y%m%d-%H%M%S {}
find /var/recovery/JPG/ -name "*a.jpg" | xargs -i mv {} /var/recovery/JPG/DUPS/
cd recovery
mkdir ../copy/
grep -l "enter the string of text here" *.doc | xargs -i cp {} ../copy/
Ulteriori risorse