I’ve been learning a lot of old Linux-y concepts and tools this past week.

My homelab died.

Some quick background on my homelab:

It’s a small “Think Center” box that I bought used off ebay earlier this year.

I host an ai coding agent on it that I connect to from my phone, over cloudflare tunnel (Warehouse)

I was vibing a game in the evening, but in the morning I couldn’t connect. Turned it off and back on… still no connections, and I couldn’t even find it at all on my local network.

Time to dig out the the monitor and keyboard I pull out when I need to do something I can’t do via SSH…

Error reading block 18876550...
The root filesystem on /dev/nvme0n1p2 requires a manual fsck
BusyBox v1.37.0 Debian
(initramfs)
The boot console reports repeated NVMe medium errors before dropping to the initramfs shell.
The boot failure on the basement monitor. The NVMe read errors are above the fsck prompt.

That doesn’t sound good…

Looked into it, and as I suspected, this means the drive got corrupted

AI field notesWhy the boot error pointed to the SSD

The last line asks for fsck, but the lines above it explain why the check stopped. The NVMe controller reported a critical medium error on reads. The kernel then reported an I/O error on the ext4 root partition, and the automatic check exited with status 4, meaning it left errors uncorrected. BusyBox in the initramfs is the early-boot shell you get when the system can’t continue to its root filesystem.

On a drive that still holds the only copy of important files, the order matters. A repair can rewrite filesystem metadata while the underlying device is still returning read errors. Booting another system let David mount the filesystem read-only and copy the important projects before attempting repairs. Debian’s e2fsck manual

I still had debian on a bootable thumbdrive, figured I’d give it a try to connect to the other drive, Went through the good ol’ “press f12 to enter boot menu”, then “execute a shell” (“boot” rather than install)

And BusyBox is up,

A blue Debian installer screen with a BusyBox shell across the bottom.
A second BusyBox prompt, this time inside the Debian installer.

I could see the volume, but could not mount it. w/ big scary looking error page:

Error reading Release file
A red Debian installer screen says Error reading Release file.
The Debian installer could not read the installation media’s Release file.

I guess the warning message i glossed over when booting about not being able to “detect and mount installation media” was important.

AI field notesWhy the Debian stick could see the disk but couldn’t mount it

The ThinkCentre’s F12 menu chooses a boot device. The GRUB menu on the installed drive chooses a kernel on that same drive. Choosing an older kernel there would still send Debian back to the same root partition. F12 got David to the installer USB and its own BusyBox shell.

The installer could list the NVMe partition, but the attempt to mount ext4 returned No such device. Listing a block device and having the filesystem driver available are separate steps. The later Error reading Release file came from Debian’s installation-media check. It concerned the installer’s own package metadata and left the recovery attempt in a minimal environment. SystemRescue gave David a working shell with the storage tools already available. Debian’s rescue-mode guide

The Lenovo Startup Device Menu lists the internal drive and USB boot choices.
The F12 startup menu chooses which device to boot.

My chatbot suggested rather than the base debian, use a specific distro purpose built for this: https://www.system-rescue.org/

Plain html styling and a penguin? looks good to me.

AI field notesWhat a dedicated rescue USB brings to the job

SystemRescue boots its own Linux environment from removable media. It comes with tools for three different jobs. smartctl reads a drive’s health report, rsync copies files you can still reach, and GNU ddrescue images a device or partition while working around unreadable regions. An image keeps the filesystem structure available for a later repair attempt on a copy.

Here the home directory was readable enough to copy the highest-priority projects first. That got those files off the SSD before asking it to read the rest of the tree. SystemRescue tool list

Installed and went to boot it up, but saw “Secure Boot Violation”

A firmware dialog says Secure Boot Violation and Invalid signature detected.
The firmware rejected the SystemRescue USB before Linux started.

I had to disable secure boot (reminder to self - once i’ve finished all this - turn secure boot back on, LOL!)

AI field notesWhat Secure Boot was checking

UEFI Secure Boot checks the signature of the bootloader against the firmware’s trust policy. The SystemRescue USB reached that check and the ThinkCentre refused its signature, so the error appeared before SystemRescue could load. Disabling Secure Boot in setup let the USB start. The setting applies to subsequent boots too, which is why there’s a reminder above to turn it back on after the rescue.

After changing the setting, David picked the USB again and used the default SystemRescue entry. The menu also had an option that would hand booting back to the installed Linux system, which would have put him right back at the failed root partition. SystemRescue boot guide · SystemRescue maintainer on Secure Boot

The SystemRescue boot menu highlights Boot SystemRescue using default options.
The default USB boot option appears after changing the firmware setting.

And here we go, we’re in system rescue!

The SystemRescue text console shows the welcome message and a root shell.
The SystemRescue shell, where the disks finally mounted.

(After a few mistypes) I finally mounted the old drive. Relief…

Mounted my expansion drive, and started to rsync over my home directory. It looked like it would take 150GB of my remaining 500GB, so should be no problem. Started the rsync, and went to bed.

AI field notesHow the failing disk was mounted without replaying its journal

The internal NVMe’s ext4 partition was the source and the exFAT Expansion drive was the destination. ro requests a read-only mount, and noload keeps ext4 from replaying its journal. Journal replay can otherwise write to a volume even during a read-only mount. Skipping it can expose an inconsistent filesystem, which is one reason the goal at this point was to get reachable files off the disk. Linux ext4 mount options

mount -t ext4 -o ro,noload /dev/nvme0n1p2 /mnt/src
mount /dev/sda2 /mnt/dst
df -h /mnt/dst

Those were this machine’s device names at the time. The filename /dev/sda2 was confirmed from the Expansion label. The initial df -h showed 542 GiB available, and the source’s filesystem later reported about 193 GiB used overall. Those numbers compare space on two different filesystems. The apparent fit turned out to be misleading.

The shell shows the Expansion mounted at /mnt/dst with 542G available.
Both disks were mounted, and the Expansion reported 542 GiB free before the copy.

Next day when i checked… rsync failed, because it ran out of space.

What? I had plenty of space?

Plugged in the expansion drive to laptop to see what had happened,

I was tired of sitting at the physical box (it’s on the floor in my basement) and I wanted my coding agent to dig into this (I was losing patience) So I enabled SSH, and took my laptop to the couch.

AI field notescoding agents running commands over ssh

The monitor and keyboard got SystemRescue onto the network. Once SSH was up, the laptop became a remote terminal into the ThinkCentre. The coding agent used the same connection to inspect mounts, check copy logs and run commands on the rescue box. The transfer itself ran between disks plugged into the ThinkCentre, so the backup data didn’t have to travel over Wi-Fi.

A shared tmux session made the work visible from either terminal. The agent ran commands in a named window that David could switch to and watch. If the laptop’s SSH connection dropped, a copy running inside tmux could keep going, and reconnecting picked up the same session. tmux getting started guide

and coding agent’s theory is that due to difference in formats. (ext4 v exfat , iirc?) a tiny file might take up 4KB on ext4 and 128KB on exfat.

AI field notesHow a tiny file can take up 32 times the disk space

A 1 KiB file still needs a full allocation unit. On a filesystem with 4 KiB blocks that’s 4 KiB. On a volume with 128 KiB clusters it’s 128 KiB. Multiply by a million small files and the same payload can occupy about 3.8 GiB or 122 GiB, before counting filesystem metadata. Allocation sizes depend on how the volumes were formatted. Microsoft’s exFAT specification

The biggest clue on this copy was rootless Docker’s containerd snapshots. One contained a whole nixpkgs tree full of small files. Plain rsync -rt also copies each hardlinked pathname as a separate file, and exFAT has no hardlinks to preserve. Together these explain how the same bytes could demand far more space at the destination. The rescue notes don’t measure each effect individually. rsync manual

Node modules, Venvs, Docker image caches – all blew up

rm-ed those from the expansion, and re rsynced, this time excluding those.

Can now breath easy - all backed up.

AI field notesWhat the second rsync pass got off the drive

The retry skipped regenerated dependencies, virtual environments, caches, and Docker data. The sweep also skipped two bulky archive and backup folders whose existing copies were kept separately. Git directories and coding-agent sessions stayed in scope. Keeping Docker image layers is usually unnecessary for a rebuild, but databases and other persistent volumes can hold the only copy of app data and need their own backup.

The last pass transferred 119,729 regular files and about 8.06 GB of data. It ended with rsync code 23, a partial transfer. NVMe read errors prevented updates to six application logs and two files from a local PostgreSQL database David didn’t need. This copy mode skipped symlinks and special files. The Expansion had 303 GiB free when the sweep ended and was cleanly unmounted. rsync options and exit codes


Now, the question of what to do about my homelab.

(and before i go too much further reader, i haven’t decided yet)

Popped out the SSD to see what type I would need to purchase

An M.2 SSD held in place by a blue clip, with its identifying label obscured.
The Samsung 256 GB M.2 NVMe drive on the underside of the ThinkCentre.

Buying a new SSD would be $100 or so. Not that big of a deal, but I’m cheap, like really cheap.

I purchased the original used, because this is strictly for hobby and learning. So I am wondering, can I “repair” the SSD.

If I wipe it, and run fsck on it, could I keep using it? I wanted to see the health of it.

At this point my coding agent is doing all the work - so I don’t remember the exact cmd it ran, but it determined that this drive had already used up 135% of its estimated write life. I was a little shocked - as it is only 3 years old - the prev owner must have been using it hard I guess

AI field notesWhat 135% means on the Samsung SSD

smartctl -a /dev/nvme0n1 pulled the Samsung’s health report. The Percentage Used field is the manufacturer’s estimate of how much flash endurance the drive has consumed. The scale can go past 100. It measures estimated wear, so it can’t tell you how many days of service are left. NVMe specification

The stronger evidence was the degraded reliability warning and the unrecovered reads that showed up during both boot and rsync. The 256 GB drive also reported about 277 TB of host writes and 14,472 power-on hours, roughly 603 days. Most of those hours predate David’s three months with the machine. The lifetime write counter gives no dates, so it can’t say who generated most of the writes.

Formatting can make a fresh filesystem and an erase can clear data. The flash has still lived through the same write cycles afterward. A successful wipe or a test pass would leave the worn flash and the previous read failures relevant to any decision about reusing it.

Still determined to be cheap, I’ve had another HDD for over a decade, and there’s a free SATA slot!

Since it’s an old drive,

The open ThinkCentre with its black drive tray beside the silver heatsink.
The ThinkCentre’s empty 2.5-inch drive tray, where the Toshiba could go.

I’m going to run smartctl to do a deep check of its health, and make sure this isn’t a terrible idea. (it probably is)

AI field notesWhat the extended SMART tests say about the two old hard drives

smartctl -a reports the drive’s current health and history, and smartctl -t long asks its firmware to start an extended self-test. The terminal can disconnect while the drive keeps testing. Later, smartctl -c -l selftest shows the status and the test log. A clean health summary and a completed extended test provide different evidence. smartctl manual

  • Toshiba, 500 GB. The USB test logged Aborted by host with 90% remaining. Reallocated, pending and uncorrectable sector counts were all zero. The logs didn’t explain the interruption. The next boot-drive check is a fresh test connected directly to the ThinkCentre’s SATA port.
  • WD My Passport, 1 TB. The USB backup candidate still had 40% remaining at the November 29 afternoon check, far past its roughly 3½-hour estimate. Its three sector counts were also zero, and it had yet to log a completed test. This WD has USB on the drive’s board and would stay external.

A nightly copy would put the home files onto a second physical disk. A test restore after the first run would check that the important files can actually be recovered. Keeping the Expansion rescue copy through the reinstall gives the new setup time to prove itself.

This^ takes a long time, so I won’t be finishing today. The intention will be, once I have formatted it and installed the new OS on that, to get a proper daily sync going to an external drive, so I don’t really care if it dies in the next year. (that just means i get to start from a clean slate on a new linux distro!)

And that is where I leave you for now.