LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   How to detect hot swapped hard disk (in a modular bay). (https://www.linuxquestions.org/questions/linux-hardware-18/how-to-detect-hot-swapped-hard-disk-in-a-modular-bay-218080/)

mrgordonz 08-15-2004 09:18 PM

How to detect hot swapped hard disk (in a modular bay).
 
Hi all,

I am a complete Linux Newbie, so please forgive me if this is a dumb question.

I have a Dell Latitude D600 notebook, with Fedora Core 2 installed. It comes with a CD-RW/DVD+RW drive that can be ejected and replaced with a modular bay containing a second hard disk. I have no problems using either device, as long as I boot with the desired device already in the bay - eg: if I want to burn a CD/DVD, it works fine if I boot with the CD/DVD drive in the bay; similarly, I can mount the second hard disk fine if I boot with it in the bay.

But, I can't work out how to hot swap them, and get Linux to detect the swap without rebooting.

Just now I have booted with the CD/DVD drive in the bay. I now need to access files on the second hard disk, so I have ejected the CD/DVD drive and inserted the 2nd HDD.

When I execute fdisk -l, I get the following:

Quote:

[root@phobbs root]# fdisk -l

Disk /dev/hda: 60.0 GB, 60011642880 bytes
255 heads, 63 sectors/track, 7296 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 15 120456 83 Linux
/dev/hda2 16 4477 35841015 83 Linux
/dev/hda3 4478 7041 20595330 83 Linux
/dev/hda4 7042 7296 2048287+ f W95 Ext'd (LBA)
/dev/hda5 7042 7296 2048256 82 Linux swap
It doesn't detect the other drive. If I boot with the second hard disk already in the bay, I get the following from executing fdisk -l:

Quote:

[root@phobbs root]# fdisk -l

Disk /dev/hda: 60.0 GB, 60011642880 bytes
255 heads, 63 sectors/track, 7296 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 15 120456 83 Linux
/dev/hda2 16 4477 35841015 83 Linux
/dev/hda3 4478 7041 20595330 83 Linux
/dev/hda4 7042 7296 2048287+ f W95 Ext'd (LBA)
/dev/hda5 7042 7296 2048256 82 Linux swap

Disk /dev/hdc: 60.0 GB, 60011642880 bytes
255 heads, 63 sectors/track, 7296 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hdc1 1 7296 58605088+ c W95 FAT32 (LBA)
As you can see it has nicely detected the second disk (/dev/hdc).

After all that preamble, here come the questions:

1. How do I make Linux detect that the device has been swapped? This applies to either device being removed/inserted.

2. Also, is there some command I should execute before ejecting one of the devices?

Thanks,

Paul Hobbs


All times are GMT -5. The time now is 03:10 AM.