0

I have an x86-64 system running Ubuntu 24.04.2 LTS (recently upgraded from 22.04.5).

The root filesystem is on a 3 or 4 terabyte SATA hard drive (not an SSD).

Recently the filesystem stopped working with no warning. As far as I can tell, all directories are still readable, but attempting to read any file results in "Input/output error".

I still have an ssh session into the system, with several bash shell instances still running. I can only execute builtin commands (for example, ls fails but echo * works). I've also found a statically linked busybox executable on another drive, so I can use that to execute some limited commands, but the inability to access files means there's not much I can do.

If I logout of the system I'm not going to be able to log back in, and a reboot would almost certainly fail, so I'm leaving it as it is for as long as I can.

I presume this is some kind of hardware failure on the hard drive. My questions are: what is a likely cause, and is there any chance I'll be able to recover the files?

I do have (incomplete) backups, and I'm planning to get a new hard drive and install Ubuntu from scratch, but ideally I'd like to be able to copy my existing files to the new drive.

2 Answers2

2

I presume this is some kind of hardware failure on the hard drive.

Yes, IO errors upon accessing the drive that suddenly appeared for no visible reason does look like the drive failing. You can try to repair the filesystem as suggested in comments and see if that helps, but whether it will work remains to be seen.

My questions are: what is a likely cause

I'm not exactly sure what answer you'd expect, both HDDs and SSDs wear down with time, so generally answer is "age". Then of course there may be more special reasons for such failure, for example HDDs are notable for easily deteriorating if they experience impact (e.g. if someone accidentally bump the PC or laptop with HDD inside). You can generally monitor the current disk state with smartctl utility that accesses internal disk information about its state.

, and is there any chance I'll be able to recover the files?

This depends on how bad disk state is. If you can reboot and fix filesystem and more or less access the files again, well, then do that. Otherwise, I presume information may still be recovered with some forensic utilities and physical access to the disk, but nothing readily accessible to a common user.

Hi-Angel
  • 4,810
0

I've been able to restore the drive to working condition, but I'll consider it unreliable.

I installed a new larger hard drive and kept the old one, and installed Ubuntu 24.04.2 LTS on the new drive. I was able to run

fsck -y -C -t ext4 /dev/mapper/ubuntu—ug-root

I didn't record the output, but one message I saw was:

/dev/mapper/ubuntu--vg-root: Inodes that were part of a corrupted orphan linked list found.

After that and a reboot, I was able to mount the old drive (as /mnt/baddrive), and it appears to be intact. Apparently it wasn't as bad as I had assumed it would be, and I can recover data that I had not otherwise backed up (I know, I know), but I'll consider the old drive to be unreliable.