Ugly Hedgehog - Photography Forum
Home Active Topics Newest Pictures Search Login Register
Main Photography Discussion
Testdisk and photorec from cgsecurity
Oct 10, 2019 16:22:59   #
blackest Loc: Ireland
 
Testdisk and photorec have to be the best recovery software out there. It is completely free runs on Linux , Windows and OSX. It reads pretty much every file system going. Not only does it recover files but it can create a bit for bit image file of the problematic disk.

I run a nas based off an android tv box , the operating system is debian linux and on monday the electricity went out and it corrupted the microsd card that the operating system runs on. It wouldnt boot up.

The first thing I did was make an image of the disk using testdisk and then duplicated that file as a backup.
I made a new disk with a more modern version of the operating system but there are a lot of customisations that i've made over the years, it's main job has been backing up my main nas every hour for the past three years. The data itself is fine but naturally i want to get up and running again.

The disk image has been a life saver as i have been able to run testdisk mounting the image and pick up the configuration files from my old operating system. This i have been doing on my mac which doesn't even read the file system of the card. I'm just browsing through the folders and choosing which files i need and copying thenm to my desktop. The only thing it doesnt do is write the image back to a card, although if you have an operating system that understands the file system you could actually recover back to another card, or drive. Although there are a few programs that can do that for you such as etcher or dd.

I've used test disk for years for recovering data but not for an operating system. linux can mount disk images but you need to create a loop device assign it a mount point ... where as

testdisk myimage.img takes care of that technical stuff for you.

I can't recommend this highly enough.

Reply
Oct 10, 2019 19:34:23   #
Bill_de Loc: US
 
I read this post twice, and I have no clue except ...

if I ever have a similar problem you are the guy I will call first.

--

Reply
Oct 11, 2019 09:36:19   #
blackest Loc: Ireland
 
Bill_de wrote:
I read this post twice, and I have no clue except ...

if I ever have a similar problem you are the guy I will call first.

--


Trying to think of how to simplify things and its not that easy. A disk image is just a copy of every 1 and 0 on a disk regardless of it having meaning or not. disk recovery is a process of extracting the meaningfull stuff usually after the easy normal way got broken. Hard disk image files are commonly used on virtual machines but usually they are sparce, that is they only contain the files and not the 'empty' space. There is always something in the empty space be it random values or a deleted photo of aunt vera with a tree growing out the back of her head.

While testdisk is used primarily for file recovery you could use it to read files from a mac formatted disk using the hfs+ file system on a pc and copy them to the PC's hard disk. Even the deleted files from it.

There is no difference in the functions offered by TestDisk and PhotoRec when working on a copy instead of the original media. In example, TestDisk Advanced menu can be used to list and copy the files from FAT, NTFS and ext2/ext3/ext4 partitions or PhotoRec to carve data from damaged filesystem.

If the filesystem isn't damaged (or too damaged), it's also possible to access the content using native Linux or Mac OS X commands:

Linux
mount -o loop,ro image.dd directory
Osx
rename image.dd to image.img or image.dmg and double-click on the file.

I just checked my disk image from my nas is in 2 partitions the first partition is fat and osx can mount that but the 2nd is linux ext4 and it can't read that. Even so thats impressive :)

The limitation there is that the operating system has to be able to read the filesystem used on the image

Reply
 
 
Oct 11, 2019 10:01:10   #
Bill_de Loc: US
 
Thank you.

You did simplify it in a way I now understand it.

---

Reply
Oct 11, 2019 12:02:05   #
blackest Loc: Ireland
 
Bill_de wrote:
Thank you.

You did simplify it in a way I now understand it.

---


I figured out how to mount the ext4 partition on a mac.

https://www.maketecheasier.com/mount-access-ext4-partition-mac/

It took an extra step double click the img file which mounts the drive but osx doesn't show the partition
however using diskutil -list showed it as a disk

/dev/disk1 (disk image):
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme +15.8 GB disk1
1: Windows_FAT_16 BOOT 134.2 MB disk1s1
2: Linux 15.5 GB disk1s2

then
sudo ext4fuse /dev/disk1s2 ~/tmp/MY_DISK_PARTITION -o allow_other

and navigating to
~/tmp/MY_DISK_PARTITION
gave me the partition in finder, it wasn't quite perfect as i found 2 videos on the desktop of the image one played the other i had no access to so i used testdisk to copy that to the macs desktop and then it played.

mounting the disk wasn't really necessary as i had as much access as i needed with testdisk

Reply
Oct 13, 2019 19:20:08   #
JerryOSF Loc: Bristol, VA
 
Create a separate partition for /home. In case of an OS failure, boot from an install disk and replace the OS but save the original /home. I backup monthly and put it in a safe deposit box. In addition I use timeshift to recover if necessary.

Reply
Oct 14, 2019 09:03:07   #
blackest Loc: Ireland
 
JerryOSF wrote:
Create a separate partition for /home. In case of an OS failure, boot from an install disk and replace the OS but save the original /home. I backup monthly and put it in a safe deposit box. In addition I use timeshift to recover if necessary.


With my nas(androidtv) there is very little in home, essentially it backsup itunes and it backs up lightroom every other hour to an external usb hard drive. It's quite a good system with 1 negative the ethernet port is only 100mbs not 1000mbs it's usb ports are only USB2 which has a max of 480mbs this is why its the backup nas since the other can run at 1000mbs.

Which has me thinking about improving networking...

Reply
If you want to reply, then register here. Registration is free and your account is created instantly, so you can post right away.
Main Photography Discussion
UglyHedgehog.com - Forum
Copyright 2011-2024 Ugly Hedgehog, Inc.