The Plan Was Boring

My AI node, Farosh, also runs the house NAS. Until today it had two drives:

  • a 1 TB NVMe SSD for the system, the containers and the AI models,
  • a 2 TB spinning hard drive, split in half: one terabyte of NAS data and about 840 GB for backups.

I had a 4 TB Samsung SSD (an 860 QVO) and a free drive bay. The plan fit in one sentence: move the NAS data onto the new SSD and give the whole hard drive to backups. With two separate disks, one dead disk cannot take out both the NAS and the backups.

There is a bigger picture. My media library lives in encrypted cloud storage, and the media server streams it from there. That works until my internet goes down. Then nobody at home can watch anything. With 4 TB of local flash, the library can finally live at home. The cloud copy then becomes the backup, not the only copy.

So the plan was: shut down, plug in, copy, done. This is how it really went.

Surprise 1: The “New” Drive Wasn’t Empty

The SSD came out of an old family PC that I am reinstalling. When it showed up after boot, it was not blank. It had a single Windows partition, labelled “Data SSD”, with 2 TB on it.

Before I wiped anything, I mounted it read-only and looked:

mount -t ntfs3 -o ro /dev/sdX2 /mnt/review
du -sh --apparent-size /mnt/review/* | sort -rh | head -20

Most of it was games. There was a 766 GB game library, plus a handful of small indie games that might be hard to download again. But the biggest single item was a folder called found.018, at 824 GB. It had about twenty siblings (found.000 to found.033).

The Windows disk repair tool leaves these found.NNN folders behind. It puts data there when it cannot put the data back where it belongs. They can contain anything, family photos too. So I checked them before I called them junk:

  • search for camera-style file names (IMG_*, PXL_*, DSC*, .heic), screenshots and documents,
  • count file types per folder,
  • look at the top-level structure of the big ones.

found.018 was an old, orphaned copy of the same game library. Its 1,235 JPEGs were textures, and its PDFs were game manuals. There were no personal files anywhere.

The drive itself was also healthy. SMART passed, it had no reallocated sectors, and it still had 97% of its write endurance.

Lesson: a drive is only “new” if you looked. Mount it read-only, measure, and search for the things that matter. Then wipe it.

Surprise 2: The Rescue I Didn’t Need

The game library was mine, so I thought it was worth saving. A 766 GB copy is better than a second download. There was one problem: it did not fit anywhere. The NAS share had 666 GB free. The only other big empty disk was the SSD that I was about to wipe.

So I split it. The biggest games, about 470 GB, went to the nearly empty NVMe share. The rest went to the hard drive. A small script copied them game by game from the read-only mount. Then I verified every file against the original:

rsync -a --dry-run --itemize-changes SRC/ DST/ | grep -vc '^\.d'   # 0 = identical

Twelve games in, I got a request to stop after the current one. A bit later, the decision changed completely: “I don’t even want the Steam library anymore. It can be redownloaded.”

Fair enough. 585 GB of carefully verified copies went in the bin. Only the small indie games stayed.

I include this because it is honest. In a homelab, a lot of effort goes into protecting data that turns out to be “meh”. The useful lesson is about timing: ask if something is worth keeping before you spend an hour to preserve it.

There is one technical aside from that detour. I wanted to stop the copy cleanly after the current game. So I paused the main process of the script with SIGSTOP and waited for the running copy to finish. It finished.

But my “is it done yet?” check (kill -0 <pid>) said for ten minutes that it was alive. A finished child becomes a zombie when its paused parent cannot collect it. A zombie still answers kill -0. Check the process state, or stop the whole unit.

Surprise 3: Deleted, but Not Freed

After I deleted the staged games, the NVMe share showed 1% used. But the storage pool under it still reported the volume as 85% allocated.

That share is a thin volume. The pool gives out space only when something writes data. It gets the space back when the filesystem says “I don’t need these blocks any more”. TRIM/discard does that.

The share had online discard in its mount options. But it takes time to free hundreds of gigabytes, and the pool lagged behind. A full manual trim finished the job:

fstrim -v /mnt/fast        # 184 GiB trimmed
lvs                         # pool back from 66% to 9%

Lesson: on thin storage, “deleted” and “returned to the pool” are two different moments. Look at the pool, not only at df.

The Migration Plan

I wiped the SSD and set it up as a new 3.5 TB volume. For the move itself, I used a pattern that I like for big data moves:

  1. Bulk copy while everything stays online. About 465 GB took an hour from the hard drive, with the copy at idle I/O priority.
  2. Short downtime. Stop the four containers that use the share and run a final catch-up copy (only changes since the bulk run). Copy the one live disk image separately.
  3. Verify before you switch. A dry-run comparison must report zero differences.
  4. Swap by label. The mount entry says “mount the filesystem labelled data here”. Relabel the old disk data-old, label the SSD data, and remount. The path stays identical, so no container configuration changes at all.
  5. Keep the old disk untouched until you confirm everything. Only then reuse it.

Step 3 passed with 9,680 entries on each side and zero differences. Step 4 is where it got interesting.

Surprise 4: The Switch That “Succeeded”

The output of the script said DONE. But one line in the middle said this:

umount: /mnt/data: target is busy.

Something still used the old disk. The script continued anyway. That step had no guard, and that is my mistake. The script relabelled both disks and ran mount /mnt/data. This happily mounted the SSD on top of the old disk, at the same path.

Everything worked. The containers came up, they saw the SSD, and the copies were identical. That is exactly why it was dangerous. The old disk was still mounted under the SSD, out of sight. Any tool that looked at the device and not at the path would have been confused.

In the end, fuser named the culprit:

fuser -vm /dev/mapper/old-volume
#   music-ro  10494  ..c..  sshd-session

It was my laptop. My music folder there is a read-only network mount of the radio library on the NAS. For two hours, it had a session sitting in a directory on the old disk. Its working directory alone was enough to pin the whole filesystem.

The fix needed one more minute of downtime. You cannot unmount a filesystem that has another one mounted on top of it. So the order had to be this. Stop the containers and unmount the top (SSD). Unmount the bottom (old disk), mount only the SSD, and start everything. This time the script checked every unmount and stopped on any failure.

Lessons:

  • Check every unmount. If one fails, ask fuser -vm who holds it before you do anything else.
  • Remember the clients: laptops, media players and other machines with network mounts into the share.
  • A script that ends with DONE did not always do what you meant. Read the middle of the output.

Surprise 5: The Stale Handle Chain Reaction

The media server and the audiobook server do not run on Farosh. They run on another host, Din. Din mounts the media share of the NAS over the network. After the switch, one of those mounts returned this:

ls: cannot access '/mnt/farosh-media': Stale file handle

I expected that. The share now lives on a different filesystem, so every file reference that the client held is invalid. The fix is a remount. To be safe, I also restarted the two media containers, so that their bind mounts would pick up the new mount.

That made it worse, for two reasons:

  1. My remount logic was mountpoint -q /path && umount /path. mountpoint fails on a stale mount, so it reported “not a mount point”. The unmount never ran, and the new mount quietly reused the same stale connection.
  2. At start-up, the containers check their mount points. With a stale one, they refused to start (exit 116, the error code for “stale handle”).

So for about three minutes, the media server and the audiobook server were down. Luckily, nothing was playing. An unconditional lazy unmount (umount -l /path, then mount again) fixed the share. Both containers then started healthy.

Lessons:

  • Network clients of a migrated share need a remount. Plan it as part of the switch, not after it.
  • Test your safety checks against the failure that they guard against. “Is it mounted?” acts differently when the mount is broken.
  • Check what is playing before you restart media services. I did, and that is the only reason this was a non-event.

Surprise 6: My Dashboard Raised a False Alarm

My monitoring dashboard shows the drives of each host. So I added a card for local filesystems and physical drives. It immediately showed two misleading things:

  • A heat warning for a healthy SSD. The dashboard had a single “hdd” temperature: the hottest drive of any kind, with a warning at 45 °C. A spinning disk at 45 °C deserves a look. An SSD at 46 °C is perfectly normal. I split the reading into hdd and ssd with separate limits (SSDs warn at 60 °C). This applies to the dashboard and to the push alerts.
  • A “nearly full” disk that was nearly empty. The volume group of the new SSD showed “3.6 TB (112 GB free)”. That is technically true, because almost the whole group goes to one volume. But the filesystem inside was 10% full. The label now says unallocated. The new card shows the real usage of each filesystem, with the model of the drive behind it.

The new "Local disks & NAS" card: each filesystem with the drive behind it, and every drive with its temperature

Lesson: when the hardware changes, check again what your dashboards assume. “One drive, one kind” was a quiet assumption, until it failed.

The Payoff

With the NAS safely on the SSD, I removed the old 1 TB slice of the hard drive. Then I grew the backup volume into that space. I did it online, and not a single backup stopped:

BeforeAfter
NAS data1 TB on a spinning disk3.5 TB on SSD
Backups~840 GB1.8 TB
Disks per roleNAS + backups shared one driveOne drive per role
Free bays21 (room for a mirror SSD)

Bringing the Library Home, Slowly

The last piece is the media library: about 1.8 TB in encrypted cloud storage. A download at full speed would hog the home internet connection for hours. So I copied the idea from my offline encyclopedia downloader: drip-feed it.

  • A job runs every 30 minutes and copies for up to 28.
  • 15 MiB/s during the day, 40 MiB/s at night, a small slice of the line.
  • A 150 GB daily cap, so the whole library arrives in about 12 days.
  • It is resumable and idempotent. Each run skips what is already there.
  • It runs on the host that already has the cloud credentials. It writes to the NAS over SSH, so no new machine gets the keys.
  • A heartbeat goes to my uptime monitor. There is one notification a day, and a progress card on the dashboard.

The media server keeps streaming from the cloud the whole time. Nothing changes for the people who watch until the final switch-over. After that, the cloud copy becomes a nightly, one-way backup of the local library. It keeps deletions for 30 days in case of mistakes.

Of course, the card had its own small bug. It updated only at the end of each 28-minute run. So it said “0 GB” while 20 GB was already on the SSD. The job now writes its progress every minute.

The drip card: copied vs. total, today's share of the daily cap, pacing and ETA

Takeaways

  • Look before you wipe. Mount read-only, measure, and search for personal files. found.NNN folders deserve a look, not a shrug.
  • Decide what is worth saving before you save it. Data that you can download again rarely is.
  • Thin storage frees space later than you think. Run fstrim and check the pool.
  • Migrate by label, keep the path. Containers and clients do not need to know that a disk changed.
  • Guard every unmount and ask fuser -vm who holds it. The culprit can be a laptop in another room.
  • “DONE” is no proof. Read the middle of the output.
  • Plan the remounts of the clients as part of the switch. Test safety checks against broken states.
  • Check dashboard assumptions again when the hardware changes.
  • Move big data politely. Rate limits, a daily cap, resumable runs and a progress card are better than a saturated line.