An ext4 filesystem on my USB stick has been trashed in a
peculiar way. All the data are intact, but everything up
to the data has been trashed. Thus, from dd if=/dev/sdb2 | od -bc:
Code:
0000000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000
\0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
*
17610000 002 000 000 000 014 000 001 002 056 000 000 000 002 000 000 000
002 \0 \0 \0 \f \0 001 002 . \0 \0 \0 002 \0 \0 \0
17610020 014 000 002 002 056 056 000 000 013 000 000 000 024 000 012 002
\f \0 002 002 . . \0 \0 \v \0 \0 \0 024 \0 \n 002
17610040 154 157 163 164 053 146 157 165 156 144 000 000 015 000 000 000
l o s t + f o u n d \0 \0 \r \0 \0 \0
You should ascribe no significance to the 17610000 above because part
of the problem is that the partition table has also been trashed; I
don't know exactly where my /dev/sdb2 used to begin. But it is
clear from the above that there are quite a few 0 bytes, up until
the contents of the root directory. Thereafter, it seems that all
the former contents of the filesystem are intact. Assuming that the
root directory is the first object in an ext4 filesystem, it seems
that all the metadata -- i.e., everything prior to the root
directory -- has been trashed, but that the files and directories
themselves are still there.
How do I recover my filesystem? I have considered the possibility
that if I could just get the partitioning right, beginning /dev/sdb2
where it used to begin, then an fsck could repair the filesystem,
but that seems unlikely. But maybe there is backup metadata
scattered throughout the disk, as in the case of an old-fashioned
UFS filesystem, with cylinder groups. So, how then do I figure out
where /dev/sdb2 used to begin? I have done od -bc on other ext4
filesystems, and the root directory is not located at a fixed offset
from the beginning of the device, it's not like the old UFS
filesystems where you knew that the superblock was in block 1 and
that the root directory began in block 2. If there is a way of
determining, from the position of the root directory, where the
device used to begin, please let me know what it is. But that
question is subservient to the main question, which is, how do I
restore my ext4 filesystem to a usable state? There is a huge
amount of data on that USB drive, which is vitally needed, and which
is not yet lost -- it is there on the device, but I can't access it,
without your help. Thank you in advance for any and all replies.
jay at m5 dot chicago dot il dot us
+1 773/7613784 landline
+1 410/9964737 GoogleVoice