You are not logged in.

#1 2019-09-25 14:01:49

obscurant
Member
Registered: 2017-08-06
Posts: 142

Hard Drive Recovery

I has a senior moment last night, while making a live USB install. I installed the ISO on my hard drive and wiped the whole thing. smile It just shows as an empty drive, though I haven't mounted it yet, since I rebooted.

Not sure how to proceed, though I tried using gparted, on a live boot, to recover files, and it didn't find anything. Maybe someone has some advice on file recovery.

sudo fdisk -l

Disk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: WDC WD10EZEX-08M
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x1b74ee77

Device     Boot      Start        End    Sectors   Size Id Type
/dev/sdb1  *          2048 1920008191 1920006144 915.5G 83 Linux
/dev/sdb2       1920010238 1953523711   33513474    16G  5 Extended
/dev/sdb5       1920010240 1953523711   33513472    16G 82 Linux swap / Solaris

[color=#ff0000]Partition 2 does not start on physical sector boundary.[/color]

Disk /dev/sda: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: ST2000DM001-9YN1
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x8103dc50

Device     Boot Start        End    Sectors  Size Id Type
/dev/sda1        2048 3907028991 3907026944  1.8T  7 HPFS/NTFS/exFAT


Disk /dev/sdc: 7.5 GiB, 8004304896 bytes, 15633408 sectors
Disk model: Cruzer Glide    
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00057b67

Device     Boot Start      End  Sectors  Size Id Type
/dev/sdc1  *     2048 15630335 15628288  7.5G  b W95 FAT32


Disk /dev/loop0: 979.1 MiB, 1026621440 bytes, 2005120 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

sdb: 931.5 GiB is the drive in question.

mount

sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=8172592k,nr_inodes=2043148,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=1640800k,mode=755)
/dev/sdc1 on /run/live/medium type vfat (ro,noatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro)
/dev/loop0 on /run/live/rootfs/filesystem.squashfs type squashfs (ro,noatime)
tmpfs on /run/live/overlay type tmpfs (rw,noatime,size=8204000k,mode=755)
overlay on / type overlay (rw,noatime,lowerdir=/run/live/rootfs/filesystem.squashfs/,upperdir=/run/live/overlay/rw,workdir=/run/live/overlay/work)
tmpfs on /usr/lib/live/mount type tmpfs (rw,nosuid,noexec,relatime,size=1640800k,mode=755)
/dev/sdc1 on /usr/lib/live/mount/medium type vfat (ro,noatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro)
/dev/loop0 on /usr/lib/live/mount/rootfs/filesystem.squashfs type squashfs (ro,noatime)
tmpfs on /usr/lib/live/mount/overlay type tmpfs (rw,noatime,size=8204000k,mode=755)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup2 on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,rdma)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=36,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=11151)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,relatime)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=1640796k,mode=700,uid=1000,gid=1000)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
/dev/sdb1 on /media/live/cbpp-10-20190707-14:15 type iso9660 (ro,nosuid,nodev,relatime,nojoliet,check=s,map=n,blocksize=2048,uid=1000,gid=1000,dmode=500,fmode=400,uhelper=udisks2)

Offline

#2 2019-09-25 17:19:50

mcarni
Member
Registered: 2015-09-29
Posts: 16

Re: Hard Drive Recovery

Hi obscurant,

some years ago i formatted my wife's hd
the least to say is that she was not impressed...
still a mystery to me why she still lets me around her computer

one thing that helped is that i managed to recover the 10/20 files that she really needed
i did this with photorec
archwiki link
step-by-step_guide

I am no expert and i don't know if in your case this is the best solution
i assume you used dd to burn the ISO while i just used "rm", this probably changes things

NOTE. i remember that i made a copy of the damaged hd, so that i could "play" with photorec, while making sure that i would not add further damage to it

NOTE2. i remember that a tricky part of the recovery process was to skim through all the nonsense useless files that photorec found and select only the interesting one
this guide was very helpful
https://www.cgsecurity.org/wiki/After_Using_PhotoRec

good luck

hope it help
M

Offline

#3 2019-09-25 18:43:10

twoion
ほやほや
Registered: 2015-08-10
Posts: 2,541

Re: Hard Drive Recovery

mcarni has the right pointers.

1st) If you can, make an image of the hard disk with dd and a live system and archive it so you have more than 1 attempt.

2nd) Give testdisk a go. It'll try to restore the partition table by using heuristics like where file system superblocks begin or end. If this goes well, you're pretty much done. Of course, this doesn't bring the data back you have written the ISO file over, but if minus 1-10G from the beginning of the disk did not touch your home partition or data partition or only the root file system, you'll have your personal files recovered. Back those up and reinstall the system.

3rd) photorec is for when you can't restore partition boundaries well; because it outputs a lot of stuff it is more time-consuming to work with than testdisk.


New Horizons

Offline

#4 2019-09-25 20:18:45

unklar
Member
Registered: 2015-10-31
Posts: 949

Offline

#5 2019-09-25 23:12:09

obscurant
Member
Registered: 2017-08-06
Posts: 142

Re: Hard Drive Recovery

Thanks all. I'm attempting to make an image with Testkisk. Looks like it's going to take a few hours smile

Finger's crossed that I can at least get a few directories from /home

Offline

#6 2019-09-26 02:23:45

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 6,017
Website

Re: Hard Drive Recovery

People above have covered you better than I could have, but worth repeating: touch the bad drive as little as possible so you don't make it worse. Do everything on copies.

One tool I found quite effective getting files off a hard disk which was physically failing (which is of course a different case from yours) was ddrescue. If you hit a brick wall with testdisk or photorescue you might give it a try.


John
--------------------
( a boring Japan blog , Japan Links, idle twitterings  and GitStuff )
In case you forget, the rules.

Offline

#7 2019-09-26 06:09:49

ohnonot
...again
Registered: 2015-09-29
Posts: 4,129
Website

Re: Hard Drive Recovery

Your fdisk output shows an intact hard drive structure with 3 partitions; are you sure that's what you dd'd over? That should be showing an unformatted vastness.
Or maybe I misunderstood, you actually installed a Linux distro to the wrong hard drive? (*) In that case it's also relevant how you formated during installation.

Anyhow, and just in case it wasn't clear: The overwritten parts are lost, the rest is recoverable. The rest being the largest part of the HD I guess.

Go with the steps in post #3. And be sure to read testdisk/photorec wiki before you start, these tools aren't exactly point & click.

(*) if this is the case I suspect testdisk won't be much help and you have to use photorec, but please don't just take my word for it.

Last edited by ohnonot (2019-09-26 06:14:18)

Offline

#8 2019-09-30 18:09:59

eight.bit.al
Member
From: The top of the World
Registered: 2015-10-01
Posts: 362

Re: Hard Drive Recovery

obscurant wrote:

I has a senior moment last night,

It's happened to the best of us, senior moments, that is. So tell us what happened, how did you make out?

8bit


A mind is a terrible thing not to change.
The problem lies not with new ideas, but in escaping the old ones.

Online

#9 2019-10-02 01:17:11

obscurant
Member
Registered: 2017-08-06
Posts: 142

Re: Hard Drive Recovery

^^^ Thanks John and ohnonot. I'm putting the drive aside to try those methods a bit later.

^ Things aren't going so well for me. I couldn't get enough backup space to make an image of the drive with testdisk, despite having plenty. And I had another senior moment in the process. I've decided to take a break from computering, until maybe my head clears up a bit. I really think my long-term use of ambiens is affecting ability to concentrate, and I need to get off of those things neutral

Offline

#10 2019-10-03 07:00:19

ohnonot
...again
Registered: 2015-09-29
Posts: 4,129
Website

Re: Hard Drive Recovery

obscurant wrote:

I really think my long-term use of ambiens is affecting ability to concentrate, and I need to get off of those things neutral

In my mind, Ambien is the sort of drug that appears in USA movies only. Of course that applies to the brand name, I guess the active ingredient is available elsewhere, but I do notice that it's prescription only in e.g. Germany.
Not sure where I'm going with this statement; I guess I want to say something like this: don't let the fact that you can buy this over the counter fool you; it can be a seriously addictive drug with serious side effects and tolerance problems.
So yes, get off it.
FWIW, I suffer from (usually mild) insomnia myself. I have one simple rule that has really helped me: the bed is only for sleeping.
I do usually read a little before I switch off the lights, but all online & computing activities are happening over there at the table.
I usually get by without any medication.
Sometimes a little Melatonin, rarely a little sth stronger (because I know that the after effects are just as bad as after a sleepless night). I never take it two nights in a row.

Offline

#11 2019-10-05 00:51:16

obscurant
Member
Registered: 2017-08-06
Posts: 142

Re: Hard Drive Recovery

^ That's very true and thanks for your response. It's prescription only in the US, it's habit forming, and causes long-term cognitive impairment. From what I've read. And it has a reputation for some nightmarish side effects, which I don't get from them. I have severe OCD and have always had insomnia from that. Another problem is blue light from computer and phone screens. But I really have to get off the ambiens. It's awful stuff.

I keep hearing about melatonin chewables, and I'm going to give that a shot.

Offline

#12 2019-10-05 09:38:14

ohnonot
...again
Registered: 2015-09-29
Posts: 4,129
Website

Re: Hard Drive Recovery

I keep forgetting how easy it is to get (a) prescription (for) drugs.
Just yesterday I was at the doctor for back pain, and it almost seemed like he's pushing these things on me - there was this moment where he looked at me and I just needed to say yes -I could have gone for the muscle relaxants but instead walked out of there with a prescription of high dosage standard painkillers - turned out they were even cheaper than the otc stuff.
[rant: it's amazing how this country rages against alcohol abuse and totally ignores medical substance (ab)use]

If you're hooked on strong stuff, don't get your hopes up about the melatonin, esp. for daily use - but once you're free of that addiction, it can be a good every-now-and-then solution.

Offline

Board footer

Powered by FluxBB