Tag Info

Hot answers tagged

23

Naturally, you need to unmount any filesystems on the disk, and it'd be a good idea to deactivate any LVM groups (vgchange -an), and generally make sure nothing is using the disk for anything. Once you've done that, it should be safe to unplug. If you want to be extra cautious, do echo 1 > /sys/block/(whatever)/device/delete first. That'll unregister ...


6

I think you're looking for pmount. If you want automatic mounting upon insertion, see Automounting USB sticks on Debian. The program that reacts when a new device appears is udev, so automatic mounted is triggered by a udev rule. The usbmount package provides udev rules to automatically mount USB storage devices and a few others. You cannot automatically ...


6

That's just the way that the PS/2 port works. Unlike the USB, the PS/2 was not designed to be hot-plugged. If you need the hot-plugging capability, use a USB mouse. Otherwise, there is no guarantee that any solution will work consistently.


5

This is handed by udev on modern Linux systems. The udev daemon started with the system will search in /etc/udev/rules.d and /lib/udev/rules.d and will run matching rules for kernel events. Inserting a USB drive will trigger an event, udev will search for a matching rule and will execute it. The rules themselves will determine what your system does. In ...


4

You can use udev rules. For this, you'll need to find the device attributes that distinguish your USB headset once it is plugged in. This can be usually done in two steps: Run udevadm monitor --udev befor plugging the device. Then plug it in. There will be a bunch of output lines - just pick one and copy the device path from it - it is something like ...


3

Those two sections are for different things. The first is for unplugging. The second is for plugging. For unplugging, the OS will sync the data during the unmount operation. Thus, if the disk is unmounted (assuming you in fact do have full hardware support) you can power off the disk then unplug it without risk of data loss or corruption. For plugging, ...


3

Yes, you can find the information in /sys/block/$DEVICE/slaves. If you only have the canonical name you can use readlink to get the details, e.g: devdm="$(readlink -f /dev/mapper/extern-1-crypt)" dm="${devdm#/dev/}" ls /sys/block/$dm/slaves/ If you want to remove all you can just utilize directly the sys filesystem: echo 1 > ...


3

There is anecdotal evidence that restarting the X Server or switching to a a different virtual terminal and back will cause PS/2 devices to be re-detected. I don't have a PS/2 device to test with at the moment though but it may just work.


3

Assuming your hardware allows for hotplugging hard drives, I'm fairly sure any modern linux distro should instantly spot the added drive and create device numbers to access it, generally via udev.


2

I'm not completely confident with this yet, so take it with a grain of salt and more research. It starts with the kernel hotplug subsystem. After a device is setup, it either calls whatever userspace program is setup to handle hotplug events (if one was set by echo hotplug_handler > /proc/sys/kernel/hotplug) or sends a data packet over the kobject_uevent ...


2

There is a lot of possibilities: :> # 1 :> pvscan :> # 2 :> vgscan -v extern-1 :> # 3 :> dmsetup table /dev/mapper/extern-1-crypt :> # 4 :> cd /sys/devices/virtual/block/ :> for dmdev in dm-*; do :> if [ xyz = $(< "${dmdev}/dm/name") ]; then :> ls -l "${dmsev}/slaves/" :> fi :> done Or take the "dm-" ...


2

Proper SAS/SATA connectors are hot plug safe, so as long as you are using those connectors both for data and power ( not the usual PC molex power connector ) then you won't hurt anything plugging them in.


2

Ok, it's been a long time, but I'll still answer my question with the best option I found as of now. The best way is to create a udev rule, associated with some scripts (that will create / remove directories and mount / unmount removable devices), and attached to partition udev device event type. 1 - Creating add / remove scripts Add this script ...


1

From the kernel documentation: The hotplug mechanism asynchronously notifies userspace when hardware is inserted, removed, or undergoes a similar significant state change. There is an event variable for modules, called DRIVER, that suggests a driver for handling the hotplugged device.


1

Unload your USB HCI kernel modules (anything *hci_hcd and *usb*) and reload them. This is the only reliable way to actually cut the power to the USB ports. There are other less severe method to achieve the same thing, but they are not guaranteed to work depending on how your device fails.


1

what about eject /dev/sdX? On my setup, this commands umounts, syncs and powers down the drive.


1

The answer from Iain Dawson covers the userland part. In the kernel proper the handling of hotplug is integrated all over the place. Some infrastructure is present in the base kernel, but hotplugging has to be handled in each device driver, so there is no set of modules responsible for this.


1

You probably want to look into udev. There's a similar question on Ask Ubuntu.


1

I found a way in doing this by editing /etc/fstab file. A simple entry looks like: /dev/sdb1 /media/robot/hdd1 ntfs defaults 0 0 <file system> <mount point> <type> <options> <dump> <pass>


1

It sounds like your VM has been configured to provide a single virtual cpu. The following documentation might help you in reconfiguring your VM to provide multiple cores: https://www.virtualbox.org/manual/ch03.html#settings-processor This may help, I had a similar issue with an Ubuntu VM. This help me with my original question


1

As Caleb mentioned, PulseAudio lets you migrate streams from one device to another. To switch automatically, rather than manually through pavucontrol, add the module-switch-on-connect module to your PulseAudio configuration as described here: http://askubuntu.com/questions/158241/automatically-change-sound-input-output-device/158250#158250


1

If you don't have it yet, pulseaudio will give you this kind of flexibility in a really easy to use routing console called pavucontrol. The preferred and fallback devices can be set per application and system defaults.


1

For Ubuntu-Debian you can use Partprobe (http://www.cyberciti.biz/tips/re-read-the-partition-table-without-rebooting-linux-system.html) but if you want to detected all LUN's (also RAID Software) I prefer scsitools package (command: sudo rescan-scsi-bus).


1

For hard disk partitions (e.g. after modifying partition tables), have a look at the partprobe command.


1

In general, with modern hardware, a modern kernel, and a modern distribution, hardware recognition should happen automatically. There is, however, a program called "kudzu" which will do what you want — attempt to detect new hardware, and add the appropriate configuration. I think, because of the changes in modern systems, it's not really maintained anymore ...



Only top voted, non community-wiki answers of a minimum length are eligible