Check which folders have been added to AUFS?

For discussions about programming, and for programming questions and advice


Moderator: Forum moderators

Post Reply
miltonx
Posts: 164
Joined: Sat Nov 28, 2020 12:04 am
Has thanked: 13 times
Been thanked: 6 times

Check which folders have been added to AUFS?

Post by miltonx »

Is there any command to check which folders have been added as AUFS branches? I checked aufs man page but there does not seem to be any such info.

I tried a dirty workaround by re-adding a specific folder to check if it has already been added with this command, but unfortunately this command can be executed multiple times without popping any error (although actually it was only added ONCE, on the first run).

Code: Select all

mount -t aufs -n -o remount,add:1:/initrd/folder_1=rr /
User avatar
Trapster
Posts: 228
Joined: Sat Aug 01, 2020 7:44 pm
Location: Texas
Has thanked: 2 times
Been thanked: 71 times

Re: Check which folders have been added to AUFS?

Post by Trapster »

Try:

Code: Select all

mount | grep aufs

or

Code: Select all

cat /proc/mounts | grep aufs

to show directories in the union.

miltonx
Posts: 164
Joined: Sat Nov 28, 2020 12:04 am
Has thanked: 13 times
Been thanked: 6 times

Re: Check which folders have been added to AUFS?

Post by miltonx »

Trapster wrote: Fri Mar 07, 2025 3:34 pm

Try:

Code: Select all

mount | grep aufs

or

Code: Select all

cat /proc/mounts | grep aufs

to show directories in the union.

Here is all that is shown:

Code: Select all

root@live:~# mount | grep aufs
unionfs on / type aufs (rw,relatime,si=5f0f78424f3fc530)
root@live:~# cat /proc/mounts | grep aufs
unionfs / aufs rw,relatime,si=5f0f78424f3fc530 0 0
Burunduk
Posts: 268
Joined: Thu Jun 16, 2022 6:16 pm
Has thanked: 7 times
Been thanked: 136 times

Re: Check which folders have been added to AUFS?

Post by Burunduk »

Once upon a time I wrote a script that shows the order of the loaded sfs files. Maybe you'll be able to adapt it to your needs. At least you'll know where the info about the aufs branches comes from.

User avatar
fredx181
Posts: 3385
Joined: Tue Dec 03, 2019 1:49 pm
Location: holland
Has thanked: 437 times
Been thanked: 1484 times
Contact:

Re: Check which folders have been added to AUFS?

Post by fredx181 »

miltonx wrote: Fri Mar 07, 2025 7:39 am

Is there any command to check which folders have been added as AUFS branches? I checked aufs man page but there does not seem to be any such info.

I tried a dirty workaround by re-adding a specific folder to check if it has already been added with this command, but unfortunately this command can be executed multiple times without popping any error (although actually it was only added ONCE, on the first run).
...

If your question is about specifically a 'dog' system using aufs (latest are using overlayfs, btw) , I noticed "root@live" at your later post, so I think so (but you didn't indicate, so just guessing).
Simply ls /mnt/live/memory/images will give the folders from the layered filesystem, or for a graphical view go there with the file manager.
edit: curious, what is your reason for wanting to know ? Note that for Puppy it's all different.

miltonx
Posts: 164
Joined: Sat Nov 28, 2020 12:04 am
Has thanked: 13 times
Been thanked: 6 times

Re: Check which folders have been added to AUFS?

Post by miltonx »

fredx181 wrote: Mon Mar 10, 2025 4:35 pm
miltonx wrote: Fri Mar 07, 2025 7:39 am

Is there any command to check which folders have been added as AUFS branches? I checked aufs man page but there does not seem to be any such info.

I tried a dirty workaround by re-adding a specific folder to check if it has already been added with this command, but unfortunately this command can be executed multiple times without popping any error (although actually it was only added ONCE, on the first run).
...

If your question is about specifically a 'dog' system using aufs (latest are using overlayfs, btw) , I noticed "root@live" at your later post, so I think so (but you didn't indicate, so just guessing).
Simply ls /mnt/live/memory/images will give the folders from the layered filesystem, or for a graphical view go there with the file manager.
edit: curious, what is your reason for wanting to know ? Note that for Puppy it's all different.

Yes it's a dog/puppy like system, but I only took puppy linux's kernel, while the system is debootstrap made into a minimal debian, borrowing part of your make script. Therefore it's different from a dog/puppy, and there is no /mnt/live/memory/images.

The reason I need to check branches is that my sfs-load and sfs-unload scripts are kind of different, and sometimes my sfs-unload fails, so I need to check the branches to see if I need to unload it again.

miltonx
Posts: 164
Joined: Sat Nov 28, 2020 12:04 am
Has thanked: 13 times
Been thanked: 6 times

Re: Check which folders have been added to AUFS?

Post by miltonx »

Burunduk wrote: Mon Mar 10, 2025 12:03 pm

Once upon a time I wrote a script that shows the order of the loaded sfs files. Maybe you'll be able to adapt it to your needs. At least you'll know where the info about the aufs branches comes from.

I skimmed through your script and understand the basic logic, which checks both /sys/fs/aufs and /initrd, and then finds out which /initrd/... folder has been added as a branch. This works. But I was wondering if there is any aufs-inherent command to check which folders have been added as a branch. Looks like they did not implement this, and considering aufs is becoming less popular, I'd better stop hoping for such a facility now.

Post Reply

Return to “Programming”