spaceman5
Posts: 289
Joined: Sun Aug 25, 2019 5:26 am

On RPiOS Lite: Do I have to Run Some Command Before Disconnecting a USB Device?

Fri Mar 24, 2023 8:34 pm

Hi all


When using RPi OS Lite,
If you connect a USB Device such as an Ethernet NIC, or a Wi-Fi NIC, or anything else,
then when you're done, before you physically disconnect the USB Device from the RPi,
do you need to run any command, to tell the OS that you're disconnecting?

(like you do on Windows, before disconnecting a USB device)


Thank you

User avatar
kerry_s
Posts: 5389
Joined: Thu Jan 30, 2020 7:14 pm

Re: On RPiOS Lite: Do I have to Run Some Command Before Disconnecting a USB Device?

Fri Mar 24, 2023 8:54 pm

only if it's a data drive, adapters should be fine.
the reason for a clean eject is to not corrupt data.

you can lsblk to see the mounted devices and sudo eject /media/device/sd* or mmcblk* for usb/sd data drives.

spaceman5
Posts: 289
Joined: Sun Aug 25, 2019 5:26 am

Re: On RPiOS Lite: Do I have to Run Some Command Before Disconnecting a USB Device?

Fri Mar 24, 2023 9:04 pm

Thank you kerry_s


For USB Data Drives, I always do
umount /mnt/<...>


So I should run eject in addition to umount?

Or maybe instead of umount?

(and if I do it instead of umount, will it spare the need to mount it next time I physically connect the drive?)

User avatar
kerry_s
Posts: 5389
Joined: Thu Jan 30, 2020 7:14 pm

Re: On RPiOS Lite: Do I have to Run Some Command Before Disconnecting a USB Device?

Fri Mar 24, 2023 9:26 pm

i use umount if i leave the drive in but don't want it mounted, i use eject if i'm going to unplug drive.

lite version does not auto mount drives, i usually use udiskie(sudo apt install udiskie) then you can just run udiskie &, it'll do the work for you with the proper permissions.

spaceman5
Posts: 289
Joined: Sun Aug 25, 2019 5:26 am

Re: On RPiOS Lite: Do I have to Run Some Command Before Disconnecting a USB Device?

Sat Mar 25, 2023 7:51 am

kerry_s wrote:
Fri Mar 24, 2023 9:26 pm
lite version does not auto mount drives, i usually use udiskie(sudo apt install udiskie) then you can just run udiskie &, it'll do the work for you with the proper permissions.
Thank you for this, will try it..

kerry_s wrote:
Fri Mar 24, 2023 9:26 pm
i use umount if i leave the drive in but don't want it mounted, i use eject if i'm going to unplug drive.
Oh, so eject replaces umount

I'll go and read the man about both of them,
I think I need this info..

Thank you very much

User avatar
rpdom
Posts: 21814
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: On RPiOS Lite: Do I have to Run Some Command Before Disconnecting a USB Device?

Sat Mar 25, 2023 8:54 am

spaceman5 wrote:
Sat Mar 25, 2023 7:51 am
Oh, so eject replaces umount
eject tries to run umount for you on all mounted partitions on the drive. I usually do a umount first anyway.
Unreadable squiggle

Return to “Raspberry Pi OS”