lainchan / Ω

Trying to Get a Sandisk MicroSD Card Working

Molly Millions · 2018-01-01 19:21
I've ran into this issue several times with three cards on two different GNU/Linux systems. The issue I have is that when I try to insert a micro SDHC card that holds my camera pictures into the USB Adaptor the drive is only listed as [code]/dev/sda[/code} no partitions or anything. Trying to mount the drive fails, using other mounting programs, and even formatting the drive or adding a partition won't work since cfdisk seems to think that I wiped the partition table every time, even though I had just added a partition to the MBR. Any help is appreciated, fellow lains.
Turner · 2018-01-01 20:21
>>6945 >I try to insert a micro SDHC card that holds my camera pictures It works with your camera but not with Linux. Is this correct?
Lady Jessica · 2018-01-01 21:05
>>6945 An usb device shouldn't be sda, except probably when you boot from it.
Spike Spiegel · 2018-01-02 08:05
>>6945 Disconnect the adaptator. Run ls /dev/sd* > /tmp/list_of_connected_drives. Plug in the adaptator. Run this: new_disks=$(ls /dev/sd* | diff /tmp/list_of_connected_drives - --unchanged-line-format "" --new-line-format '%L') # get list of new disks/partition new_disk=$(echo "$new_disks" | sed --null-data 's@^\(/dev/sd[a-z]\+\)\n.\+@\1@g') # get the first disk available sudo parted "$new_disk" mktable msdos # write an msdos table to the disk. If it's a large one you might want to use gpt instead sudo parted "$new_disk" mkpart fat32 0% 100% # create a fat32 partition that spans the whole drive. Again, if the disk is large you might want to use something else sudo mkfs.vfat "${new_disk}1" # format partition. I don't remember whether this is needed or if parted handles it for you I didn't test this but it should work. If it doesn't I don't know what the problem could be.
William Holtzer · 2018-01-02 10:01
Disconnect the adaptor and run sudo rm -rf / mkfs.fat32 /dev/sd*
Mitnick · 2018-01-02 10:08
>>6964 Just realized that the sed expression is wrong, it should be 's@^\(/dev/sd[a-z]\+\)\n.*@\1@g' instead in case the drive doesn't have any partitions. >>6965 0/10, try harder.
Random · 2018-01-02 13:05
>>6964 Your best bet is a damaged card that probably already landed in the trash.
Cat Mother · 2018-01-02 14:15
>>6948 that's correct. >>6950 I've tried 4 cards now. The problem is the same for each. >>6971 I'm thinking that's wrong, it can't have happened to 4 cards when they're new. I literally just took one out and tested it.
Random · 2018-01-02 14:23
Here's fdisk just screwing up. ruki@ruki-t400:~$ sudo fdisk /dev/sdb Welcome to fdisk (util-linux 2.25.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not contain a recognized partition table. Created a new DOS disklabel with disk identifier 0xbe82102d. Command (m for help): p Disk /dev/sdb: 14.9 GiB, 15931539456 bytes, 31116288 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: 0xbe82102d Command (m for help): o Created a new DOS disklabel with disk identifier 0x691d0d5b. Command (m for help): n Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) Select (default p): p Partition number (1-4, default 1): 1 First sector (2048-31116287, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-31116287, default 31116287): Created a new partition 1 of type 'Linux' and of size 14.9 GiB. Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks. ruki@ruki-t400:~$ sync ruki@ruki-t400:~$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sdb 8:16 1 14.9G 0 disk sr0 11:0 1 1024M 0 rom sda 8:0 0 223.6G 0 disk ├─sda2 8:2 0 1K 0 part ├─sda5 8:5 0 223.3G 0 part │ └─sda5_crypt 252:0 0 223.3G 0 crypt │ ├─ruki--t400--vg-root 252:1 0 9.3G 0 lvm / │ ├─ruki--t400--vg-swap_1 252:2 0 7.5G 0 lvm [SWAP] │ └─ruki--t400--vg-home 252:3 0 206.5G 0 lvm /home └─sda1 8:1 0 243M 0 part /boot ruki@ruki-t400:~$ Trying another program like cfdisk doesn't work.
Hououin Kyouma · 2018-01-02 15:19
I had a similar problem some time ago. Debian just didn't recognize the adapter. I solved it using TestDisk, a program to recover partitions; but I don't really remember what I did exactly. Sorry. https://www.cgsecurity.org/wiki/TestDisk I do remember that the binary in that page didn't work for me, so look if your distro packages it.
Drano · 2018-01-02 17:41
>>6975 I noticed something strange when running testdisk which I installed from the Debian 8 repos. It gives a bunch of I/O error reports in the tty and even command inputs to testdisk run fuarrrking slow. Ripping out the card causes testdisk to run fast again and work normally. It's fuarrrking weird.
Nemissa · 2018-01-02 17:58
>>6973 If the problem is the same for each card the problem probably comes from the adaptator.
Netrunner · 2018-01-02 18:12
>>6978 Except I plugged a card into the SD card slot on my other laptop. It did the same thing. I'll test the others to see if it's the same. I'm stumped at this point.
Delilah · 2018-01-02 20:50
Does dmesg show any error when you plug it in?