Open moenodedev opened 3 months ago
If I change the mount point back to the original (a mountPoint that was already used) the previous mountPoint is still mounted:
mounts:
- location: "~"
- mountPoint: "/home/trojan4"
+ mountPoint: "/home/development"
writable: true
$ mount | grep ^mount
mount0 on /home/trojan4 type virtiofs (rw,relatime)
mount1 on /tmp/lima type virtiofs (rw,relatime)
mount0 on /home/development type virtiofs (rw,relatime)
The original does get the correct permissions and contents:
$ ls -ld /home/development
drwx------ 11 development development 352 May 25 13:33 /home/development
Another stop/start makes the instance forget the previous mount:
$ mount | grep ^mount
mount0 on /home/development type virtiofs (rw,relatime)
mount1 on /tmp/lima type virtiofs (rw,relatime)
Is it important to remove the empty directories ? We could add some rmdir
code, matching the mkdir
.
https://github.com/lima-vm/lima/blob/v0.22.0/pkg/cidata/cidata.TEMPLATE.d/boot/05-lima-disks.sh#L31
EDIT: Not sure what VZ is doing, only know QEMU
Supposedly one could add some systemd script to clean up the mount points, and something similar for openrc
https://www.freedesktop.org/software/systemd/man/latest/systemd-poweroff.service.html
/usr/lib/systemd/system-shutdown/lima.shutdown
/etc/local.d/lima.stop
EDIT: Nope, these scripts are run when all filesystems are unmounted (or read-only), so too late to clean up there
Is it important to remove the empty directories ? We could add some
rmdir
code, matching themkdir
.
We could, as long as we only remove empty directories (and ignore errors when they are not empty).
We cannot force-remove the mount point because it may exist with content the user wants to keep, and it was only temporarily shadowed by a mount.
I think rmdir
should be OK (leave files and fail), but the timing is tricky...
I was trying with a "lazy" (fuser)unmount, but any processes using it needs to be stopped first
Description
Instructions:
Change your home mount point
/home/trojan2
,/home/trojan3
,/home/trojan4
After doing this 4 times:
/home/trojan1
is empty (not mounted) and owned by root/home/trojan2
is empty (not mounted) and owned by root/home/trojan3
is mounted and owned by $USER/home/trojan4
is mounted and owned by $USERDiscussion: #2359
Configuration: