SATA (hot) swapping for backup
dave at boost-consulting.com
Fri Aug 4 12:50:58 UTC 2006
Thank you *very* much for your patient and complete answers. I have a
lot to learn and I really appreciate it when someone is willing to
take the time to educate me...
Daniel Pittman <daniel at rimspace.net> writes:
> David Abrahams <dave at boost-consulting.com> writes:
>> Daniel Pittman <daniel at rimspace.net> writes:
>>> David Abrahams <dave at boost-consulting.com> writes:
>>>> 2. I'm not 100% sure that unmounting the drive, powering it off,
>>>> removing it, and putting a new disk in its place is legit. Can
>>>> anyone confirm? My motherboard *does* claim to support SATA
>>>> hotswap, but I'm not sure if Linux supports it.
>>> Linux probably doesn't, save in the most recent kernels, and possibly
>>> only with appropriate patches.
>> In my case I'm wondering what could possibly go wrong? If the drive
>> is completely unmounted before it is powered down and removed, it
>> seems as though the OS has no reason to be concerned with how/when I
>> plug it in. Any ideas?
> Well, the worst case is that the hardware can short and fry the entire
> controller chip, resulting in a dead hard disk, motherboard and
> potentially other components.
> That is a pretty bad worst case, but not unknown, for pulling hardware
> at random.
And seems rather unlikely considering that the motherboard supports
SATA hotswap. If I put Windoze on that machine I'd be able to do it.
It would be a pretty perverse hardware implementation that would allow
you to plug and unplug drives only if the OS were cooperative.
> A much more likely fault is that your controller will get to
> exercise those wonderful, poorly tested, error handling paths as it
> suddenly discovers a missing device.
> That can lead to anything from the controller hanging to a panic when
> the error handler turns out to have a bug. Not nice.
You're suggesting that the hardware/firmware hotswap handling *itself*
(I take it that's what you mean by "the controller") is buggy?
> Also, if you don't stop the drive spinning before you pull it then you
> have cut power to a disk in rotation.
Huh. I guess unmounting the drive isn't enough to stop the spindle.
> That necessitates an emergency stop of the heads, which isn't great
> for their life.
> Now, it /might/ just work, and if you have hot-swap hardware then the
> power issues resulting in physical damage are unlikely. It isn't nice,
> and will result in the hardware and the OS believing that a serious
> error has just happened.
I've already done it once or twice and didn't notice *any* interesting
side-effects. But maybe I wasn't looking in the right place.
>>>> Lastly, if there's any standard way to automate backup jobs (mounting
>>>> disks, rsync or whatever, unmounting, etc.) I'd appreciate a
>>>> reference. I can always use cron scripts but I imagine someone has
>>>> probably come up with something better.
>>> udev can fire off arbitrary code on insertion of a device. You can use
>>> that to trigger a script that will, basically, do all the work for you.
Are there "standard" scripts for this purpose, or will I be whipping
one up at home?
>> Is that really what "support for SATA hot-swap" amounts to?
> No. That is the very last bit. Hot-swap is the bit where the OS,
> driver, controller and everything else is *aware* that changes are going
> to happen, so they can handle them gracefully.
> udev (and hald, and a bunch of other code written on top of those) are
> the icing of the cake: when hot-plug works it can react to it sensibly
> and do things like configure your new network card, mount your hard
> disk, or whatever.
> Hot-swap, as such, is all the bits below that which conspire to make it
> work. On a bus like USB this is well tested, while SATA ... isn't.
Huh, too bad.
Well I did also buy an external hotswapping USB enclosure that I can
use, but I was really hoping to get the full speed of SATA for my
backups. I guess I just have to weigh that loss against the time it
would take to research SATA kernel support and configure/build a new
> Sorry if that wasn't clear to you -- the driver, OS and controller
> hardware need to be hot-swap capable for this to have a chance of
> working even remotely reliably.
Sounds like I've one out of three at the moment. Probably falling back
to USB is my best bet in the near term. I need to get the system
going and a backup system in place -- that's far more important than
having the backups be super fast.
More information about the ubuntu-server