Entry in fstab is not mounted automatically


(Brooke Tsui) #1

My Ubuntu is 16.04 and LXD 3.0.1

Inside the container, my /etc/fstab is shown below.

LABEL=cloudimg-rootfs / ext4 defaults 0 0
/dev/zd0 /home2 ext4 defaults,usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv1 0 0

The 2nd entry “/dev/zd0” can be mounted by issuing “mount -a” manually.

However it is not mounted automatically after reboot.

How to make it mounted automatically after reboot?


(Stéphane Graber) #2

I seem to remember running into similar issues in the past which got tracked down to a systemd bug I believe.

You may want to check if the relevant mount units have been created on boot and if they are, what’s their status. I seem to remember seeing some dependency issue there where an unprivileged container effectively wouldn’t have any of its mount units run.

@brauner not sure if it’s something you ever looked into.


(Brooke Tsui) #3

I tried to find the relevant mount units by the following command but got nothing.

root@test:~# ls -R /etc/systemd | grep mount


(Stéphane Graber) #4

Those are temporary units, they won’t show up in /etc.

Try systemctl -a | grep mount


(Brooke Tsui) #5

Thanks! I’ve just got the list as shown below and there is no /home2 there. So does it suggest a systemd bug?

root@test:~# systemctl -a | grep mount
  proc-sys-fs-binfmt_misc.automount          loaded    inactive dead      Arbitrary Executable File Formats File System Automount Point
  -.mount                                    loaded    active   mounted   /
  dev-.lxd\x2dmounts.mount                   loaded    active   mounted   /dev/.lxd-mounts
  dev-fuse.mount                             loaded    active   mounted   /dev/fuse
  dev-hugepages.mount                        loaded    active   mounted   Huge Pages File System
  dev-lxd.mount                              loaded    active   mounted   /dev/lxd
  dev-mqueue.mount                           loaded    active   mounted   POSIX Message Queue File System
  dev-net-tun.mount                          loaded    active   mounted   /dev/net/tun
  dev-ptmx.mount                             loaded    active   mounted   /dev/ptmx
  dev-zd0.mount                              loaded    active   mounted   /dev/zd0
  home-share.mount                           loaded    active   mounted   /home/share
  proc-cpuinfo.mount                         loaded    active   mounted   /proc/cpuinfo
  proc-diskstats.mount                       loaded    active   mounted   /proc/diskstats
  proc-meminfo.mount                         loaded    active   mounted   /proc/meminfo
  proc-stat.mount                            loaded    active   mounted   /proc/stat
  proc-swaps.mount                           loaded    active   mounted   /proc/swaps
  proc-sys-fs-binfmt_misc.mount              loaded    active   mounted   Arbitrary Executable File Formats File System
  proc-sys-net.mount                         loaded    active   mounted   /proc/sys/net
  proc-sysrq\x2dtrigger.mount                loaded    active   mounted   /proc/sysrq-trigger
  proc-uptime.mount                          loaded    active   mounted   /proc/uptime
  sys-devices-virtual-net.mount              loaded    active   mounted   /sys/devices/virtual/net
  sys-fs-fuse-connections.mount              loaded    active   mounted   FUSE Control File System
  sys-kernel-config.mount                    loaded    inactive dead      Configuration File System
  sys-kernel-debug.mount                     loaded    active   mounted   Debug File System
● tmp.mount                                  not-found inactive dead      tmp.mount
  var-lib-lxcfs.mount                        loaded    active   mounted   /var/lib/lxcfs
● systemd-remount-fs.service                 loaded    failed   failed    Remount Root and Kernel File Systems
  umount.target                              loaded    inactive dead      Unmount All Filesystems