You are not logged in.
Pages: 1
hi all,
i'm new to the forum and generally new to linux. tonight i was trying to write an iso to a usb but as it turned out i wrote the iso to the hard drive. i was using dd and i had heard to be careful to select the right volume but here we are. i suspect the files are still on the hard drive though they dont show up.
if more information helps im using arch with the xfce de. the hard drive is a wd external hdd.
any help in pointing me in the right direction to get my files back would be appreciated.
thanks
david
Offline
CLI Paste | How To Ask Questions
Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L
Offline
thanks very much
i read through that page, one thing that i still don't understand entirely is, does dd remove everything from the drive or does it remove the pathway to the file. as in is there any point in trying to use the programs in the page?
i should also ask is how much risk is there?
Last edited by newme360 (2022-10-27 20:21:06)
Offline
dd overwrites whatever is at the start of the device to the point where the image is complete, So whatever was stored in the first 700MB (or whatever was the size of the iso) of the disk will be gone, there's still hope for the rest of it.
What risk are you afraid of? For most standard and practical purposes outside of these tools you already destroyed the relevant contents. Unless you flub the device path while using recovery tools they are pretty much your only realistic chance. I'd generally be safer - if you have the storage for it elsewhere - to pull a image of the drive so you can operate on the image
Last edited by V1del (2022-10-27 20:38:38)
Offline
dd doesn't remove anything - it writes bytes from a source to a destination.
The bytes that were in the destination before are now replaced.
So if your iso was 1GB, the first GB of the device (drive or partition) you named as destination are now the iso - everything else remains untouched, but the data that was stored on those blocks is now gone.
Unfortunately, the head of a partition contains most of the filesystem data that organizes the data on your partition - you can try to recover that from an alternative superblock, but I'd not hold my breath.
W/o the filesystem, what is reasonably recoverable depends on the fragmentation of the filesystem - testdisk and photorec can detect certain data chunks as "files of a type" and restore them for you, but the bigger the files are/were the more they will be scattered around the device and the individual parts only look like random meaningless bytes.
Any attempt to write to the compromised drive is almost guaranteed to destroy more data, so before you try to reconstruct the filesystem, you should have an image of the compromised device backed up and you need to recover files w/ testdisk/photorec to a different drive.
Online
thank you
i've installed testdisk but don't have another hard drive so ill have to order one.
Offline
You don't need to use dd to write the ISO btw. You can just use cat. https://unix.stackexchange.com/q/12532
Offline
You can also use sed or awk … none of which would have saved the user from friting to the wrong device.
And also https://porkmail.org/era/unix/award#cat
Online
You can also use sed or awk … none of which would have saved the user from friting to the wrong device.
And also https://porkmail.org/era/unix/award#cat
Yes, but the simpler interface might make it easier to prevent mistakes in the future. Incidentally the same reason people do "useless" use of cat.
Offline
Feel free to explain how a supposidly simpler interface will prevent you from writing into /dev/sdb instead of /dev/sda because you didn't pay attention to the device order.
People for the most part tend to abuse cat because they don't know any better.
Online
It will make it easier to pay attention, since you're not getting distracted by a less familiar interface.
People for the most part tend to abuse cat because they don't know any better.
In that case, now that you've linked to the page, everyone in this thread surely knows better, and is free to (ab)use cat if they so wish.
Last edited by lfitzgerald (2022-10-30 21:37:05)
Offline
That's time to check if you have good backups! ![]()
Offline
Pages: 1