PC Lost Power during HDD resize - /dev/sda4 unknown file system
Bit of a long story. Was trying to host a local minecraft server so that i could have it run better on my steam deck, and somehow was getting an issue where the drive i had installed it on went into read only mode for some reason. bad superblock. now this confused me as it was working, i left, and came back to my server crashed and after i couldnt write to it. This is a bit weird as the hard drive was actually 2 partitions(accidentally made, did not resize). So I had 2 partitions on one drive, both same file system. The other partition still worked perfectly fine so I was sure the drive didnt just completely break. I tried copying any files from the bad partition to the new one, deleted bad partition, and was resizing the good partition. My PC lost power during it and now my file system seems to be corrupted. I wont be able to buy another drive to backup the ENTIRE thing (as its multiple TB) until next week when I get paid. Is there any way to salvage this without losing my files? preferably without needing another drive but if so then ill have to buy another to backup
45 Replies
the drive has most of my games on it ;(
im hoping i was able to fix it. used testdisk to get one of the partitions up (before i borked the one i got back, i mounted the broken one in read only and copied what i needed to the other partition). will mark as solved if its all good when these 14 hours are done. if not then ima still need help obv
I'm sorry to say there is very little chance this is salvageable
when you resize you are warned that this is a risky operation and interrupting it will cause issues.
when you press ok to that you accept the risk (or you have made a backup like they suggest usually)
if you are looking to restore this, you are looking at forensic levels of restoration which is not cheap for a good reason as it is time consuming and often a manual effort.
If this is a recent screenshot, any chance you had of recovering this is probably gone
this is right now
after hours of waiting
When you fail a move like this ideally you need to know exactly how far it was along the process when it failed
If you know that, you can recover the drive
The state you were in, you needed to keep that computer completely unplugged and send it to a very expensive data forensic company immediately
this rn was after waiting all 14 hours
Every time you mess with that drive, and especially with the action you just took, has all been guaranteed that drive is lost
You will never recover anything from it
not true
all right here
just not resized
well i say not true but i dont know how safe this even is
i have to use testdisk every time to see my files?
and if i create an empty text file it said it was transfering to this drive? which i assume means its not mounted normally
so i do want to get another drive to copy everything onto it
ima come back in 10 hours and see if i should become a forensic restorer 😎
got scared as i just came back to it saying it cant copy a file
skipped and its still going
89% and im hearing clicking in the drive :/
im def gonna replace it
i would consider yourself lucky in this case. So deletions in drives are a bit weird, nothing is really deleted, your data gets flagged that it is safe to write over. When data is marked like this, it is indistinguishable from free space to the OS. i would not be surprised if some of your data is corrupted. Invest in a good UPS and avoid catastrophy from power outages
new one arrives today
u might be right i think my ps3 roms might be corrupted cuz i only heard clicking when it was doing the ps3 files so it seems that spot on the drive isnt so fresh
well i got my new drive and damn i didnt realize exfat was half as fast as btrfs
There's still a chance some of those files are broken.
AFAIK. Especially with half broken filesystem metadata from a failed move
failed resize. probably worse than failed move
well stopped during resize
I don't know what you did but I'm assuming you did some mounting arguments that skip recovery actions and to force mount
sudo dnf install testdisk
sudo testdisk
analyze
write
depending on how it feels, i may or may not have to restart for it to mountNot entirely sure what it does to try and recover files
idk either i just happened to have a thing happen to my drive
and i want my games back
i think my case may just be lucky cuz when i used it to anazlyze my drive, it was pretty quick in finding the partitions
never even searched 1% of the drive before finding them
I really hope for you that everything important you have will be back in original state.
It sucks
Big recommend to not resize partitions on important drives
Really just don't do it. Or make backups
hopefully
so far it SEEMS like it's all there
but I'm still copying to the new drive rn
There's a good chance not everything recovered is in perfect shape. It's likely a tool like that will skip failed verification to recover as much as data as possible
Btrfs employs block level checksumming that can be skipped before mounting
oh this is good to know, i have a bash script that generates checksums of all files on a partition...
You really don't need that with btrfs it uses crc32c for very fast verification
But on block level not file level
i imagine that's probably more sound doing it per block rather than per file
It makes sense due to the CoW nature of btrfs
i have no idea what any of that means
all i know is with btrfs I'm always getting bad superblocks on my sd card cuz i forget to click unmount first
That's not btrfs that is the problem
That is write caching
are you using bazzite-deck or bazzite-desktop? as far as i can tell there is no cache writing on bazzite-deck, removing sd card immediately after installing a game is safe
this is why it takes ages to install games on sd card
deck on deck and desktop on nvidia
ah
okay
that makes sense why it's always when i take it out my pc
Btrfs is not the problem as any incomplete write is discarded
But write caching can screw it up
what is write caching then
cuz it most recently happened hours after i finished writing
and I've only had it happen on btrfs
this might be relevant for checking how your sd card is being mounted: https://askubuntu.com/questions/5051/how-to-switch-off-caching-for-usb-device-when-writing-to-it
Ask Ubuntu
How to switch off caching for usb device when writing to it?
I have problems transferring binary programs to a micro-controller prototype board when using ubuntu/kubuntu to mount the board via usb. With MacOS and Windows there are no problems. I have found the
are sync/flush options relevant for sd cards?
Not if Write caching is disabled entirely
Actually no it does still matter due to device level caching
SD cards don't have that i think so no it doesn't matter
On Bazzite the sd card should be safe to remove whenever
Afaik
Btrfs is CoW and if there's no write caching there should be no issue... but thats all in theory
but it's never safe to remove without unmounting in my experience
again only if its btrfs😔 I've done it with exfat no problem
not that I'm saying i should be doing it without unmounting
I'm assuming the ai is right based on my experience and not my knowledge of the systems
It could be, all I know is that in theory btrfs is atomic: meaning any non-complete write is discarded. Why? Because Btrfs writes only to empty space and if the write is incomplete, nothing is lost in the process. Metadata is only ever written after the write is complete. Where it could go wrong however is with the writing of metadata itself. If that is interrupted you could be left with a partially corrupted filesystem.
The thing is with exFAT write caching is disabled by default in Windows. On Linux exFAT does not support the disabling write caching, so that's something to look out for either way. (There's no option to mount exfat with sync or flush).
alright well with my new drive all done i decided to check the old drive with crystaldiskinfo and it does indeed have unrecoverable sectors
100 of em
but luckily i got the replacement
@Euca