OpenBSD : Read only Compact Flash installation

Here are a couple of pointers to perform an installation of OpenBSD on a media which will be read-only most of the times. I hope I didn’t forget anything otherwise I’ll be in trouble next time I reinstall… 🙂
 

fstab

$ cat /etc/fstab                                                               
/dev/wd0a / ffs ro,noatime,softdep 1 1
/dev/wd0d /mfs_backup ffs ro,nosuid,noatime,softdep 1 2
swap /dev mfs rw,nosuid,-P=/mfs_backup/dev,-i=128 0 0
swap /var mfs rw,nodev,nosuid,-P=/mfs_backup/var 0 0
swap /home mfs rw,nodev,nosuid,-P=/mfs_backup/home 0 0
swap /root mfs rw,nodev,nosuid,-P=/mfs_backup/root 0 0
swap /tmp mfs rw,nodev,nosuid 0 0
/dev/wd0f /files ffs rw,nodev,nosuid,noatime,softdep 1 2
/dev/wd0e /usr ffs ro,nodev,noatime,softdep 1 2
$

Sync script back MFS to CF

$ cat /bin/mfs-sync.sh                                                         
#! /bin/sh
 
RSYNC=/usr/local/bin/rsync
 
mount -o update,rw /mfs_backup
 
for i in var root home
do
        echo "Sync'ing " ${i}
        ${RSYNC} -a --delete /${i}/ /mfs_backup/${i}/
done
 
mount -o update,ro /mfs_backup
$

add this into /etc/rc.shutdown

[...]
# Add your local shutdown actions here.
 
echo "Sync'ing mfs to disk"
/bin/mfs-sync.sh
 
echo '.'

and into the root crontab :

[...]
# do daily/weekly/monthly maintenance
00      1       *       *       *       /bin/sh /bin/mfs-sync.sh
[...]

Well, I guess that’s about it !
 
 

Leave a Reply

Your email address will not be published. Required fields are marked *