It is a standard result in statistical mechanics that when two interacting systems are free to exchange energy and volume, then in the macrostate of maximum entropy the systems will have equal temperature and pressure. The second law of thermodynamics then suggests that in thermal and mechanical equilibrium, such interacting systems will always equilibrate so as to have equal temperature and pressure.
But consider two ideal gases separated by a partition, in perfect thermal contact but with different initial pressures. If the partition is suddenly allowed to move, then thinking of pressure in terms of force per unit area (and using the ideal gas law) we can exactly solve for the motion of the partition. Assuming there is some damping force present, it is certainly true that the system will eventually settle down to the state where the pressure on either side of the partition is equal, but the reason for this equilibrium seems to me to be purely mechanical, and completely unrelated to entropy increase and the second law of thermodynamics. In fact, it seems false to assume some sort of ergodic hypothesis for volume microstates here (which underlies the assumption that mechanical equilibrium occurs at a volume macrostate of maximal entropy), as it is certainly not the case that every volume microstate is equally likely at a given moment in time (thanks to our exact solution for the volume as a function of time).
So basically, I'm confused why mechanical equilibrium should have anything to do with entropy, given that the volume exchange process can, at least for simple examples, be completely understood using Newton's Laws. How do we reconcile these two viewpoints?