Mailinglist Archive: opensuse (3139 mails)
| < Previous | Next > |
Re: [SLE] SATA drive bay and hot swapping
- From: Roger Oberholtzer <roger@xxxxxx>
- Date: Wed, 4 Oct 2006 16:00:25 +0000 (UTC)
- Message-id: <1159977617.28618.43.camel@acme>
On Wed, 2006-10-04 at 12:19 +0200, Jaco Carlson wrote:
> Hi all,
>
> I would like to set up a backup system using an internal drive bay with SATA (Vantec EZ-Swap) on an Intel D945GTP motherboard (BIOS set to AHCI) using a Western Digital 250GB WD2500JS Hard Drive on SuSE 10.1 with updated kernel version 2.6.16.21-0.25-smp.
>
> The problem is how do I configure autofs, udev or whatever to automatically dismount the hard drive when it is pulled out of the drive bay and then automatically mount it when it is inserted again.
>
> I have Googled for this for ever but don't seem to be able to find anything on it that makes any sense.
First, I had to update my kernel to one that supported hot swapping with
the intel chipset. I am using linux-2.6.17.7. I think anything from
linux-2.6.17.4 on will also work. This was in the advice of a libata
maintainer. He also said that the intel chipset may not initialize
properly for hotswap it there is no disk in the bay when the system is
initially powered on.
To see what the system does when the disk is inserted/removed, run:
/usr/sbin/udevmonitor --env
If the kernel is sensing the physical disk activity, you should see
'adding' and 'removing' statements. If not, you need to sort out your
BIOS/kernel. After you see activity here, go to the next stuff.
After udevmonitor shows activity, setting up mounting in udev is not so
difficult. You will need to make a rule, selecting the key strings you
see with udevmonitor. I have 4 swappable SATA disks, and the entries
look like this (your e-mail reader may mess up the lines...):
# These are rules for a system with the SATA set up to look like SCSI.
SUBSYSTEM=="block", BUS=="scsi", KERNEL="sd*1", ID=="0:0:0:0",
SYMLINK="cameraA 0:0:0:0"
SUBSYSTEM=="block", BUS=="scsi", KERNEL="sd*[2-9]", ID=="0:0:0:0",
SYMLINK="cameraA_p%n"
SUBSYSTEM=="block", BUS=="scsi", KERNEL="sd*1", ID=="1:0:0:0",
SYMLINK="cameraB 1:0:0:0"
SUBSYSTEM=="block", BUS=="scsi", KERNEL="sd*[2-9]", ID=="1:0:0:0",
SYMLINK="cameraB_p%n"
SUBSYSTEM=="block", BUS=="scsi", KERNEL="sd*1", ID=="2:0:0:0",
SYMLINK="cameraC 2:0:0:0"
SUBSYSTEM=="block", BUS=="scsi", KERNEL="sd*[2-9]", ID=="2:0:0:0",
SYMLINK="cameraC_p%n"
SUBSYSTEM=="block", BUS=="scsi", KERNEL="sd*1", ID=="3:0:0:0",
SYMLINK="cameraD 3:0:0:0"
SUBSYSTEM=="block", BUS=="scsi", KERNEL="sd*[2-9]", ID=="3:0:0:0",
SYMLINK="cameraD_p%n"
SUBSYSTEM=="block", ACTION=="add", KERNEL=="sd*[0-9]|hd*[0-9]", RUN
+="mount.sh"
I put the above in a file called /etc/udev/rules.d/99-jboc.rules. I make
a symlink to a special name for each partition. In my case, I do care
which swappable disk is in which slot. Each bay is mounted at the same
place, no matter if other disks in other bays come and go (intel power
on requirement considered).
I combine this with rules in /etc/fstab:
/dev/cameraA /media/jboc/cameraA auto
defaults,users,hotplug,ro 0 0
/dev/cameraB /media/jboc/cameraB auto
defaults,users,hotplug,ro 0 0
/dev/cameraC /media/jboc/cameraC auto
defaults,users,hotplug,ro 0 0
/dev/cameraD /media/jboc/cameraD auto
defaults,users,hotplug,ro 0 0
What I cannot get working is the unmounting when the disks are removed.
In my case, they are mounted read-only. But I cannot get a program to
unmount them automatically.
Hope this helps. I also hope someone on the lists spills the beans on
getting automatic unmounting to happen as well.
--
Roger Oberholtzer
OPQ Systems AB
Ramböll Sverige AB
Kapellgränd 7
P.O. Box 4205
SE-102 65 Stockholm, Sweden
Tel: Int +46 8-615 60 20
Fax: Int +46 8-31 42 23
> Hi all,
>
> I would like to set up a backup system using an internal drive bay with SATA (Vantec EZ-Swap) on an Intel D945GTP motherboard (BIOS set to AHCI) using a Western Digital 250GB WD2500JS Hard Drive on SuSE 10.1 with updated kernel version 2.6.16.21-0.25-smp.
>
> The problem is how do I configure autofs, udev or whatever to automatically dismount the hard drive when it is pulled out of the drive bay and then automatically mount it when it is inserted again.
>
> I have Googled for this for ever but don't seem to be able to find anything on it that makes any sense.
First, I had to update my kernel to one that supported hot swapping with
the intel chipset. I am using linux-2.6.17.7. I think anything from
linux-2.6.17.4 on will also work. This was in the advice of a libata
maintainer. He also said that the intel chipset may not initialize
properly for hotswap it there is no disk in the bay when the system is
initially powered on.
To see what the system does when the disk is inserted/removed, run:
/usr/sbin/udevmonitor --env
If the kernel is sensing the physical disk activity, you should see
'adding' and 'removing' statements. If not, you need to sort out your
BIOS/kernel. After you see activity here, go to the next stuff.
After udevmonitor shows activity, setting up mounting in udev is not so
difficult. You will need to make a rule, selecting the key strings you
see with udevmonitor. I have 4 swappable SATA disks, and the entries
look like this (your e-mail reader may mess up the lines...):
# These are rules for a system with the SATA set up to look like SCSI.
SUBSYSTEM=="block", BUS=="scsi", KERNEL="sd*1", ID=="0:0:0:0",
SYMLINK="cameraA 0:0:0:0"
SUBSYSTEM=="block", BUS=="scsi", KERNEL="sd*[2-9]", ID=="0:0:0:0",
SYMLINK="cameraA_p%n"
SUBSYSTEM=="block", BUS=="scsi", KERNEL="sd*1", ID=="1:0:0:0",
SYMLINK="cameraB 1:0:0:0"
SUBSYSTEM=="block", BUS=="scsi", KERNEL="sd*[2-9]", ID=="1:0:0:0",
SYMLINK="cameraB_p%n"
SUBSYSTEM=="block", BUS=="scsi", KERNEL="sd*1", ID=="2:0:0:0",
SYMLINK="cameraC 2:0:0:0"
SUBSYSTEM=="block", BUS=="scsi", KERNEL="sd*[2-9]", ID=="2:0:0:0",
SYMLINK="cameraC_p%n"
SUBSYSTEM=="block", BUS=="scsi", KERNEL="sd*1", ID=="3:0:0:0",
SYMLINK="cameraD 3:0:0:0"
SUBSYSTEM=="block", BUS=="scsi", KERNEL="sd*[2-9]", ID=="3:0:0:0",
SYMLINK="cameraD_p%n"
SUBSYSTEM=="block", ACTION=="add", KERNEL=="sd*[0-9]|hd*[0-9]", RUN
+="mount.sh"
I put the above in a file called /etc/udev/rules.d/99-jboc.rules. I make
a symlink to a special name for each partition. In my case, I do care
which swappable disk is in which slot. Each bay is mounted at the same
place, no matter if other disks in other bays come and go (intel power
on requirement considered).
I combine this with rules in /etc/fstab:
/dev/cameraA /media/jboc/cameraA auto
defaults,users,hotplug,ro 0 0
/dev/cameraB /media/jboc/cameraB auto
defaults,users,hotplug,ro 0 0
/dev/cameraC /media/jboc/cameraC auto
defaults,users,hotplug,ro 0 0
/dev/cameraD /media/jboc/cameraD auto
defaults,users,hotplug,ro 0 0
What I cannot get working is the unmounting when the disks are removed.
In my case, they are mounted read-only. But I cannot get a program to
unmount them automatically.
Hope this helps. I also hope someone on the lists spills the beans on
getting automatic unmounting to happen as well.
--
Roger Oberholtzer
OPQ Systems AB
Ramböll Sverige AB
Kapellgränd 7
P.O. Box 4205
SE-102 65 Stockholm, Sweden
Tel: Int +46 8-615 60 20
Fax: Int +46 8-31 42 23
| < Previous | Next > |