LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Request for probing some devices' types (https://www.linuxquestions.org/questions/slackware-14/request-for-probing-some-devices-types-4175677657/)

Didier Spaier 06-26-2020 02:47 AM

Request for probing some devices' types
 
Hello,

In the next Slint installer in 'auto' mode I plan to format the root partitions with a f2fs file system for these drives types in addition to USB sticks:
  1. eMMC drives (flash drives soldered to the motherboard with typically a 32G or 64G capacity found in cheap laptops)
  2. SD cards connected through an USB adapter (because not all machines can boot off an SD card inserted directly in an SD slot of the machine)
To minimize the need of user input I need to gather as much information as available about drives attached to or plugged in the system at time of installation, using the lsblk command.

I own neither eMMC nor USB adapter for SD cards, so you could help to find how to detect these configurations posting the output of this command:
Code:

lsblk -pPo name,rm,rota,hotplug,tran,disc-gran,type,subsystems,size,vendor,model|grep 'TYPE="disk"'
and tell for each line to which kind of device and connection mode it corresponds.

Thanks in advance,

gouttegd 06-26-2020 05:00 AM

Hello,

Here’s the result for a micro-SD card in a USB card reader (“EMTEC USB2.0 23-in-1 CardReader”):
Code:

NAME="/dev/sdc" RM="1" ROTA="1" HOTPLUG="1" TRAN="usb" DISC-GRAN="0B" TYPE="disk" SUBSYSTEMS="block:scsi:usb:pci" SIZE="7.5G" VENDOR="Generic " MODEL="USB_SD_Reader"
For information, the same card when plugged directly into the built-in SD card reader of my laptop:
Code:

NAME="/dev/mmcblk0" RM="0" ROTA="0" HOTPLUG="1" TRAN="" DISC-GRAN="4M" TYPE="disk" SUBSYSTEMS="block:mmc:mmc_host:platform:pci" SIZE="7.5G" VENDOR="" MODEL=""
Of note, in both cases there is a microSD-to-SD adapter between the actual card and the reader.

3rensho 06-26-2020 05:05 AM

Here is the info for the SD card from my camera in a usb card reader -

Code:


NAME="/dev/sdg" RM="1" ROTA="1" HOTPLUG="1" TRAN="usb" DISC-GRAN="0B" TYPE="disk" SUBSYSTEMS="block:scsi:usb:pci" SIZE="59.5G" VENDOR="Generic " MODEL="STORAGE_DEVICE"


Keith Hedger 06-26-2020 06:08 AM

Code:

NAME="/dev/sda" RM="0" ROTA="1" HOTPLUG="1" TRAN="usb" DISC-GRAN="0B" TYPE="disk" SUBSYSTEMS="block:scsi:usb:platform" SIZE="3.7T" VENDOR="WD      " MODEL="Elements 25A3  "
NAME="/dev/sdb" RM="0" ROTA="1" HOTPLUG="1" TRAN="usb" DISC-GRAN="0B" TYPE="disk" SUBSYSTEMS="block:scsi:usb:platform" SIZE="1.8T" VENDOR="WD      " MODEL="Ext HDD 1021    "
NAME="/dev/mmcblk0" RM="0" ROTA="0" HOTPLUG="1" TRAN="" DISC-GRAN="4M" TYPE="disk" SUBSYSTEMS="block:mmc:mmc_host:platform" SIZE="14.4G" VENDOR="" MODEL=""
ke

An SSD card, 1 4T usb, 1 2T usb plugged into a pi4

Keith Hedger 06-26-2020 06:12 AM

Code:

NAME="/dev/sda" RM="0" ROTA="1" HOTPLUG="0" TRAN="sata" DISC-GRAN="0B" TYPE="disk" SUBSYSTEMS="block:scsi:pci" SIZE="596.2G" VENDOR="ATA    " MODEL="WDC WD6400AAKS-2"
NAME="/dev/sdb" RM="0" ROTA="1" HOTPLUG="1" TRAN="usb" DISC-GRAN="0B" TYPE="disk" SUBSYSTEMS="block:scsi:usb:pci" SIZE="1.8T" VENDOR="Seagate " MODEL="Expansion Desk  "
NAME="/dev/sdh" RM="0" ROTA="1" HOTPLUG="1" TRAN="usb" DISC-GRAN="0B" TYPE="disk" SUBSYSTEMS="block:scsi:usb:pci" SIZE="931.5G" VENDOR="Seagate " MODEL="Expansion      "
NAME="/dev/sdi" RM="0" ROTA="1" HOTPLUG="1" TRAN="usb" DISC-GRAN="0B" TYPE="disk" SUBSYSTEMS="block:scsi:usb:pci" SIZE="931.5G" VENDOR="WD      " MODEL="Ext HDD 1021    "

From main desktop

ZhaoLin1457 06-27-2020 05:42 AM

Code:

root@darkstar:~# lsblk -pPo name,rm,rota,hotplug,tran,disc-gran,type,subsystems,size,vendor,model|grep 'TYPE="disk"'
NAME="/dev/sda" RM="1" ROTA="1" HOTPLUG="1" TRAN="usb" DISC-GRAN="0B" TYPE="disk" SUBSYSTEMS="block:scsi:usb:pci" SIZE="59.5G" VENDOR="Generic " MODEL="STORAGE_DEVICE"
NAME="/dev/mmcblk0" RM="0" ROTA="0" HOTPLUG="1" TRAN="" DISC-GRAN="4M" TYPE="disk" SUBSYSTEMS="block:mmc:mmc_host:platform" SIZE="58.2G" VENDOR="" MODEL=""
NAME="/dev/mmcblk0boot0" RM="0" ROTA="0" HOTPLUG="1" TRAN="" DISC-GRAN="4M" TYPE="disk" SUBSYSTEMS="block:mmc:mmc_host:platform" SIZE="4M" VENDOR="" MODEL=""
NAME="/dev/mmcblk0boot1" RM="0" ROTA="0" HOTPLUG="1" TRAN="" DISC-GRAN="4M" TYPE="disk" SUBSYSTEMS="block:mmc:mmc_host:platform" SIZE="4M" VENDOR="" MODEL=""
NAME="/dev/zram0" RM="0" ROTA="0" HOTPLUG="0" TRAN="" DISC-GRAN="4K" TYPE="disk" SUBSYSTEMS="block" SIZE="2G" VENDOR="" MODEL=""
NAME="/dev/zram1" RM="0" ROTA="0" HOTPLUG="0" TRAN="" DISC-GRAN="4K" TYPE="disk" SUBSYSTEMS="block" SIZE="256M" VENDOR="" MODEL=""
NAME="/dev/zram2" RM="0" ROTA="0" HOTPLUG="0" TRAN="" DISC-GRAN="4K" TYPE="disk" SUBSYSTEMS="block" SIZE="256M" VENDOR="" MODEL=""
NAME="/dev/zram3" RM="0" ROTA="0" HOTPLUG="0" TRAN="" DISC-GRAN="4K" TYPE="disk" SUBSYSTEMS="block" SIZE="256M" VENDOR="" MODEL=""
NAME="/dev/zram4" RM="0" ROTA="0" HOTPLUG="0" TRAN="" DISC-GRAN="4K" TYPE="disk" SUBSYSTEMS="block" SIZE="256M" VENDOR="" MODEL=""
root@darkstar:~#

The computer is a mini-pc, model: MinisForum Z83-F.

The Slackware is installed in a 64GB Sandisk Ultra SD-card, which contains two partitions: the first is an UEFI ESP of 400MB and the second is a 59GB partition with F2FS filesystem and it hosts the system. The SD-card in its adapter slot is not recognized directly by the Slackware, even the BIOS and Windows 10 see it correctly, that's why I put it in a no-name USB 3.0 SD-card adapter, where gives speeds around 80MB write and 100MB/s read. The USB 3.0 adapter with its SD-card is recognized as: /dev/sda

The eMMC have 64GB and contains the Windows 10 Pro shipped with the computer, and it is recognized as: /dev/mmcblk0

You can ignore the devices "/dev/zramX" as they are obviously ZRAM devices used for /tmp and swap.

As a side note, I would like to mention that F2FS is not compatible with LILO, and how my "Linux on SD-card" is intended to work with both UEFI with no CSM and classic BIOS, I'we reused the UEFI ESP partition as kernel and initrd loaded by LILO, and also put there the boot map, with this config option in /etc/lilo.conf :
Code:

map = /boot/efi/boot.map
Finally, I discovered that a good SD-card put in a USB 3.0 adapter will beat hands down even a good USB 3.0 flash drive, as durability, read speed and write speed. How many USB 3.0 flash drives writes consistently with 80MB/s ?

Labinnah 06-27-2020 07:26 AM

Code:

NAME="/dev/sdc" RM="1" ROTA="1" HOTPLUG="1" TRAN="usb" DISC-GRAN="0B" TYPE="disk" SUBSYSTEMS="block" SIZE="1,9G" VENDOR="Generic-" MODEL="SD/MMC          "
NAME="/dev/sdg" RM="1" ROTA="1" HOTPLUG="1" TRAN="usb" DISC-GRAN="0B" TYPE="disk" SUBSYSTEMS="block" SIZE="1,9G" VENDOR="SD/MMC  " MODEL="Card  Reader    "

sdc - is stationary usb reader, and sdg - portable usb reader.

Didier Spaier 06-27-2020 05:37 PM

Thanks to all who responded so far.

First, a reminder of the fields names meanings, from "lsblk --help":
  • RM removable device
  • ROTA rotational device [1]
  • HOTPLUG removable or hotplug device (usb, pcmcia, ...) [2]
  • TRAN device transport type
  • DISC-GRAN discard granularity [3]
  • TYPE device type [4]
  • SUBSYSTEMS de-duplicated chain of subsystems [5]
From your answers, my tentative findings are as follows:
  • SD cards inserted directly the machine and eMMC drives are named /dev/mmcblk<device number> and members of subsystems mmc and mmc_host, with TRAN empty, ROTA=0 RM=0, discard
  • SD cards connected through an USB reader aka USB adapter named /dev/sd<device letter>, are members of the subsystems scsi and usb (but for Labinnah?) have tran=USB, ROTA=1 and RM=1, no discard
  • So it looks like the SD card be somehow "hidden" behind the USB reader
  • Nothing obvious distinguishes an eMMC from a SD card directly inserted in the machine.
  • Nothing obvious distinguishes an SD card in an USB reader from an USB stick (tested by me)
It looks like I can't avoid to ask a user "which the kind of device it is" to distinguish an eMMC from a SD card (that I plan to only accept as target drive for installation if connected through an USB reader)

Will I advise users not to install an an USB stick will depend on tests I will make using an f2fs vs an ext4 file system for the root partition.

If you made performance tests ext4 vs f2fs with an eMMC, please report your findings.

[1] I am puzzled as USB stick have ROTA=1. It looks like this field come from /sys/devices/*/queue/rotational
[2] I am puzzled that eMMC have HOTPLUG=1
[3] This answers the question: does the device supports discards (no if 0 else yes). This could be used to distinguish hard disks from SSD, but I plan to use ext4 for SSD anyway.
[4] Part for partition is considered as a device type as disk.
[5] It seems that a subsystem here means a bus listed in "ls /sys/bus" cf. this document, as for udev.

Answers are still welcome, including comments on these assumptions and tentative conclusions.


All times are GMT -5. The time now is 05:06 PM.