Click to See Complete Forum and Search --> : HDD as backup--How to swap?


dgermann
08-30-2004, 11:53 PM
Hi--

My first post here!

I am trying to use two removable HDDs as backup devices for my Red Hat 9.0 system. The HDDs are identical Western Digital 200 Gb drives, both set up with identical partitions and directory names.

I have a little script file that reads:
=====
#!/bin/bash
echo "Run this as su"
/sbin/e2label /dev/sda1 /backups2
/sbin/e2label /dev/sda2 /extra
mount -L /backups2
mount -L /extra
df -h
=====

This mounts whichever of the 2 HDDs is connected (via USB2).

I can get it to mount whichever drive I choose if I reboot the machine in between.

:confused::confused: The problem is this: Is there a way to swap the 2 HDDs without having to reboot the machine? (There can be as many as 5 computers connected at any one time, and this could cause a lot of re-logging in, not to mention loss of work they might be be doing.) :confused::confused:

I'd like to be swapping these every day or so for safer backups.

Any suggestions?

x
08-31-2004, 02:38 AM
You could simply unmount them, swap them and run that script again.

dgermann
08-31-2004, 12:07 PM
Senior Grasshopper--

IIRC, I tried that early on, but my memory could be faulty.

Will check and get back to you.

Thanks, Senior Grasshopper.

Icarus
08-31-2004, 12:31 PM
As long as the drive is not in use (and these are truely hot swapable drives) you should be able to cleanly unmount and pull the drive

If you CANT unmount, you'll need to find what is using it.

fuser -uv /mount/point

Then hope the kernel doesn't panic when you pull the drive :p

dgermann
08-31-2004, 08:42 PM
Senior Grasshopper--

Well, whaddaya know! It worked!

Thanks for sending me back to the beginning!

I think I did try it earlier and took its complaining about the first two entries as meaning it did not work.

Since I ran the e2label on the drive when right after I ran fdisk and mkfs, would there be any reason to have to run it later when I swap out the drives?

Icarus--

Truly hot swappable, huh? Does that mean I don't even have to power down before I remove the USB2 cable?

Thanks for the fuser command. That's a new one for me and I suspect it will prove useful!

Icarus
08-31-2004, 09:01 PM
Originally posted by dgermann
Truly hot swappable, huh? Does that mean I don't even have to power down before I remove the USB2 cable?

Thanks for the fuser command. That's a new one for me and I suspect it will prove useful! Doh! I missed the USB mention in the first post...ugg! Ya, you're fine :p

fuser hint: use the -k switch to kill all processes going to that mount point ;)

dgermann
08-31-2004, 09:52 PM
Icarus--

Many thanks!

Say, I commented out the 2 e2label lines in my script. When it runs the script now, I get these error messages:

I/O error: dev 08:01, sector 312464000
I/O error: dev 08:02, sector 78252416

It does seem to mount the drive OK, though.

Not to worry? Or a problem?