When I remove the drive or power down the machine
These are two different issues.
When you "power down" the machine, you must instruct it to do so, and it will cleanly unmount all filesystems as part of the shutdown process...unless by "power down" you mean you just pull the plug, which is a very bad habit and will cause you problems sooner or later.
What options should I have in my fstab to help prevent data corruption
and forced fscks?
If you mean, "I want to just unplug the drive (or the pi) without properly unmounting a filesystem, but I don't want to risk data corruption or have to run fsck," then you are out of luck. Either you properly unmount the filesystem, or you don't. If you don't want data corruption, then you do the former. If you don't care, then do the later, but in that case, the system will notice and will run fsck when you remount.
Maybe you need to clarify in more detail what it is you want to do? There is no option whereby you just pull the usb cable out without doing anything else, but there are ways to communicate other than ssh, or ways to automate sending commands with ssh. For example, create this script and save it on the pi into the home directory of whatever user account you ssh into as "test.sh":
#!/bin/bash
echo "hello world"
Make it executable (chmod +x test.sh
).
Now from somewhere else, try:
ssh me@123.1.2.3 '~/test.sh'
Notice what happens, and that you don't log into a shell. So you can alias that command or put it another short script and instead of the 'test.sh', you execute umount
or whatever you want.
If you want to cleanly shutdown (and dismount) without another computer, one option is to use udev settings regarding some device that you can unplug from the pi, see here.
But if you want a way to cleanly unmount a device by pulling its plug -- not possible. By analogy, this is like saying, "I want the gas to stop flowing when I pull the pump handle out, but I don't want to have to release the trigger". I suppose that could be possible, if we redesigned gas pump nozzles and the hole on the side of your car. USB ports are in the same situation. The system does recognize the device is removed, but at that point it is too late.
fsck
should not take any amount of hours unless the drive actually needs to be repaired. Try umounting it cleanly, then run fsck; notice it will return almost immediately. – goldilocks Feb 16 '13 at 20:29