Skip to content

Instantly share code, notes, and snippets.

@bdrewery bdrewery/tunefs
Created Feb 14, 2012

Embed
What would you like to do?
FreeBSD rc.d/tunefs - Set mount flags remotely
#!/bin/sh
#
# $FreeBSD: src/etc/rc.d/tunefs,v 1.0 09/22/2010 19:54:28 bdrewery Exp $
#
# PROVIDE: tunefs
# REQUIRE: fsck
# BEFORE: root
# KEYWORD: nojail
. /etc/rc.subr
name="tunefs"
start_cmd="tunefs_start"
stop_cmd=":"
tunefs_start()
{
mount /tmp
if [ -f /tmp/.tunefs ]; then
rm -f /tmp/.tunefs
umount /tmp
echo -n "Tuning devices ..."
mount -t ufs -p | while read dev path type mode freq pass; do
# multilabel
tunefs -l enable $path
# soft-updates
tunefs -n enable $path
# Only on 9+
# soft-update journaling
#tunefs -j enable $path
# ACL
tunefs -a enable $path
done
# For some reason, the above doesn't actually work, but the following will:
tunefs -l enable /
tunefs -n enable /
tunefs -a enable /
tunefs -l enable /usr
tunefs -n enable /usr
tunefs -a enable /usr
tunefs -l enable /var
tunefs -n enable /var
tunefs -a enable /var
echo "Done."
reboot
echo "REBOOT FAILED - PLEASE REBOOT ME"
stop_boot
fi
umount /tmp
}
load_rc_config $name
run_rc_command "$1"
@bdrewery

This comment has been minimized.

Copy link
Owner Author

commented Feb 14, 2012

Install to /etc/rc.d/
chmod 700 /etc/rc.d/tunefs

To activate:

touch /tmp/.tunefs
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.