How can I mount all filesystems in fstab?

If I specify a bind mount in my configuration.nix, it doesn’t seem as if it gets picked up until next reboot.

Can I somehow run a command to check all fstab entries to see if they are mounted and if not, mount them?:wink:

It’s not quite 1 command, but.

To see what’s mounted:
$ mount

To mount a disk /dev/disk0 at /mnt/foo:

  • $ mount /dev/disk0 or
  • $ mount /mnt/foo

Note that the disk can be e.g. a UUID path (/dev/disk/by-uuid/... ), not just a literal device path.

In either case, the assumptions are:

  1. You’ve rebuilt your system with the relevant mount entry present in the configuration (which puts it in /etc/fstab)
  2. The mount entry allows your user to mount it. If this doesn’t, hold, you need to mount the disk with sudo.

I know I can manually mount, but isn’t there like a command that can check all entries in fstab and if it finds an entry that is not mounted, then mount it?

That would be $ mount -a.

1 Like

Yeah, that’s perfect;). Thanks