Correct way to umount?

When mounting a repository, restic says Don't forget to umount after quitting!. If I interrupt restic’s mount process, there’s nothing to umount. If I do umount /mnt/restic while it’s still running, restic says unable to umount (maybe already umounted?): exit status 1: fusermount: entry for /mnt/restic not found in /etc/mtab.

What’s the right way to do this?

1 Like

Both ways are alright. Restic tries to unmount in any case. Maybe the Don't forget to umount is a bit unfortunate then.

Yeah, @fawick is right, and I think we can (and should) improve the user interface of the mount command.

Yep, I was confused about how to end the fuse mount.

How about just say “Press Ctrl-C to quit and umount” and the try to umount and if it fails, ask the user to umount themselves in a warning?

This error message is still here at this time. A bit confusing for newcomers I would say.

@ZeliTheZealot Can you please elaborate on what you think is currently unclear in the output from restic in regard to the mount?

It currently looks like this when just doing the mount in order to browse the mount point:

% ./restic mount mnt
repository baffc29d opened (version 2, compression level auto)
[0:00] 100.00%  2 / 2 index files loaded
Now serving the repository at mnt
Use another terminal or tool to browse the contents of this folder.
When finished, quit with Ctrl-c here or umount the mountpoint.

It currently looks like this when doing the mount and then unmounting the mount point in another terminal (i.e. it just quits, which seems sensible):

% ./restic mount mnt
repository baffc29d opened (version 2, compression level auto)
[0:00] 100.00%  2 / 2 index files loaded
Now serving the repository at mnt
Use another terminal or tool to browse the contents of this folder.
When finished, quit with Ctrl-c here or umount the mountpoint.
%

@rawtaz

When mounting in the background:

my_computer_name:~ root# restic mount mount_location &
[1] PID

my_computer_name:~ root# repository NUMBER opened (version 2, compression level auto)
[0:00] 100.00% 1 / 1 index files loaded
Now serving the repository at mount_location
Use another terminal or tool to browse the contents of this folder.
When finished, quit with Ctrl-c here or umount the mountpoint.

When umounting via killing the background process:

my_computer_name:test_backup root# kill PID
signal terminated received, cleaning up
unable to umount (maybe already umounted or still in use?): unmount mount_location: resource busy

[1]+ Done restic mount mount_location (wd: ~)

The restic version is:

restic 0.18.1 compiled with go1.25.5 on darwin/amd64

Thank you for your attention.

This is what I get on my macOS:

% ./restic mount mnt &
[1] 47433
% repository baffc29d opened (version 2, compression level auto)
[0:00] 100.00%  2 / 2 index files loaded
Now serving the repository at mnt
Use another terminal or tool to browse the contents of this folder.
When finished, quit with Ctrl-c here or umount the mountpoint.
signal terminated received, cleaning up

[1]  + done       ./restic mount mnt

The last line showed up only when I killed the restic process in a second terminal.

To clarify, I killed it by PID in the same terminal (it’s in the background – no need to use a second terminal right?).

You are right, I could have killed it in the same terminal. Here it is:

% ./restic mount mnt &
[1] 3382

% repository baffc29d opened (version 2, compression level auto)
[0:00] 100.00%  2 / 2 index files loaded
Now serving the repository at mnt
Use another terminal or tool to browse the contents of this folder.
When finished, quit with Ctrl-c here or umount the mountpoint.

% kill 3382
                       signal terminated received, cleaning up

[1]  + done       ./restic mount mnt

I don’t see any problems or error messages in there. And we seem to be on the same operating system (although I’m on an older macOS version in this example than you probably are) and the same restic version (albeit built with different Go versions):

% ./restic version
restic 0.18.1 (v0.18.1-0-g7d0aa7f2e) compiled with go1.23.5 on darwin/arm64