I would like to install a software on an external disk (ebs volume) that I added to my EC2 instance. This disk is mounted at /mnt/external_disk.
My procedure is this:
# 1. install software to /usr/local/bin
# 2. mount disk at /mnt/external_disk
# 3. copy folder to external disk
cp --preserve=all --recursive /usr/local/bin $MOUNT_DIR/usr/local
# 4. update /etc/fstab
# 5. reboot system
My fstab looks like this.
UUID=a482dce8-a78a-42c8-931e-xxxxxeb43 / xfs defaults,noatime 1 1
/dev/xvdk /mnt/external_disk xfs nofail,noatime,nodiratime 1 2
/usr/local /mnt/external_disk/usr/local none defaults,bind 0 0
After the reboot everything looks fine. The software is installed and can be addressed via its cli.
Next, I terminate the ec2 instance so that a new instance is created via the autoscalinggroup. This has the same volume mounted. I can ensure that the same volume is always mounted by manually creating a file on this disk.
The software and its cli interface can no longer be accessed. The installation folder in /usr/local/bin is empty.
It must be related to my /etc/fstab somehow.
I was able to reproduce the following: as soon as I add a folder like /var/lib/test to the fstab using the following entry, all the data in this directory on the external disk is no longer displayed.
UUID=a482dce8-a78a-42c8-931e-xxxxxeb43 / xfs defaults,noatime 1 1
/dev/xvdk /mnt/external_disk xfs nofail,noatime,nodiratime 1 2
/usr/local /mnt/external_disk/usr/local none defaults,bind 0 0
/var/lib/test /mnt/external_disk/var/lib/test none defaults,bind 0 0
Do any of you know what I'm doing wrong here?