[gpfsug-discuss] wait for mount during gpfs startup

Jonathan Buzzard jonathan.buzzard at strath.ac.uk
Tue Apr 28 12:38:01 BST 2020


On 28/04/2020 11:57, Ulrich Sibiller wrote:
> Hi,
> 
> when the gpfs systemd service returns from startup the filesystems are 
> usually not mounted. So having another service depending on gpfs is not 
> feasible if you require the filesystem(s).
> 
> Therefore we have added a script to the systemd gpfs service that waits 
> for all local gpfs filesystems being mounted. We have added that script 
> via ExecStartPost:
> 

Yuck, and double yuck. There are many things you can say about systemd 
(and I have a choice few) but one of them is that it makes this sort of 
hackery obsolete. At least that is one of it goals.

A systemd way to do it would be via one or more helper units. So lets 
assume your GPFS file system is mounted on /gpfs, then create a file 
called ismounted.txt on it and then create a unit called say 
gpfs_mounted.target that looks like


# gpfs_mounted.target
[Unit]
TimeoutStartSec=infinity
ConditionPathExists=/gpfs/ismounted.txt
ExecStart=/usr/bin/sleep 10
RemainAfterExit=yes

Then the main unit gets

Wants=gpfs_mounted.target
After=gpfs_mounted.target

If you are using scripts in systemd you are almost certainly doing it 
wrong :-)

JAB.

-- 
Jonathan A. Buzzard                         Tel: +44141-5483420
HPC System Administrator, ARCHIE-WeSt.
University of Strathclyde, John Anderson Building, Glasgow. G4 0NG



More information about the gpfsug-discuss mailing list