I'm running EC2 EBS images on instances with instance stores on /xvdb and /xvdc. I have managed to create a script to raid these two drives on first boot and mount them as /mnt. I am doing this as a OneTime service after systemd-remount-fs.service (I have no idea if that is the appropriate time).

What I really want to do is raid them, copy over the EBS's /var, and then mount them as /var before continuing booting for real. I'm assuming that I'll need to do this in the ram disk image during early boot. I'm quite out of touch with systemd and boot order - I last got dirty with building ram disks in 2009. What is the "proper" way to integrate a script that runs during the first boot and does the necessary setup?


There is likely to be a lot of problems with this. /var contains log files. For any daemon started earlier that opens it's log file once and then keeps writing to it (which is what most daemons that have their own log file do, including syslogd), they will keep writing to the original file even after you make a copy and mount over /var. The same thing goes for sockets (e.g. /var/run/syslog), any previously started daemons will be listening on these (and they will present a unique problem for copying). And there may be other things I haven't mentioned.

What that all amounts to is that you really need to do the mount before anything that touches /var is started.

  • OK. When does /var get mounted in dracut and can I beat the system to it? – jamie Aug 1 '16 at 22:31

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.