A while a go, my computer suddenly stopped detecting the HDD I have plugged into the system. I initially thought the drive was dead, but using the fdisk -l command, it shows the affected disk still being detected.
Yes, GParted is able to display the disk. It’s entirely unallocated as I’ve only used that disk to store files on. I will also add that I ran the program GSmartControl and the affected drive passes the health test.
It appears to have a Linux partition - which means it has a signature - but may have lost it’s primary partition table causing the kernel to not mount it.
Whereas the second device is entirely unallocated
What happens if you try to mount it manually on command line? Error message?
sudo mount /dev/sda1 /mnt
advanced filesystem check
Ensure the device is unmounted - likely not an issue since you posted - anyway never do anything advanced on a mounted filesystem
The device may have lost partition information - then running testdisk from testdisk package may be able rebuild the partition table from backup locations.
If you don’t have data worth saving you can reformat using the Linux filesystem of choice.
If you know the filesystem to be ext4 (the most common) you can use dumpe2fs to locate superblock then use the a superblock to check the filesystem
After a bit more testing, I found that the drive is considered mounted and attempts to unmount it are unsuccessful:
umount: /: target is busy.
Attempting to check the filesystem using the superblock yields this:
e2fsck 1.47.0 (5-Feb-2023)
/dev/sda1 is mounted.
WARNING!!! The filesystem is mounted. If you continue you ***WILL***
cause ***SEVERE*** filesystem damage.
Do you really want to continue<n>?
Okay so I figured out what happened, mostly. I’m still not sure why my internal HDD wasn’t being shown in the file manager before all this. But as it turns out, when I was installing Manjaro, I hadn’t checked which drive it was installing on. Instead of going onto my Samsung SSD like I intended, it instead installed onto the HDD. I wasn’t aware of this and had assumed I installed it on the appropriate drive. It took an embarrassingly long time of looking at the drive information on GParted, the FDisk command, and GSmartControl for it to slowly dawn on me what I had done.
Which means unfortunately the data I was hoping to save had been overwritten by Manjaro, all because I forgot to check which drive I was installing Manjaro onto. I feel embarrassed.
Is there a way for me to recover at least a bit of the data?
Since the the whole disk sda ( ST1000DM010-2EP1) is formatted with ext4, I doubt you can rescue any data, since ext4 zeros data on lazyinit process. That means that even if data would be found, they wouldn’t be completely recoverable, but only chunks of it.
Ah I see. Well it’s worth a try. If I can’t get anything back, yeah it sucks but the best thing I can do is move on and try not to repeat the same mistake.