Is entropy maximum in equilibrium? Usually, in the context of non-equilibrium thermodynamics, it is said that entropy achieves a maximum in equilibrium, so the Taylor series expansion of entropy around the equilibrium state as a function of fluctuations $\xi_i$ of internal extensive variables does not have degree 1 (linear) terms, just the contributions of the Hessian matrix (which is symmetric negative definite).
\begin{align*}
S\left(\boldsymbol{\xi}\right) &\approx S\left(\mathbf{0}\right) + \boldsymbol{\xi}^{\top} \nabla S\left(\mathbf{0}\right) + \frac{1}{2 \, !} \boldsymbol{\xi}^{\top} \mathbf{H} \left(S\left(\mathbf{0}\right)\right) \boldsymbol{\xi} \\
&= S_0 + \frac{1}{2} \boldsymbol{\xi}^{\top} \mathbf{H} \left(S\left(\mathbf{0}\right)\right) \boldsymbol{\xi} 
\end{align*}
This is necessary to derive Onsager relations. But isn't there a flaw in this reasoning applied to open and closed systems? The entropy of the system should achieve max value in equilibrium only in isolated systems, shouldn't it?
 A: Different extremum principles are required depending on what is held constant at the boundaries of the system (temperature or energy). Systems held at constant temperature do not tend toward states of maximum entropy but rather states of minimum free energy. If we fix extensive properties at the boundaries of the system such as heat, work, or energy then the system will tend toward max entropy. However if we fix intensive variables like temperature, then conversely the extensive variables like energy or number of particles are not controlled. In that case the surrounding heat bath or external system can exchange particles or energy with our system. In the case of fixed T, heat can go back and forth between reservoir and system. The Gibbs free energy (i.e. free energy in the case of a constant temperature, pressure, and particle number like you closed but non-isolated system) $G = H - TS$ is a balance of enthalpic and entropic contributions. At its minimum, the system need not be at a state of maximum entropy because of the contribution of internal energy that can compensate for it. The role of the entropic contribution is determined by the temperature - dominating at high temperatures.
my reference: Molecular Driving Forces by Dill and Bromberg, chapter 8.
A: The answer to the question at the end is yes: system entropy is maximised in equilibrium only for an isolated system. Therefore the reasoning as given only applies to isolated systems.
For a non-isolated system we can in many cases model the situation as a system in contact with a reservoir of some kind, and then treat the combination (system + reservoir) as isolated. This leads to a quantity called free energy which is minimised in equilibrium. The type of argument studied in the question can then be applied to the free energy rather than the entropy.
