Skip to content

Commit 60a2d31

Browse files
committed
Force sync after moving persistent directories to data volume
Otherwise the data configured by cloud-init/lima-init may get lost if the instance is forcibly stopped (e.g. via `limactl stop -f`). Example: $HOME/.ssh/authorized_hosts is lost (size 0): Even though cloud-init/lima-init will re-create the file on next boot, the new version will be shadowed by the /mnt/data/home/$USER.linux/.ssh directory that will be mounted on top and the instance will remain inaccessible. Signed-off-by: Jan Dubois <[email protected]>
1 parent 18e98dc commit 60a2d31

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pkg/cidata/cidata.TEMPLATE.d/boot/05-persistent-data-volume.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ if [ "$(awk '$2 == "/" {print $3}' /proc/mounts)" == "tmpfs" ]; then
4343
mkdir -p "${DIR}" "${DEST}"
4444
mv "${DIR}" "${DEST}"
4545
done
46+
# Make sure all data moved to the persistent volume has been committed to disk
47+
sync
4648
break
4749
fi
4850
done

0 commit comments

Comments
 (0)