You are not logged in.

#1 2016-01-15 20:37:35

apterix
Member
Registered: 2015-06-28
Posts: 4

systemd + nfs + separated /var using nfs

Hey folks smile

I have one diskless system that boot a lot of machines in one server. These machines share same / mounted via NFS (read-only).

Because I use same guest user for all of them to login, I need to separete /home/ and /var  (and mount both via nfs) to everything work in graphical mode.

I am running two units before systemd fs local service (what reads fstab and generate the units) to mount /home  and /var. The /home work as a charm, but I get a lot of problems mounting /var via nfs.

For mose reason some services (like rpcbind) start writing in /var/run/ before the systemd fs local service. And systemd do some magic if you remount /var/ in other device (like ssd, for example).

When I boot one machine, rpcbind start write things in /var/ (of nfs because / is on nfs) and when my script mount /var/ in correct path (/tftpboot/xxx.xxx.xxx.xxx/var), rpcbind and other services lost their locks services and get in trouble.

For me is very starnge any service start writing before fstab was read, but this is hapenning and I have to accept.

My question is which is the correct way to mount my own /var in NFS without broke services.

- Why I can not use fstab?

Because I use /tftpboot/IPOFMACHINE/var, so I need to know the IP and then mount my var

- How is my fstab?

I mount /var/run, /var/lock and /var/tmp in memory. I tried mount /var in memory, but a lot of services (kde, rpcbind etc) need a minimal structure of paths to write.

- What you tried more?

Created a systemd unit to create /var and put it as a dependecy of systemd fs local service and it not worked. I tried put in fstab manually the vars (only to test) and not worked too. I tried too to put manually and write dependence systemd rules in fstab, but without success again.

It seems systemd do some magic to remount devices with /var to not miss what is happened before. I have to see the systemd code to verify.

Anyone has any idea how to mount /var via nfs before or using fstab or systemd fs local units without broke the boot process and linux services?
Remember that I need to do some greps to discover my IP to know my correct mount point for each machine on the fly (example: machine 192.168.0.22 will mount nfsipserver:/tftpboot/192.168.0.22/var in /var).

Thank you.

Offline

Board footer

Powered by FluxBB