[Preciso de ajuda] Reconectar dispositivo USB ejetado sem removê-lo manualmente - pelo terminal

Salve pessoal!

É o seguinte, eu tenho um HD Externo e tava querendo usar uma função aqui no linux (pelo terminal de preferência) que é muito simples no Windows, como podem ter visto no titulo é plugar ou desplugar o meu HD Externo sem precisar fazer isso manualmente ( Tirar do USB e conectar novamente).

No Windows o processo é feito pelas configurações mesmo, pois não achei também como fazer isso via CMD/Poweshell. O processo é feito da seguinte forma:

  1. Gerenciador de Dispositivos
  2. Controladores Universal Serial Bus
  3. O dispositivo de armazenamento em massa USB encontra um com amarelo (!)
  4. Desativar dispositivo , [ Sim ] para desativar
  5. Ative o dispositivo , [ Não ] para reiniciar
  6. Desativar o dispositivo pela segunda vez: D [ Sim ] para desativar, [ Não ] para reiniciar
  7. Ativar dispositivo
    Pronto, dispositivo reconectado! sem a necessidade de reconectar manualmente o dispositivo.

Pois bem, no linux já é um pouco diferente…
Eu uso atualmente o Opensuse KDE, existe as opções Montar, Desmontar e Remover com segurança. O x da questão aqui é exatamente esse remover com segurança.

Dando um:

lsusb

obtemos o seguinte retorno:

Acontece agora que quando eu clico em remover com segurança

Annonymous@localhost:~> lsusb
Bus 002 Device 005: ID 1a2c:2124 China Resource Semico Co., Ltd Keyboard
Bus 002 Device 004: ID 0000:3825   USB OPTICAL MOUSE
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0cf3:3004 Qualcomm Atheros Communications AR3012 Bluetooth 4.0
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

O dispositivo some, e não é mais possível vê-lo, nem no Dolphin e nem no Disco e dispositivos, Alias nem gerenciadores de discos o reconhecem mais como /dev/sdb, conforme imagem a seguir:

Agora quando eu dou o comando:

dmesg | tail

retorna o seguinte:

e outro mais detalhado retorna isso:

Annonymous@localhost:~> dmesg | grep usb
[    2.955687] usbcore: registered new interface driver usbfs
[    2.955705] usbcore: registered new interface driver hub
[    2.955725] usbcore: registered new device driver usb
[    2.996086] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.14
[    2.996092] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.996095] usb usb1: Product: EHCI Host Controller
[    2.996097] usb usb1: Manufacturer: Linux 5.14.5-1-default ehci_hcd
[    2.996099] usb usb1: SerialNumber: 0000:00:1a.0
[    3.016424] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.14
[    3.016431] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    3.016434] usb usb2: Product: EHCI Host Controller
[    3.016436] usb usb2: Manufacturer: Linux 5.14.5-1-default ehci_hcd
[    3.016439] usb usb2: SerialNumber: 0000:00:1d.0
[    3.255984] usb 1-1: new high-speed USB device number 2 using ehci-pci
[    3.275979] usb 2-1: new high-speed USB device number 2 using ehci-pci
[    3.412454] usb 1-1: New USB device found, idVendor=8087, idProduct=0024, bcdDevice= 0.00
[    3.412465] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    3.432449] usb 2-1: New USB device found, idVendor=8087, idProduct=0024, bcdDevice= 0.00
[    3.432460] usb 2-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    3.700010] usb 1-1.3: new full-speed USB device number 3 using ehci-pci
[    3.720026] usb 2-1.1: new high-speed USB device number 3 using ehci-pci
[    3.818352] usb 1-1.3: New USB device found, idVendor=0cf3, idProduct=3004, bcdDevice= 0.02
[    3.818363] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    3.818366] usb 1-1.3: Product: Bluetooth USB Host Controller
[    3.818369] usb 1-1.3: Manufacturer: Atheros Communications
[    3.818371] usb 1-1.3: SerialNumber: Alaska Day 2006
[    3.837587] usb 2-1.1: New USB device found, idVendor=14cd, idProduct=6116, bcdDevice= 2.20
[    3.837598] usb 2-1.1: New USB device strings: Mfr=1, Product=3, SerialNumber=2
[    3.837601] usb 2-1.1: Product: USB Mass Storage Device
[    3.837604] usb 2-1.1: Manufacturer: Generic     
[    3.837606] usb 2-1.1: SerialNumber: 116AC2101219
[    3.855200] usb-storage 2-1.1:1.0: USB Mass Storage device detected
[    3.855448] scsi host6: usb-storage 2-1.1:1.0
[    3.855604] usbcore: registered new interface driver usb-storage
[    3.860846] usbcore: registered new interface driver uas
[    3.900039] usb 1-1.4: new full-speed USB device number 4 using ehci-pci
[    3.920027] usb 2-1.2: new low-speed USB device number 4 using ehci-pci
[    3.980024] usb 1-1.4: device descriptor read/64, error -32
[    4.032061] usb 2-1.2: New USB device found, idVendor=0000, idProduct=3825, bcdDevice= 1.00
[    4.032071] usb 2-1.2: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[    4.032075] usb 2-1.2: Product:  USB OPTICAL MOUSE
[    4.051571] usbcore: registered new interface driver usbhid
[    4.051580] usbhid: USB HID core driver
[    4.057353] input:  USB OPTICAL MOUSE as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/0003:0000:3825.0001/input/input4
[    4.057637] hid-generic 0003:0000:3825.0001: input,hidraw0: USB HID v1.11 Mouse [ USB OPTICAL MOUSE] on usb-0000:00:1d.0-1.2/input0
[    4.112013] usb 2-1.4: new low-speed USB device number 5 using ehci-pci
[    4.168016] usb 1-1.4: device descriptor read/64, error -32
[    4.226125] usb 2-1.4: New USB device found, idVendor=1a2c, idProduct=2124, bcdDevice= 1.10
[    4.226135] usb 2-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    4.226139] usb 2-1.4: Product: USB Keyboard
[    4.226142] usb 2-1.4: Manufacturer: SEM
[    4.229779] input: SEM USB Keyboard as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.4/2-1.4:1.0/0003:1A2C:2124.0002/input/input5
[    4.288619] hid-generic 0003:1A2C:2124.0002: input,hidraw1: USB HID v1.10 Keyboard [SEM USB Keyboard] on usb-0000:00:1d.0-1.4/input0
[    4.291806] input: SEM USB Keyboard Consumer Control as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.4/2-1.4:1.1/0003:1A2C:2124.0003/input/input6
[    4.348265] input: SEM USB Keyboard System Control as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.4/2-1.4:1.1/0003:1A2C:2124.0003/input/input7
[    4.348527] hid-generic 0003:1A2C:2124.0003: input,hidraw2: USB HID v1.10 Device [SEM USB Keyboard] on usb-0000:00:1d.0-1.4/input1
[    4.358006] usb 1-1.4: new full-speed USB device number 5 using ehci-pci
[    4.440001] usb 1-1.4: device descriptor read/64, error -32
[    4.631997] usb 1-1.4: device descriptor read/64, error -32
[    4.740158] usb 1-1-port4: attempt power cycle
[    5.343984] usb 1-1.4: new full-speed USB device number 6 using ehci-pci
[    5.759983] usb 1-1.4: device not accepting address 6, error -32
[    5.845054] usb 1-1.4: new full-speed USB device number 7 using ehci-pci
[    6.259992] usb 1-1.4: device not accepting address 7, error -32
[    6.261307] usb 1-1-port4: unable to enumerate USB device
[    8.704637] usbcore: registered new interface driver btusb
[    8.708238] usbcore: registered new interface driver ath3k
[    8.716442] usb 1-1.4: new full-speed USB device number 8 using ehci-pci
[    8.800013] usb 1-1.4: device descriptor read/64, error -32
[    8.992004] usb 1-1.4: device descriptor read/64, error -32
[    9.184025] usb 1-1.4: new full-speed USB device number 9 using ehci-pci
[    9.264059] usb 1-1.4: device descriptor read/64, error -32
[    9.456062] usb 1-1.4: device descriptor read/64, error -32
[    9.564159] usb 1-1-port4: attempt power cycle
[   10.176013] usb 1-1.4: new full-speed USB device number 10 using ehci-pci
[   10.592025] usb 1-1.4: device not accepting address 10, error -32
[   10.672040] usb 1-1.4: new full-speed USB device number 11 using ehci-pci
[   11.088040] usb 1-1.4: device not accepting address 11, error -32
[   11.088123] usb 1-1-port4: unable to enumerate USB device
[ 1285.583139] usb 2-1.1: USB disconnect, device number 3

Enfim, parece que quando o dispositivo é removido em segurança, a energia do USB é cortada no ato, fazendo com que ele só ligue novamente reconectando o dispositivo manualmente (Isso é uma teoria minha, eu não sei exatamente como funciona).

E aqui que entra a questão principal:

Qual o comando no terminal que eu dou para o dispositivo ser reconhecido novamente (voltar a ter energia, se a minha teoria tiver certa), sem eu precisar reconectar o dispositivo?

Eu não vi esse tipo de resolução em canto nenhum, somente soluções para montar o USB, mas com lsusb reconhecendo ele já, mas eu queria mesmo era ligar esse usb que foi “desligado” quando o “Remover com segurança” foi acionado.
Se alguém puder ajudar eu agradeço demais ( e o meu usb também :sweat_smile:)

Já tentou isso? O problema é que creio que pode ter alguma corrupção de dados por não envolver o “eject”, então recomendo você primeiro desmontar todas as partições do HD externo antes de rodar esses comandos, assim não deverá ter problemas.