6

If I put a USB-drive in, it will automount. I can see it with lsblk

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sdb      8:16   1   7,5G  0 disk 
└─sdb1   8:17   1   7,5G  0 part /media/user/usb-drive

If I unmount it with umount

umount /media/user/sdb1

it will still be visible with lsblk, but not mounted any more:

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sdb      8:16   1   7,5G  0 disk 
└─sdb1   8:17   1   7,5G  0 part

but if I instead eject it by clicking the eject icon in Thunar (xfce file manager), it will disappear from the list in lsblk. Why is that so?

1 Answers1

6

Mounting just means "set up the operating system to actively use the some (part of) a block device". Often there is some "busy" or "dirty" on the superblock that gets changed when a file system is mounted, but otherwise the hardware is unaffected.

OTOH, eject sends a SCSI "START STOP" command to the device, with option "eject" set. The USB controller in a flash ROM stick usually reacts by powering down the device and preventing any further interaction. That means it disappears completely from the USB subsystem, and must be re-enumerated to be able to accessed again.

The same command when send e.g. to a CD/DVD drive will eject the disk, and the also existing "load" option of the "START STOP" command will load it again. But this interpretation only applies to devices with removable media.

BTW, you can also send this SCSI command from the commandline using eject from the package with the same name, or with sg_start from the package sg3-utils.

dirkt
  • 32,309
  • 1
    @PetaspeedBeaver: you can see it physically on many devices: umount will just save data, but the LED on device is still on (e.g. on many USB pen drives). Eject will power off the device, so also the LED. – Giacomo Catenazzi Sep 28 '17 at 12:39
  • 1
    You can also use sg_start -s /dev/sdX to start the device again, so you won't have to manually plug it back in or reboot the system. See also this question. – Yeti Feb 09 '18 at 12:03