[TriLUG] Is all hope lost (Ubuntu 18.04)

Joseph Mack NA3T via TriLUG trilug at trilug.org
Sun Nov 29 06:05:58 EST 2020


On Sat, 28 Nov 2020, Brian via TriLUG wrote:

> All *may* not be lost; any files that were on sda before are still 
> there, but good luck finding them again without a correct partition table.
.
.
> If you changed the partition table on sda, the previous partition table 
> is gone.  If you happen to know where the previous partitions start and 
> end on the disk, you can rebuild the partition table to what it was before.
>
> The data in the files is probably safe, if you didn't attempt to write 
> to the newly-defined partitions.

I don't know why you got "unknown filesystem".

However if you've just erased the partition table, the original partitions 
are still there and you can mount them even if you don't know where they 
start and end.

but first ... don't do any write operations on your scrambled disk. Make a 
dd copy of it and try to rescue the copy.

to mount a partition when you don't know where it is, you just try to 
mount every block in the disk. Here's my script for it. (It doesn't do any 
writes.)

Joe

--

#! /bin/bash


#-----

# see pario.no/2009/01/19/mount-a-disk-image/

img=DB59303.img
mnt_point=mnt3

random_mount(){
 	#change vfat to your expected filesystem (or leave out the "-t vfat")
         mount -o loop,offset=$(($offset*512)) -t vfat $img  /$mnt_point > /dev/null 2>&1
         if [ "$?" = "0" ]
         then
                 echo "found it $offset"
                 exit
         fi
} # random_mount

for ((offset=0; $offset < 200000; offset=$offset + 1))
do
         echo $offset
         random_mount
done

# random_offset_mount.sh --------------------------

-- 
Joseph Mack NA3T EME(B,D), FM05lw North Carolina
jmack (at) trilug (dot) org - azimuthal equidistant
map generator at http://www.wm7d.net/azproj.shtml
Homepage http://www.austintek.com/ It's GNU/Linux!



More information about the TriLUG mailing list