Interview Prep/Linux/Storage, disks and filesystems

You need to free a disk that is mounted, but `umount` says "target is busy". What do you do?

BeginnerScenarioStorage, disks and filesystems
Answer

Situation read → Some process has a file open or a cwd on that mount.

What I'd do →

sudo fuser -vm /data
sudo lsof +f -- /data

Stop those services cleanly (or ask users to cd out), then umount /data. Last resort: umount -l /data (lazy) and make sure nothing writes afterwards.

Why → Killing a database to unmount is worse than stopping it properly.

Interview tip → Mention that a shell sitting in the directory, often your own, is the classic culprit.

All Linux questions Roadmap: Linux

More on Storage, disks and filesystems