Running tunefs(8) remotely

farrokhi

Developer
Hi,

I have a special case in which I need to disable softupdates on a server running 8.0-release. Running "tunefs -n disable /" is not possible on a live system, so I need to reboot into single-user mode (which is not possible to be done remotely) or mount filesystem as RO (not possible also, system crashes).
In older versions of fbsd, it was possible to do this using /etc/rc.early script, but its now deprecated.

Any ideas?

-- Babak
 
Doesn't work. putting "/sbin/tunefs -n disable /" in /etc/rc script does not do the job. Machine boots up with softupdates still enabled on / .
 
If this is a one-off kind of thing, then you can just edit /etc/rc.d/root and add the tunefs line right above the if ! mount -uw / line. That will run before / is re-mounted as read-write.

If this is something that you'll want to do more than once, or on more than one system, you should probably write an RC script with BEFORE: root. A skeleton (untested) for this would be:
Code:
#!/bin/sh

# PROVIDE: tunefs
# REQUIRE: fsck
# BEFORE: root

 . /etc/rc.subr

name="tunefs"
start_cmd="tunefs_start"
stop_cmd=":"

tunefs_start()
{
    echo -n "Disabling soft-updates on / filesystem ... "
    tunefs -n disable /
    echo "Done."
}

load_rc_config $name
run_rc_command "$1"

Put it in /etc/rc.d/, make it executable, then run # rcorder /etc/rc.d/* to make sure it is listed as running before /etc/rc.d/root.
 
Back
Top