1

I have mounted a directory with the following command

sudo unionfs -o cow,max_files=32768 -o allow_other,use_ino,suid,dev,nonempty stuff-linux64=RW stuff

How do I change stuff-linux64 from RW to RO and add another directory (stuff-update64) on top?

The end result should look like I'd executed:

sudo unionfs -o cow,max_files=32768 -o allow_other,use_ino,suid,dev,nonempty stuff-update64=RW:stuff-linux64=RO stuff

after unmounting stuff.

For that matter, how do I unmount a filesystem that I mounted with unionfs?

CentaurusA
  • 2,652
  • 1
  • 21
  • 27
sk8nfool
  • 21
  • 1
  • 5

2 Answers2

3

unionfs is a shorthand for unionfs-fuse which is built atop the FUSE (Filesystem in Userspace) system. Therefore, the preferable way to unmount a unionfs-fuse is through the FUSE system directly using fusermount -u ~/example-mount-point (the -u switch means "unmount").

A big advantage of using fusermount instead of umount is it requires no privilege elevation. As the name implies, FUSE all happens in userspace. That means both mounting and unmounting can be accomplished from your limited user account, with no need for sudo, provided of course that you have permission to access the directories you're working with.

1

I think just umount <the-mount-dir> is enough.

Here is an example: Say I have this directory structure under /tmp/unionfs:

.
├── Fruits
│   ├── Apple
│   └── Tomato
└── Vegetables
    ├── celery
    └── Tomato

2 directories, 4 files

Now mount the Fruits and Vegetables on /tmp/mnt:

$ unionfs-fuse /tmp/unionfs/Fruits:/tmp/unionfs/Vegetables /tmp/mnt

To unmount it do this:

# umount /tmp/mnt
z.h.
  • 163
  • 5