The coach guides you without giving the cause away (in full versions, each hint costs 5 points).
c5d instances (the "d") have an NVMe instance store physically attached to the host. It is fast and
free, but ephemeral: a stop, a hibernation or a termination releases the host and the disk is
wiped. A resize requires a stop: the instance restarts on another host with a brand-new, blank
nvme1n1 disk. nvme list shows it clearly: "Amazon EC2 NVMe Instance Storage".
/etc/fstab still looks for the old UUID, which no longer exists. Because of nofail, systemd waits 90 s
and then boots anyway, without the mount: /mnt/medias becomes a plain folder on the root disk again,
where nginx only finds the 37 files uploaded since.
The security group is healthy (nginx answers 404, no timeout), the root disk is at 42% and the root EBS volume is intact: only the ephemeral disk was lost.
Incident resolved
Analysis and fix
Repair (classes start at 09:30):
- set aside the 37 files uploaded since the restart (
sudo cp -a /mnt/medias /root/medias-depuis-redemarrage), because the mount will hide them; - format the instance store:
sudo mkfs.ext4 /dev/nvme1n1; - mount it:
sudo mount /dev/nvme1n1 /mnt/medias; - restore from the backup:
sudo aws s3 sync s3://masterlinux-medias-sauvegarde/medias/ /mnt/medias/, then copy back the 37 files set aside and give ownership back towww-data; - check:
curl -Ion a diagram returns 200,df -hshows/dev/nvme1n1on/mnt/medias.
Files uploaded between the 19/10 02:00 backup and the 22:10 stop must be requested again from the trainers
(check the 20/10 backup, which ran after the restart and fortunately deleted nothing, because the job does not
use --delete).
Prevention:
- never keep unique data on an instance store: put the media on a dedicated EBS volume (gp3), or better directly in S3 (served by CloudFront);
- keep the instance store for cache and temporary files, recreated by a script at boot (format + mount by device name, not by UUID);
- monitor the mount point (
mountpoint -q /mnt/mediasin the health probe): a failingnofailmount must not go unnoticed; - write into the resize procedure: "stop = loss of the instance store".