Dec. 4, 2007, 3:37 a.m.
posted by void
Hotswap Your Laptop's Optical Drive
If you've got a laptop with a removable optical drive, you can use the hotswap utility to remove and reinstall it without rebooting. If you've purchased a laptop within the last couple of years, your machine most likely has an optical drive that's in a removable caddy or drive bay. Typically, these type of drives are enabled under Windows to be removed and replugged with the system power on, but the drivers that allow this haven't been available in Linux until recently. The hotswap package included in the universe repository [Hack #60] provides the ability for you to hotswap an optical drive out and insert a battery or other module, and then reinsert the optical drive back into the bay, all without putting the laptop to sleep or shutting it down. To install hotswap, first you must have the universe repository enabled in your /etc/apt/sources.list; then you can install hotswap by using the following command: gooley@falcon:~$ sudo apt-get install hotswap
apt-get, as usual, will take care of all the dependencies and install all the software. Once apt's completed the download and installation of the software, you can institute a hotswap by running hotswap via sudo. hotswap will autodetect your optical drive and ask you if you wish to remove it. Simply follow the prompts and do what the script says: gooley@falcon:~$ sudo hotswap Password: I/O warning : failed to load external entity "/etc/hotswaprc" hotswap 0.4.0 Copyright 2001 Tim Stadelmann This program is free software, licensed under the conditions of the GNU General Public License version 2, or (at your option), any later version. The following IDE device is currently configured: HL-DT-STCD-RW/DVD DRIVE GCC-4242N Do you want to remove this device? y You can now remove the device from the module bay. Would you like to insert an IDE device into the module bay? n Aborting At this point, you can eject and remove the optical drive. To reinsert the drive, simply run hotswap via sudo again (occasionally, hotswap will report an error, as shown here, but it will actually register the drive with the IDE subsystem): gooley@falcon:~$ sudo hotswap I/O warning : failed to load external entity "/etc/hotswaprc" hotswap 0.4.0 Copyright 2001 Tim Stadelmann This program is free software, licensed under the conditions of the GNU General Public License version 2, or (at your option), any later version. There is currently no IDE device configured. (Floppy disk drives, batteries, and 'travel modules' are not managed by this utility. If you want to swap such a module, you should remove it now.) Would you like to insert an IDE device into the module bay? y Please insert the new device into the module bay and press RETURN. No IDE device has been found in the module bay. If you are sure that the device you want to configure connects to the IDE bus, make sure that the module is inserted completely. Do you want to try again? n Aborting A quick check of dmesg will confirm that the drive did indeed get re-registered with the system: gooley@falcon:~$ dmesg | tail [4296527.332000] Probing IDE interface ide1... [4296527.698000] hdc: HL-DT-STCD-RW/DVD DRIVE GCC-4242N, ATAPI CD/DVD-ROM drive [4296528.004000] ide1 at 0x170-0x177,0x376 on irq 15 [4296528.008000] hdc: ATAPI 24X DVD-ROM CD-R/RW drive, 2048kB Cache
Hotswapping is one more capability Linux has recently gained on laptops and portable machines. Now you can enjoy another ability that's been a Windows-only feature! |
- Comment
