Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How AUFS should work when we delete a file and remount it into the union? #26

Open
fulalas opened this issue Mar 14, 2023 · 7 comments
Open

Comments

@fulalas
Copy link

fulalas commented Mar 14, 2023

First of all: thanks a lot for the hard work. Many exciting projects only exist because of you :)

I have a very technical question that I hope you can clarify, if you don't mind. I work on Porteus distro, which uses AUFS to mount mksquashfs modules into the union on the fly. I noticed that if I delete a file from the union (e.g /usr/bin/xfce4-taskmanager) it appears in /mnt/live/memory/changes/usr/bin as .wh.xfce4-taskmanager with zero byte. So far so good!

However, if after that I try to mount a mksquashfs module with the same file/path, it doesn't appear in the union anymore. Somehow the whiteout file has a higher priority in the stack. If I delete the whiteout file, then the real file (/usr/bin/xfce4-taskmanager) will automatically appear in the union. Also, if I manually copy (instead of mounting) the real file to the union, it appears normally and can be executed without any problem.

1- Is this the expected behavior?
2- Is there a way to set the whiteout files to have the lowest priority in the stack so that mounting mksquashfs modules into the union will make them appear for the user?

Thanks in advance!

@sfjro
Copy link
Owner

sfjro commented Mar 14, 2023 via email

@fulalas
Copy link
Author

fulalas commented Mar 15, 2023

@sfjro, thanks for your reply! I made video so I can explain better what I mean. Just follow the cursor and you'll understand everything (I hope :P)

aufs.mp4

@sfjro
Copy link
Owner

sfjro commented Mar 15, 2023 via email

@fulalas
Copy link
Author

fulalas commented Mar 16, 2023

@sfjro, the downscale video in Github is pretty bad. You have to watch in full screen -- you'll be able to even see the commands I'm using to add the module to the union, which is mount -no remount,add:1:"$MODULE"=rr aufs /

You are removing and re-adding the branch under the top of the
stack. The white-out exists on the top branch which hides the lower
same-named entires.

So, if I understand correctly, what determines a branch is actually the path/files of its content in the union. Interesting! But it's still unclear how to set the whiteout to have the lowest priority in the stack in such a way that when trying to add the same branch again the whiteout will be ignored and the file will appear in the union.

@sfjro
Copy link
Owner

sfjro commented Mar 16, 2023 via email

@fulalas
Copy link
Author

fulalas commented Mar 26, 2023

Hello! Sorry for the long delay -- I've been busy.

I'm trying to do what you said, but there's something missing. I'm assuming the code you suggested is the one to remove a squashfs from the union, not to load it. So this is my original script to remove a squashfs module:

mount -t aufs -o remount,del:"$MODULE" aufs /
umount -nd "$MODULE"
rmdir "$MODULE"

Reading your instructions, I tried to adapt to this:

mkdir /tmp/$BASEFILENAME
mount -t aufs -o remount,prepend=/tmp/$BASEFILENAME,del="$MODULE" aufs /
umount -nd "$MODULE"
rmdir "$MODULE"

When I run it (after the module is inserted in the union) it says mount: /: mount point not mounted or bad option. What am I missing?

Thanks once again :)

@sfjro
Copy link
Owner

sfjro commented Mar 27, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants