Hot swapping cd-roms w/ hdparm -R/-U
I was feeling bored and vaguely insane today, so I thought I would try hotswapping my cdrom drives as a challenge really.
I have two ide channels: ide0: hda (main harddrive) ide1: hdc && hdd (cdroms) First I did: Code:
#hdparm -Y /dev/hdc /dev/hdd Then I ran: Code:
# hdparm -U 1 /dev/hdc Code:
/dev/hda: Code:
# hdparm -R 0x170 0x376 15 /dev/hdc Code:
# hdparm -R 0x170 0x376 15 /dev/hda Code:
/dev/hda: Code:
ide1: I/O resource 0x376-0x376 not free. Code:
# hdparm -U 1 /dev/hda Any ideas? (I'm happy to try most things, however insane) I will reboot soonish and try it again, see if i can get more logging out of the kernel to see what is going on. (Yes I know this is unsupported, blah blah.. dangerous, blah blah.. ) |
I've just worked it out! To unregister run
Code:
#hdparm -U 1 /dev/hda Code:
#hdparm -R 0x170 0x376 15 /dev/hda Code:
Probing IDE interface ide0... Code:
ide1 at 0x170-0x177,0x376 on irq 15 I would not reccomend trying this with harddrives unless you are sure that the harddrive is not spinning and the heads are parked before you pull the power; I think hdparm -Y should do that, but I'm really not sure. Don't even think about trying to hot-swap your root drive ;). Hope that helps someone, or at least someone finds it interesting. |
I have just written a (very simplistic) script to make this process easier. I'll share it here just in case anyone ever wants it:
Code:
#!/bin/zsh I should just mention that this is considered dangerous to hardware etc. I would personally recommend you only use it on cdrom drives, and use common sense when messing around inside a powered on computer. I hold no responsibility blah blah if it wipes your harddrive/causes a nuclear disaster (Those bugs in the kernel where fixed last year :P) Enjoy! [Note: a mod may want to move this to the success stories forum if you think it's appropriate] |
All times are GMT -5. The time now is 08:20 PM. |