LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Puzzle to find which SD card is which (https://www.linuxquestions.org/questions/linux-hardware-18/puzzle-to-find-which-sd-card-is-which-4175619074/)

NotionCommotion 12-06-2017 09:43 AM

Puzzle to find which SD card is which
 
I have (4) SD cards.

#1 is 8GB, and came pre-loaded with raspbian noobs.
#2 is 32GB and I successfully copied a raspbian image to it and it is working.
#3 is 32GB, and I think I might have broken a while back.
#4 is 32GB, and I which I don't recall but likely did nothing.

Can you guess which one is which? I "think" I put them in order but am not sure as all 4 of them were mixed up in a small bag. Other than the first one which is obvious, how did you tell?

I will be writing a new image to one of the 32GB SDs and ideally not #2 (the 32GB one with raspbian on it). When I saw the device is sda, I was worried as typically I use another machine to view the SDs and on that machine sda is my hard dirve.
Code:

sudo dd bs=4M if=2017-04-10-raspbian-jessie-lite.img of=/dev/sda
Think the #3 broken one is really broken?

When you look at the below outputs, what information do you find important and how do you interpret it? Are there other applicable commands I should have executed to provide additional information?

Is there a way to get some sort of ID from the cards so I know for sure which one is which?

Thanks

#1
Code:

michael@pi-c72eb01a:~ $ dmesg | tail
[1188349.708301] scsi host0: usb-storage 1-1.4.4:1.0
[1188350.766556] scsi 0:0:0:0: Direct-Access    Multiple Card  Reader    1.00 PQ: 0 ANSI: 0
[1188350.767830] sd 0:0:0:0: Attached scsi generic sg0 type 0
[1188351.088973] sd 0:0:0:0: [sda] 15523840 512-byte logical blocks: (7.95 GB/7.40 GiB)
[1188351.089401] sd 0:0:0:0: [sda] Write Protect is off
[1188351.089413] sd 0:0:0:0: [sda] Mode Sense: 03 00 00 00
[1188351.089831] sd 0:0:0:0: [sda] No Caching mode page found
[1188351.089840] sd 0:0:0:0: [sda] Assuming drive cache: write through
[1188351.111378]  sda: sda1 sda2 < sda5 sda6 > sda3
[1188351.115048] sd 0:0:0:0: [sda] Attached SCSI removable disk
michael@pi-c72eb01a:~ $ cat /proc/partitions
major minor  #blocks  name

 179        0  31166976 mmcblk0
 179        1      42811 mmcblk0p1
 179        2  31119872 mmcblk0p2
  8        0    7761920 sda
  8        1    838677 sda1
  8        2          1 sda2
  8        3      32768 sda3
  8        5      61440 sda5
  8        6    6815744 sda6
michael@pi-c72eb01a:~ $ sudo fdisk -l
Disk /dev/mmcblk0: 29.7 GiB, 31914983424 bytes, 62333952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xd19c6641

Device        Boot Start      End  Sectors  Size Id Type
/dev/mmcblk0p1      8192    93813    85622 41.8M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      94208 62333951 62239744 29.7G 83 Linux


Disk /dev/sda: 7.4 GiB, 7948206080 bytes, 15523840 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00005c05

Device    Boot    Start      End  Sectors  Size Id Type
/dev/sda1          8192  1685546  1677355  819M  e W95 FAT16 (LBA)
/dev/sda2        1687552 15458303 13770752  6.6G 85 Linux extended
/dev/sda3      15458304 15523839    65536  32M 83 Linux
/dev/sda5        1695744  1818623  122880  60M  c W95 FAT32 (LBA)
/dev/sda6        1826816 15458303 13631488  6.5G 83 Linux

Partition table entries are not in disk order.
michael@pi-c72eb01a:~ $

#2
Code:

michael@pi-c72eb01a:~ $ dmesg | tail
[1188632.809693] scsi host0: usb-storage 1-1.4.4:1.0
[1188633.888009] scsi 0:0:0:0: Direct-Access    Multiple Card  Reader    1.00 PQ: 0 ANSI: 0
[1188633.889296] sd 0:0:0:0: Attached scsi generic sg0 type 0
[1188634.138572] sd 0:0:0:0: [sda] 60751872 512-byte logical blocks: (31.1 GB/29.0 GiB)
[1188634.139009] sd 0:0:0:0: [sda] Write Protect is off
[1188634.139022] sd 0:0:0:0: [sda] Mode Sense: 03 00 00 00
[1188634.139443] sd 0:0:0:0: [sda] No Caching mode page found
[1188634.139453] sd 0:0:0:0: [sda] Assuming drive cache: write through
[1188634.143270]  sda: sda1 sda2
[1188634.150702] sd 0:0:0:0: [sda] Attached SCSI removable disk
michael@pi-c72eb01a:~ $ cat /proc/partitions
major minor  #blocks  name

 179        0  31166976 mmcblk0
 179        1      42811 mmcblk0p1
 179        2  31119872 mmcblk0p2
  8        0  30375936 sda
  8        1      64512 sda1
  8        2  30307328 sda2
michael@pi-c72eb01a:~ $ sudo fdisk -l
Disk /dev/mmcblk0: 29.7 GiB, 31914983424 bytes, 62333952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xd19c6641

Device        Boot Start      End  Sectors  Size Id Type
/dev/mmcblk0p1      8192    93813    85622 41.8M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      94208 62333951 62239744 29.7G 83 Linux


Disk /dev/sda: 29 GiB, 31104958464 bytes, 60751872 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xbad84222

Device    Boot  Start      End  Sectors  Size Id Type
/dev/sda1        8192  137215  129024  63M  c W95 FAT32 (LBA)
/dev/sda2      137216 60751871 60614656 28.9G 83 Linux
michael@pi-c72eb01a:~ $

#3
Code:

michael@pi-c72eb01a:~ $ dmesg | tail
[1188141.067437] scsi host0: usb-storage 1-1.4.4:1.0
[1188142.125596] scsi 0:0:0:0: Direct-Access    Multiple Card  Reader    1.00 PQ: 0 ANSI: 0
[1188142.126817] sd 0:0:0:0: Attached scsi generic sg0 type 0
[1188142.532785] sd 0:0:0:0: [sda] 62333952 512-byte logical blocks: (31.9 GB/29.7 GiB)
[1188142.533200] sd 0:0:0:0: [sda] Write Protect is off
[1188142.533213] sd 0:0:0:0: [sda] Mode Sense: 03 00 00 00
[1188142.533623] sd 0:0:0:0: [sda] No Caching mode page found
[1188142.533633] sd 0:0:0:0: [sda] Assuming drive cache: write through
[1188142.546917]  sda: sda1
[1188142.549436] sd 0:0:0:0: [sda] Attached SCSI removable disk
michael@pi-c72eb01a:~ $ cat /proc/partitions
major minor  #blocks  name
 179        0  31166976 mmcblk0
 179        1      42811 mmcblk0p1
 179        2  31119872 mmcblk0p2
  8        0  31166976 sda
  8        1  31162880 sda1
michael@pi-c72eb01a:~ $ sudo fdisk -l

Disk /dev/mmcblk0: 29.7 GiB, 31914983424 bytes, 62333952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xd19c6641

Device        Boot Start      End  Sectors  Size Id Type
/dev/mmcblk0p1      8192    93813    85622 41.8M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      94208 62333951 62239744 29.7G 83 Linux


Disk /dev/sda: 29.7 GiB, 31914983424 bytes, 62333952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device    Boot Start      End  Sectors  Size Id Type
/dev/sda1        8192 62333951 62325760 29.7G  c W95 FAT32 (LBA)
michael@pi-c72eb01a:~ $

#4
Code:

michael@pi-c72eb01a:~ $ dmesg | tail
[1188519.659198] scsi host0: usb-storage 1-1.4.4:1.0
[1188520.687431] scsi 0:0:0:0: Direct-Access    Multiple Card  Reader    1.00 PQ: 0 ANSI: 0
[1188520.688688] sd 0:0:0:0: Attached scsi generic sg0 type 0
[1188520.941226] sd 0:0:0:0: [sda] 60751872 512-byte logical blocks: (31.1 GB/29.0 GiB)
[1188520.941658] sd 0:0:0:0: [sda] Write Protect is off
[1188520.941671] sd 0:0:0:0: [sda] Mode Sense: 03 00 00 00
[1188520.942084] sd 0:0:0:0: [sda] No Caching mode page found
[1188520.942094] sd 0:0:0:0: [sda] Assuming drive cache: write through
[1188520.947809]  sda: sda1
[1188520.951934] sd 0:0:0:0: [sda] Attached SCSI removable disk
michael@pi-c72eb01a:~ $ cat /proc/partitions
major minor  #blocks  name

 179        0  31166976 mmcblk0
 179        1      42811 mmcblk0p1
 179        2  31119872 mmcblk0p2
  8        0  30375936 sda
  8        1  30374912 sda1

  michael@pi-c72eb01a:~ $ sudo fdisk -l
Disk /dev/mmcblk0: 29.7 GiB, 31914983424 bytes, 62333952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xd19c6641

Device        Boot Start      End  Sectors  Size Id Type
/dev/mmcblk0p1      8192    93813    85622 41.8M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      94208 62333951 62239744 29.7G 83 Linux


Disk /dev/sda: 29 GiB, 31104958464 bytes, 60751872 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x0004a452

Device    Boot Start      End  Sectors Size Id Type
/dev/sda1        2048 60751871 60749824  29G 83 Linux
michael@pi-c72eb01a:~ $

Note that I removed some of the RAM entries in the above to reduce clutter.

rknichols 12-06-2017 10:06 AM

Usually, the output from "blkid" and/or "lsblk -f" will give you a pretty good idea of what is what.

NotionCommotion 12-06-2017 10:27 AM

Thanks rknichols, lsblk -f gives similar information as the others, but is a little more to the point. Thanks. I was previously trying blkid, but it appears to only provide information about the sd card actually being used by the RPi I am access the sd from. Looking through the man,can't seem to figure out how to have it use sda1, etc.

michaelk 12-06-2017 10:39 AM

Without mounting the cards and examining the contents there is not much that you can guess from the posted information.

SD #4 Looks like you reformatted the drive with a linux file system.

SD #3 Could be you have not done anything.

SD #2 Looks like it might be the copy of your raspbian system.

SD #1 Looks like a NOOBS installed OS.

NotionCommotion 12-06-2017 10:53 AM

Thanks michaelk. Looks like I was right on #1 and #2, but not #3 and #4. How did you come to your conclusion?

PS. I had tried mounting them, but still blkid did not appear to target them.

rknichols 12-06-2017 01:46 PM

Quote:

Originally Posted by NotionCommotion (Post 5789675)
I was previously trying blkid, but it appears to only provide information about the sd card actually being used by the RPi I am access the sd from. Looking through the man,can't seem to figure out how to have it use sda1, etc.

If you run blkid as root, it should probe all attached devices. When run as a non-root user, it can't do that and has to rely on cached information.

michaelk 12-06-2017 02:34 PM

Just a big guess...

Code:

SD #3
Device    Boot Start      End  Sectors  Size Id Type
/dev/sda1        8192 62333951 62325760 29.7G  c W95 FAT32 (LBA)

It depends on the manufacture but typically drives are formatted as FAT32 if less then 32GB and greater as exFAT or NTFS. The start sector is 8192 which could mean original partition table.

Code:

SD #4
Device    Boot Start      End  Sectors Size Id Type
/dev/sda1        2048 60751871 60749824  29G 83 Linux

Since the partition ID is 83 and the start sector is 2048 that probably means you created a new partition table and formatted with a linux file system.

What happens when you try to mount 3 & 4?

Shadow_7 12-06-2017 08:37 PM

They're kind of small. Take images of them, then zero them out. Various ways to mount the partitions of a dd image. With partx and other things. Fedora being an odd one with lvm2 stuff. Worst case dd the image back on them if you figure out you wanted it that way in the first place. Otherwise blkid can give details like UUID, LABEL, and such. I tend to zero out storage devices then use $(cmp) to verify that they're still zero. The failed ones fail that check.

dave@burn-it.co.uk 12-09-2017 10:54 AM

I would run with one at a time and put a named file on each that identifies it when all are present.


All times are GMT -5. The time now is 07:20 AM.