I'm currently trying to find a file that was hidden in sector 2047. My root partition starts at sector 2048.
How would I go about finding that file? Given the only info I have is the sector its in.
Thanks in advance!
I'm currently trying to find a file that was hidden in sector 2047. My root partition starts at sector 2048.
How would I go about finding that file? Given the only info I have is the sector its in.
Thanks in advance!
There's no file hidden in sector 2047. There may be data, but it's not part of the file system.
To recover it:
dd
Figure out sector size
sudo fdisk -l
will show you sector sizes:Here we have 512B sectors. This is probably the most common; some newer devices will have 4KB sector sizes. This is the reason we need to know the sector size of the device - we have to specify it in the next step, so
dd
knows how many bytes to skip.Read out said sector
This
dd
can do for us.if=/dev/sda
tellsdd
to read from/dev/sda
of=sector2047
tellsdd
to write to the filesector2047
bs=512
tellsdd
to read in 512B increments (block size)skip=2046
tellsdd
to skip first 2046 512B-blockscount=1
tellsdd
to read 1 block of 512B.I would use the same command vidarlo used, but change the
skip=2046
toskip=2047
and thecount=1
tocount=3
. This will give a bigger space to search in.Then do
sudo apt install hexedit
. After that, dohexedit sector2047
and scroll down until you see your message on the left.