Web lists-archives.com

Re: What's the device name of my microSD card?




On Sun 21 Apr 2019 at 21:09:24 (+0000), Erik Josefsson wrote:
> On 4/21/19 8:05 PM, David Wright wrote:
> > On Sun 21 Apr 2019 at 18:30:28 (+0000), Erik Josefsson wrote:
> > > On 4/21/19 6:14 PM, Patrick Wiseman wrote:
> > > >  From the command line, 'df' returns free disk space and lists all
> > > > mounted devices by device name. (One of probably many ways to do
> > > > it!)
> > > On 4/21/19 6:17 PM, Paul Sutton wrote:
> > > > if you run lsblk it will list devices connected to the system
> > > Here's the output of both commands, not sure I can figure out which
> > > one(s) is(are) my usb-Generic_STORAGE_DEVICE (i.e. a microSD put into
> > > a USB-thingie):
> > > 
> > > debian@hamlet:~$ df
> > > Filesystem     1K-blocks     Used Available Use% Mounted on
> > > udev              961108        0    961108   0% /dev
> > > tmpfs             201708     3260    198448   2% /run
> > > /dev/mmcblk0p2  61214500 11372112  47335168  20% /
> > > tmpfs            1008520    50808    957712   6% /dev/shm
> > > tmpfs               5120        0      5120   0% /run/lock
> > > tmpfs            1008520        0   1008520   0% /sys/fs/cgroup
> > > tmpfs            1008520        8   1008512   1% /tmp
> > > tmpfs            1008520        0   1008520   0% /var/tmp
> > > /dev/mmcblk0p1    202277    48430    143403  26% /boot
> > > tmpfs             201704       24    201680   1% /run/user/1000
> > > 
> > > debian@hamlet:~$ lsblk
> > > NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
> > > sda            8:0    1 29.7G  0 disk
> > > └─sda1         8:1    1 29.7G  0 part
> > > mmcblk0      179:0    0 59.5G  0 disk
> > > ├─mmcblk0p1  179:1    0  204M  0 part /boot
> > > └─mmcblk0p2  179:2    0 59.3G  0 part /
> > > mmcblk2      179:256  0 13.8G  0 disk
> > > ├─mmcblk2p1  179:257  0   50M  0 part
> > > └─mmcblk2p2  179:258  0 13.7G  0 part
> > > mmcblk2boot0 179:512  0   16M  1 disk
> > > mmcblk2boot1 179:768  0   16M  1 disk
> > > 
> > > 
> > > When I'm at it, here's the full ls completion from ls -al /dev/disk/by-id
> > > 
> > > debian@hamlet:~$ ls -al /dev/disk/by-id/
> > > mmc-R1J56L_0x7da477d7
> > > mmc-R1J56L_0x7da477d7-part1
> > > mmc-R1J56L_0x7da477d7-part2
> > > mmc-SN64G_0x3376cd3a
> > > mmc-SN64G_0x3376cd3a-part1
> > > mmc-SN64G_0x3376cd3a-part2
> > > usb-Generic_STORAGE_DEVICE_000000001532-0:0
> > > usb-Generic_STORAGE_DEVICE_000000001532-0:0-part1
> > I don't understand this output from   ls -al   as the -l switch should
> > show a lot more information, viz:
> 
> Indeed, I only pasted completion, not the output. Apologies.
> 
> Here's the output:
> 
> debdebian@hamlet:/dev/disk/by-id$ ls -al
> total 0
> drwxr-xr-x 2 root root 200 Apr 21 17:22 .
> drwxr-xr-x 7 root root 140 Apr 21 17:22 ..
> lrwxrwxrwx 1 root root  13 Apr 21 17:22 mmc-R1J56L_0x7da477d7 ->
> ../../mmcblk2
> lrwxrwxrwx 1 root root  15 Apr 21 17:22 mmc-R1J56L_0x7da477d7-part1 ->
> ../../mmcblk2p1
> lrwxrwxrwx 1 root root  15 Apr 21 17:22 mmc-R1J56L_0x7da477d7-part2 ->
> ../../mmcblk2p2
> lrwxrwxrwx 1 root root  13 Apr 21 17:22 mmc-SN64G_0x3376cd3a ->
> ../../mmcblk0
> lrwxrwxrwx 1 root root  15 Apr 21 17:22 mmc-SN64G_0x3376cd3a-part1 ->
> ../../mmcblk0p1
> lrwxrwxrwx 1 root root  15 Apr 21 17:22 mmc-SN64G_0x3376cd3a-part2 ->
> ../../mmcblk0p2
> lrwxrwxrwx 1 root root   9 Apr 21 17:22
> usb-Generic_STORAGE_DEVICE_000000001532-0:0 -> ../../sda
> lrwxrwxrwx 1 root root  10 Apr 21 17:22
> usb-Generic_STORAGE_DEVICE_000000001532-0:0-part1 -> ../../sda1
> 
> > 
> > lrwxrwxrwx 1 root root 13 Apr 21 14:52 mmc-SD01G_0x00c2ed5b -> ../../mmcblk0
> > lrwxrwxrwx 1 root root 15 Apr 21 14:52 mmc-SD01G_0x00c2ed5b-part1 -> ../../mmcblk0p1
> > 
> > which is showing my SD card out of a digital camera.
> 
> Yes, looks the same.

Yes, my system is probably more typical, with the system on spinning
rust on sda and the camera SD card plugged into a slot giving it the
mmcblk… device name, whereas your USB card reader is giving the card
a sd… name. I'm not familiar with the mmc-… devices that your system
resides on (or the TERES laptop).

> > The first line is the card itself, the second is a single partition
> > containing a FAT16 filesystem.
> 
> Thanks for your explanation, it's getting clearer that "disk" (from
> lsblk) is the same as "device name" (as asked for in the instructions)
> and what you call "the card itself".

That's right.

> > The names you're quoting should be symbolic links created by udev, and
> > they should point to the /dev names assigned by the kernel.
> > 
> > > It's the usb-Generic storage I want to copy the gz image to.
> > Your instructions would appear to write to the whole device, which is
> > quite normal. The image itself will contain any partitioning required.
> > In my case, that would be to /dev/mmcblk0. It looks like you have more
> > choice, so take care.
> 
> 
> I now think I should copy to /dev/disk/by-id/sda, but I will sleep on it!

Yes. It looks as if your system booted up with the USB card reader
plugged in, so everything in your listing got the same time: 17:22.

Tomorrow you could boot up the system, and then plug in the card
reader after a minute or two. Two consequences: you'll see the /dev
name appear in kern.log as you plug it in, and your USB links shown
above will have a later timestamp than the system devices. It's
always nice to see corroborating evidence of devices' identities
when about to write to a raw device.

Cheers,
David.