1

I'm running a modified WD MyCloud (Gen 1) NAS with Debian 8 (Jessie) installed on it.

Due to the nuances of the device, I can't resize the root partition, and am struggling with space on it.

To remedy this, I've rsynced the /var and /usr directories on to the main data partition.

I've then added the following lines to the /etc/fstab:

/data/rootfs/var    /var    none    defaults,bind    0    0
/data/rootfs/usr    /usr    none    defaults,bind    0    0

Upon rebooting, I find that the /var directory has successfully been mounted, but that the /usr directory has not.

If I then run mount -a, I get no errors, and the /usr directory is correctly mounted.

What's going wrong?

1

If you are using systemd, mounts are done in parallel (by dynamically converting the fstab entries into mount units), line ordering is not preserved as would be expected from pre-systemd experience.

You have an untold dependency that's not automatically guessed: mounting /data/ before mounting /usr. WIthout it you get a race condition.

You have to manually add the dependency as a pseudo mount option, using x-systemd.requires=. So if the previous mountpoint that should be mounted is /data, this should make it work:

/data/rootfs/var    /var    none    x-systemd.requires=/data,bind    0    0
/data/rootfs/usr    /usr    none    x-systemd.requires=/data,bind    0    0

In case somebody else finds this question, but the use case is for /data being a remote network filesystem like NFS, the pseudo mount option _netdev (pre-systemd option also recognized by systemd) must also be added on the /data/usr/usr entry to get everything working fine, because none can't hint this automatically and not having it might then confuse the x-systemd.requires= resolution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.