I have a SanDisk 256GB extreme pro SD card for my camera. It works perfectly fine with the camera and with windows, but when I instert it into the card reader on linux (fedora 38) I can’t copy any files from it:

cp: Fehler beim Lesen von ‘…/DCIM/112_FUJI/DSCF2001.RAF’: Eingabe-/Ausgabefehler

Loosely translated:

cp: error while reading from ‘…/DCIM//112_FUJI/DSCF2001.RAF’: input/output error

the card is automatically mounted and shows up in the file explorer.

The fdisk command return this:

Festplatte /dev/sdg1: 238,27 GiB, 255835766784 Bytes, 499679232 Sektoren
Einheiten: Sektoren von 1 * 512 = 512 Bytes
Sektorgröße (logisch/physikalisch): 512 Bytes / 512 Bytes
E/A-Größe (minimal/optimal): 512 Bytes / 512 Bytes
Festplattenbezeichnungstyp: dos
Festplattenbezeichner: 0xf4f4f4f4

Gerät       Boot     Anfang       Ende   Sektoren Größe Kn Typ
/dev/sdg1p1      4109694196 8219388391 4109694196  1,9T f4 SpeedStor
/dev/sdg1p2      4109694196 8219388391 4109694196  1,9T f4 SpeedStor
/dev/sdg1p3      4109694196 8219388391 4109694196  1,9T f4 SpeedStor
/dev/sdg1p4      4109694196 8219388391 4109694196  1,9T f4 SpeedStor

I tried following this: https://www.reddit.com/r/raspberry_pi/comments/habv0q/fixing_linux_sd_card_reader_issues_inputoutput/
but it didn’t change anything

Does anyone have any idea?

EDIT:
I used the wrong fdisk command. I used /dev/sdg1 as opposed to /dev/sdg which is the actual drive. Here is the output of fdisk -l /dev/sdg:

Festplatte /dev/sdg: 238,3 GiB, 255869321216 Bytes, 499744768 Sektoren
Festplattenmodell: STORAGE DEVICE  
Einheiten: Sektoren von 1 * 512 = 512 Bytes
Sektorgröße (logisch/physikalisch): 512 Bytes / 512 Bytes
E/A-Größe (minimal/optimal): 512 Bytes / 512 Bytes
Festplattenbezeichnungstyp: dos
Festplattenbezeichner: 0x00000000

Gerät      Boot Anfang      Ende  Sektoren  Größe Kn Typ
/dev/sdg1  *     65536 499744767 499679232 238,3G  7 HPFS/NTFS/exFAT

  • @[email protected]
    link
    fedilink
    179 months ago

    That sounds like you’re missing a fuse driver. IE if you didn’t have ntfd-3g back in the day, you could read NTFS but not write upon it.

      • @[email protected]
        link
        fedilink
        29 months ago

        I’ll have to look into it. I think my fstab is still referencing ntfs-3g.

        Found this:

        Note: All officially supported kernels with versions 5.15 or newer are built with CONFIG_NTFS3_FS=m and thus support it. Before 5.15, NTFS read and write support is provided by the NTFS-3G FUSE file system. Or you can use backported NTFS3 via ntfs3-dkmsAUR. Paragon Software, the author of the kernel module, has not yet released userspace utilities for NTFS3. You can use NTFS-3G userspace utilities without NTFS-3G driver via ntfsprogs-ntfs3AUR.

        https://wiki.archlinux.org/title/NTFS

        • Possibly linux
          link
          fedilink
          English
          19 months ago

          Interesting. I’ve never had any major issues but I don’t deal with NTFS all that often so maybe I’m just out of touch.

          What would be cool is if the windows btrfs implementation matured enough to be stable.

  • @[email protected]
    link
    fedilink
    149 months ago

    Which partition is the one automatically mounted? That sdcard seems weird, it has 4 partitions occupying the same space. Also I would try to mount all 4 partitions manually and check if one of them works.

    • @taladar
      link
      Deutsch
      89 months ago

      The partitions also start at a very high sector and are larger than the SD card is supposed to be. I wouldn’t trust the information in that table.

      • @[email protected]
        link
        fedilink
        29 months ago

        Yeah, the partition table is messed up. Format the card from Linux. It would probably work from Windows too. But the camera is doing something wrong.

        • @taladar
          link
          English
          29 months ago

          From another comment chain it looks like they used fdisk -l /dev/sdg1 instead of fdisk -l /dev/sdg

          • BentiGorlichOP
            link
            fedilink
            19 months ago

            Thats right, I posted the correct output here somewhere, but here it is again:

            Festplatte /dev/sdg: 238,3 GiB, 255869321216 Bytes, 499744768 Sektoren
            Festplattenmodell: STORAGE DEVICE  
            Einheiten: Sektoren von 1 * 512 = 512 Bytes
            Sektorgröße (logisch/physikalisch): 512 Bytes / 512 Bytes
            E/A-Größe (minimal/optimal): 512 Bytes / 512 Bytes
            Festplattenbezeichnungstyp: dos
            Festplattenbezeichner: 0x00000000
            
            Gerät      Boot Anfang      Ende  Sektoren  Größe Kn Typ
            /dev/sdg1  *     65536 499744767 499679232 238,3G  7 HPFS/NTFS/exFAT
            
            
    • BentiGorlichOP
      link
      fedilink
      19 months ago

      how do I check that? lsblk only shows that /dev/sdg1 is mounted…

      • @[email protected]
        link
        fedilink
        29 months ago

        Not sure, but one of the commands there showed /dev/sdg1p1 which is a weird name used for subvolumes if I remember correctly.

    • BentiGorlichOP
      link
      fedilink
      39 months ago

      I don’t know, the camera formatted them, but I highly doubt that it is NTFS. So propably exFAT…

        • BentiGorlichOP
          link
          fedilink
          5
          edit-2
          9 months ago

          sudo dnf install exfat
          Letzte Prüfung auf abgelaufene Metadaten: vor 4:05:54 am Mo 02 Okt 2023 08:41:49 CEST.
          Keine Übereinstimmung für Argumente: exfat
          Fehler: Keine Übereinstimmung gefunden: exfat

          there is no such package. And I mean it mounts fine. I can search all the files, just copying them or writing to the card doesn’t work

      • tal
        link
        fedilink
        19 months ago

        I don’t know, the camera formatted them, but I highly doubt that it is NTFS. So propably exFAT…

        If you have the filesystem mounted, I believe you can see in /proc/mounts.

  • @taladar
    link
    English
    99 months ago

    The partition type column is a bit strange with SpeedStor. I only found this information on that

    61 SpeedStor

    Storage Dimensions SpeedStor Volume. This is a Non-Standard DOS Volume. (Disk Manager type utility software)

    It is also strange that all four partitions seem to occupy the same space and have the same size which is also significantly larger than the 256GB you mention.

    You might not get an I/O error for the partition table but I don’t think it is reading an actual partition table describing the SD card.

  • KEISEI Skyliner Enjoyer
    link
    fedilink
    English
    79 months ago

    Sound dumb, but have you switched the write protection of the SD card off? It’s the tiny switch on the side of the SD card.

    • BentiGorlichOP
      link
      fedilink
      129 months ago

      Yes its off. Sometimes its the small things :)
      Sadly not this time.

  • @[email protected]
    link
    fedilink
    English
    59 months ago

    Have you tried formatting a different SD card in your camera and seeing if it has the same issues? This would help rule out an issue with the card itself.

    • BentiGorlichOP
      link
      fedilink
      29 months ago

      I have, but I didn’t look at that one yet. It is even more strange. It doesn’t recognize even one partition on it… (I also know that this one works, I imported files from it yesterday on my windows laptop and it worked perfectly fine, no files are corrupted

  • Ramin Honary
    link
    fedilink
    39 months ago

    Is your Linux laptop dual-booting Windows? I am wondering if you are using the same SD-Card reader to read the card on both Windows and Linux?

    This is relevant because if your Linux laptop is different it could be a problem with the SD-Card reader on your Linux machine.

    Assuming your card reader works fine on Windows but not Linux, it is probably a driver issue. Linux is clearly reading the SD-Card boot sector since it is reporting information about the partitions. But if it is a hardware issue (not likely if it is working on Windows with the same card reader), it may start to read the card and then fail as soon as it starts to draw too much power or heat the card up or something.

    • BentiGorlichOP
      link
      fedilink
      39 months ago

      I use the same external reader on both machines. So the reader is not the problem

  • Shadow
    link
    fedilink
    29 months ago

    Anything useful in dmesg when you mount it or copy the file?

    • BentiGorlichOP
      link
      fedilink
      39 months ago

      yes I am, because the files I copied from my the sd card to my windows machine are fine. I can import and edit them in darktable without any problems

    • BentiGorlichOP
      link
      fedilink
      29 months ago

      If it were I’d have the same problems on my windows machine, wouldn’t I?

      • @[email protected]
        link
        fedilink
        29 months ago

        If the card was in NTFS, then Linux may not deal with it correctly, whereas windows is fine with both NTFS and fat.

        • BentiGorlichOP
          link
          fedilink
          19 months ago

          How can I check how it is formatted? I highly doubt that a camera formats an sd card in NTFS…

            • BentiGorlichOP
              link
              fedilink
              29 months ago
              Gerät      Boot Anfang      Ende  Sektoren  Größe Kn Typ
              /dev/sdg1  *     65536 499744767 499679232 238,3G  7 HPFS/NTFS/exFAT
              
              

              It has 3 different formattings?

              • @taladar
                link
                English
                29 months ago

                That is just the partition type in the partition table (based on a number stored there).

                Where did you find this information btw? It seems to be more sensible than the partition table in your main post.

                • BentiGorlichOP
                  link
                  fedilink
                  29 months ago

                  The information in my main post is the output of fdisk /dev/sdg1 -l
                  And the information in this post is from fdisk -l

    • BentiGorlichOP
      link
      fedilink
      19 months ago
      Dateisystem    Typ       1K-Blöcke    Benutzt  Verfügbar Verw% Eingehängt auf
      /dev/sdg1      exfat     249806848     207872  249598976    1% /.../disk
      
      
      • Ashkan :Verfied:
        link
        fedilink
        09 months ago

        @BentiGorlich
        Check for Errors: Run a file system check on the exFAT partition to identify and repair any potential filesystem errors.

        $ fsck.exfat -y /dev/sdg1

        Try mounting the SDcard with different mount options. Create a directory where you want to mount the card, and then use the mount command with specific options. For example:

        $ sudo mount -t exfat -o ro,umask=000 /dev/sdg1 /mnt/sdcard

        This mounts the SD card as read-only (ro) with a more permissive umask. Adjust the options as needed

        • BentiGorlichOP
          link
          fedilink
          19 months ago
          sudo fsck.exfat /dev/sdg1
          exfatprogs version : 1.2.1
          /dev/sdg1: clean. directories 5, files 8
          
          

          I tried unmounting and mounting it the way you said, still same problem…

          • danielfgom
            link
            fedilink
            English
            19 months ago

            Have you tried testing with a different make of SD card? Just in case it’s the card…

  • Ashkan :Verfied:
    link
    fedilink
    09 months ago

    @BentiGorlich
    It’s a bit weird, it looks like the output of fdisk -l /dev/sdg indicates that your SD card is formatted with an HPFS/NTFS/exFAT file system, which is not the typical format for camera SD cards. Camera SD cards are usually formatted as FAT32 or exFAT.
    I recommend that you backup everything on that sd card and reformat it to exfat or fat32 yourself on a linux system.

    • BentiGorlichOP
      link
      fedilink
      29 months ago

      I just reformatted it on my linux machine. So I choose exFAT again, because thats what it was before, that’s what I know the camera can handle and I have the exact same problem… I think I just surrender and import my photos on my laptop all the time…

      The partition type after a format is btw still NTFS/exFAT/HPFS. So that is just a compatibility thing for it to work on basically all systems I think…

      • Possibly linux
        link
        fedilink
        English
        29 months ago

        Try wiping the drive and then reinserting it. If it still looks the same you either have a failing card or its been put in read only mode at a hardware level.

        • BentiGorlichOP
          link
          fedilink
          19 months ago

          The card is definitely not broken, if works on windows and in the camera…

      • @taladar
        link
        English
        19 months ago

        The value displayed by fdisk is actually just the textual representation of the numeric partition type you can set when partitioning (7 in this case).

        • BentiGorlichOP
          link
          fedilink
          19 months ago

          No I have not. Maybe I will in the next days. But as I said I kinda surrendered…