Interview Prep/Linux/Storage, disks and filesystems

You need to move a busy MySQL data directory from the root disk to a new, faster volume. Plan it.

IntermediateScenarioStorage, disks and filesystems
Answer

Situation read → Short downtime is unavoidable for a consistent copy unless you replicate.

What I'd do →

  1. Pre-sync while running: rsync -aHAX /var/lib/mysql/ /mnt/newvol/mysql/.
  2. Stop MySQL, run a final rsync -aHAX --delete (fast, only changes).
  3. Mount the new volume at /var/lib/mysql via fstab (better than changing datadir).
  4. Fix SELinux labels if enforcing: restorecon -Rv /var/lib/mysql.
  5. Start MySQL, check the error log and run a test query. Keep the old copy for a few days.

Why → Two-pass rsync keeps downtime to the size of the delta, and mounting at the original path avoids config and SELinux changes.

Interview tip → For zero downtime, mention building a replica on the new volume and failing over.

All Linux questions Roadmap: Linux

More on Storage, disks and filesystems