Automatically recreate partition if corrupt

I'm mosting likely to be installing Ubuntu on an ingrained tool. I'm making use of a mix of aufs and also a read just root to make certain that my root fs does not get corrupt. Nonetheless, I intend to have the ability to store logs, so I'm making an unique rw dividing for /var/log. The tool is mosting likely to undertake thousands of power failing occasions.

On the occasion that the dividing obtains damaged as a result of power failing, I desire the system to function effectively anyhow. I would certainly such as the dividing to instantly get reformatted in instance of corruption. Exists a very easy means to configure this?

2022-06-07 14:32:31
Source Share
Answers: 2

Just make use of a filesystem that does not get damaged from power failings, like ext3 or 4.

2022-06-07 14:54:26

Run fsck with a set of alternatives that define no customer communication. Examine its return value to see whether it can fix the filesystem: the return value will certainly be 0 if there were no mistakes, 1 if there were correctable mistakes, and also a bigger value if something negative took place. As an example, with ext [234 ], run e2fsck -p.

e2fsck -p /dev/disk/by-label/logs
if [ $? -ge 1 ]; then
  mke2fs -L logs /dev/disk/by-label/logs

If your running setting allows it, take into consideration logging via the network rather (you require IP connection). Also Busybox can do it:

syslogd -R logserver

On the log web server, pay attention on UDP port 514. You can simply unload every little thing that can be found in to a documents, or you can add beginning and also day stamps on each line, or you can run syslog in your area.

2022-06-07 14:52:30