## Linux's Filesystem

Linux's ext2 filesystem does not delete the location of the first 12 data blocks stored in the inode when a file is removed. This means that data may be restored directly by using icat (which is part of The Coroner's Toolkit) on the inode number in question. As with any data recovery method, there is no guarantee that the data will still be there, but this can be a very easy way of recovering deleted information.

Of course, knowing what inode number to look at can be challenging, but other tools in TCT may be used to help locate the correct one. We've already learned that when a file is deleted in Linux, the inode's dtime is updated. Using that, you can recover the data from the most recent 20 inode numbers that were deleted (not quite the same as the last 20 files deleted, but close enough) with this little bit of Bourne shell code:

for inode_num in `ils /dev/device |

sort -n +7 -t \|

tail -20 |

awk -F \| {print $1}'`

> do

> icat /dev/device $inode_num > $inode_num.result

> done

If not recently deleted, the data can potentially still be recovered if the approximate time that the data was deleted is known ("3am last night"). The ils2mac program converts ils output to the input the the mactime program understands, which can, in turn, be used to fuel icat to recover the data in question. Of course, if desperate, the data pointed at by all inode numbers can be recovered and searched.

— D.F.

Back to Article