You are not logged in.
Pages: 1
Hello, I have accidentally formatted my hard drive. I was able to recover a img file by using ddrescue. But while trying to mount it, I have been getting issues.
When I try to run
`mount -o loop test.img /mnt/recovery`
I get the output
`mount: /mnt/recovery: failed to setup loop device for test.img`
Few things:
Yes /mnt/recovery is a directory.
I have loop installed and have done modprobe loop
Thanks for the help in advance
Offline
Is "test.img" the image of a filesystem (partition) or a (partitioned) drive?
For the latter, "man losetup" - you want to use the -P flag to create loop devices for the partitions and mount those.
Offline
Just because you have recovered an img file, doesn't mean you have a working partition
If you have reformatted the drive, and not merely deleted the partition, i am afraid you may have to accept that your data is gone for good
Offline
Luckily "reformat" is not a fixed term.
If he only repartitioned the drive he actually only needs to restore the former partition table - data and even filesystem headers will all be still there.
If he created a new filesystem it gets a bit more complicated.
If he replaced the old FS on the same partition, the FS is gone, but unless the new FS was used, testdisk/photorec will be able to recover most data.
If he repartitioned and created new FS's, the old FS headers will still be there aligned w/ the former partition, but the new FS entries may have damaged some of the existing data.
Ideally the image is a drive dump before he screwed up his drive (aka "backup").
"formatting" à la DOS "full format" ie. overriding every sector doesn't happen easily, but in that case and if the image is just a copy of the old drive, he's pretty much screwed.
Professional services *MIGHT* be able to recover *SOME* data from a HDD (if only 0-bytes were written and not dev/urandom) - but this is very expensive and the results are typically not great.
Offline
OP please keep in mind that ddrescue/photorec is not a silver bullet, it may say its found some files, but in my experience much of it is corrupted or unusable
depending on what the img file actually is you may need
losetup
-o, --offset offset
The data start is moved offset bytes into the specified file or device. The offset may be
followed by the multiplicative suffixes; see above.
--sizelimit size
The data end is set to no more than size bytes after the data start. The size may be fol‐
lowed by the multiplicative suffixes; see above.
-b, --sector-size size
Set the logical sector size of the loop device in bytes (since Linux 4.14). The option may be
used when create a new loop device as well as stand-alone command to modify sector size of
the already existing loop device.Last edited by ponyrider (2021-03-16 12:54:10)
Offline
I just want to add that everything Seth says is correct.
OP can you post more information about what command you used to 'delete' your drive
Offline
Pages: 1