SATA (hot) swapping for backup
Daniel Pittman
daniel at rimspace.net
Fri Aug 4 12:02:08 UTC 2006
David Abrahams <dave at boost-consulting.com> writes:
> Daniel Pittman <daniel at rimspace.net> writes:
>> David Abrahams <dave at boost-consulting.com> writes:
>>
>>> I recently bought a pair of SATA drives on which to do weekly backups
>>> of my server. I also got a cool drive tray that allows me to pop the
>>> disks in and out of the machine easily:
>>> http://www.cooldrives.com/sata-serial-ata-mobile-rack-enclosure-lcd.html
>>> You can remove the drive from the machine by turning a key -- which
>>> powers it down -- and pulling on the handle.
>>>
>>> My problems:
>>>
>>> 1. If I boot the server with no drive in the bay or with the drive
>>> power off, it is never detected, even after powering it on. Is
>>> there a way to get that to work?
[...]
>> Sadly, none of that seems completely clear about what kernel release is
>> required for the various hot-plug and warm-plug options to work. You
>> may be forced to resort to asking the linux-kernel mailing list if
>> someone else here can't chime in.
>
> Also, none of that is clear about what, exactly, constitutes "support
> for hot-swap" (which is connected with my next question).
Well, one key point is your issue above: while the hardware (probably)
issues an interrupt when the new hardware is connected, Linux ignores
that rather than detecting the device.
That would be one part of hot-swap - the hot-add case.
>>> 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.
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.
Also, if you don't stop the drive spinning before you pull it then you
have cut power to a disk in rotation. 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.
>>> 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.
>
> 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.
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.
Regards,
Daniel
--
Digital Infrastructure Solutions -- making IT simple, stable and secure
Phone: 0401 155 707 email: contact at digital-infrastructure.com.au
http://digital-infrastructure.com.au/
More information about the ubuntu-server
mailing list