Skip to content

Commit e0c7733

Browse files
authored
Merge pull request #843 from rancher-sandbox/alpine-9p
Unmount mount points under /tmp before moving to persistent volume
2 parents dd8968b + 8edf32a commit e0c7733

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ if [ "$(awk '$2 == "/" {print $3}' /proc/mounts)" == "tmpfs" ]; then
3333
PART=$(lsblk --list /dev/"${DISK}" --noheadings --output name,type | awk '$2 == "part" {print $1}')
3434
mkfs.ext4 -L data-volume /dev/"${PART}"
3535
mount -t ext4 /dev/disk/by-label/data-volume /mnt/data
36+
# Unmount all mount points under /tmp so we can move it to the data volume:
37+
# "mount1 on /tmp/lima type 9p (rw,dirsync,relatime,mmap,access=client,trans=virtio)"
38+
for MP in $(mount | awk '$3 ~ /^\/tmp\// {print $3}'); do
39+
umount "${MP}"
40+
done
3641
for DIR in ${DATADIRS}; do
3742
DEST="/mnt/data$(dirname "${DIR}")"
3843
mkdir -p "${DIR}" "${DEST}"
@@ -48,4 +53,6 @@ if [ "$(awk '$2 == "/" {print $3}' /proc/mounts)" == "tmpfs" ]; then
4853
mount --bind /mnt/data"${DIR}" "${DIR}"
4954
fi
5055
done
56+
# Make sure to re-mount any mount points under /tmp
57+
mount -a
5158
fi

0 commit comments

Comments
 (0)