You are not logged in.

#1 2025-07-22 14:34:28

GregTheHun
Member
Registered: 2023-03-06
Posts: 9

[SOLVED] Cannot Write to SD Card

So, from the looks of things, no matter what I try to do I cannot write to any SD card I own.

I have the following things installed that I'm aware of:
1. mtools
2. dosfstools
3. exfatprogs
4. partitionmanager (KDE's partition manager)

No matter which SD card I plug into my system (even bought a brand new one), and the same kinds of errors show up:

Create a new partition table (type: gpt) on ‘/dev/sdb’ 
Job: Create new partition table on device ‘/dev/sdb’ 
Command: sfdisk --wipe=always /dev/sdb 
Create new partition table on device ‘/dev/sdb’: Success
Create a new partition table (type: gpt) on ‘/dev/sdb’: Success

Create a new partition (29.81 GiB, exfat) on ‘/dev/sdb’ 
Job: Create new partition on device ‘/dev/sdb’ 
Command: sfdisk --force --append /dev/sdb 

Failed to add partition ‘New Partition’ to device ‘/dev/sdb’. 


Failed to add partition ‘New Partition’ to device ‘/dev/sdb’. 

Create new partition on device ‘/dev/sdb’: Error
Create a new partition (29.81 GiB, exfat) on ‘/dev/sdb’: Error

Am I missing something very obvious?

Last edited by GregTheHun (2025-07-22 18:24:51)

Offline

#2 2025-07-22 15:08:58

cryptearth
Member
Registered: 2024-02-03
Posts: 2,105

Re: [SOLVED] Cannot Write to SD Card

sfdisk / sgdisk are script variants to use fdisk/gdisk in scripts
have you tried manual partioning via regular fdisk/gdisk or cfdisk/cgdisk?
also: to check if you can write at all you could use dd:

sudo dd if=/dev/urandom of=/dev/sdb status=progress

note: for proper filestorage you need a filesystem after creating a partion

Offline

#3 2025-07-22 15:12:17

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,204

Re: [SOLVED] Cannot Write to SD Card

The card reader controls the write status, the notch on the card is a friendly suggestion.
Check your system journal/dmesg for related error messages, but that looks actually as if writing the partition table first succeeded and then subsequent writes failed?

dmesg -w

In a second terminal

lsblk -f # make absolutely sure that /dev/sdb is the relevant device!
sudo dd if=/dev/zero of=/dev/sdb count=1 # you will effectively lose any data on sdb, no problem if it's the card reader and you wanted to partition it in the first place

Check whether dd or dmesg yell any errors at you

Edit: f5ck

Last edited by seth (2025-07-22 15:12:46)

Offline

#4 2025-07-22 16:03:18

GregTheHun
Member
Registered: 2023-03-06
Posts: 9

Re: [SOLVED] Cannot Write to SD Card

cryptearth wrote:

sfdisk / sgdisk are script variants to use fdisk/gdisk in scripts
have you tried manual partioning via regular fdisk/gdisk or cfdisk/cgdisk?
also: to check if you can write at all you could use dd:

sudo dd if=/dev/urandom of=/dev/sdb status=progress

note: for proper filestorage you need a filesystem after creating a partion

So, with cgdisk (`doas cgdisk /dev/sdb`), get:

Could not load partitions from '/dev/sdb'! Aborting!

With dd get:

544915456 bytes (545 MB, 520 MiB) copied, 429 s, 1.3 MB/s
dd: writing to '/dev/sdb': Input/output error
1064289+0 records in
1064288+0 records out
544915456 bytes (545 MB, 520 MiB) copied, 452.51 s, 1.2 MB/s

Offline

#5 2025-07-22 16:14:50

GregTheHun
Member
Registered: 2023-03-06
Posts: 9

Re: [SOLVED] Cannot Write to SD Card

seth wrote:

The card reader controls the write status, the notch on the card is a friendly suggestion.
Check your system journal/dmesg for related error messages, but that looks actually as if writing the partition table first succeeded and then subsequent writes failed?

dmesg -w

In a second terminal

lsblk -f # make absolutely sure that /dev/sdb is the relevant device!
sudo dd if=/dev/zero of=/dev/sdb count=1 # you will effectively lose any data on sdb, no problem if it's the card reader and you wanted to partition it in the first place

Check whether dd or dmesg yell any errors at you

Edit: f5ck



dmesg -w output:

[12514.857210] usb 2-4.2: reset SuperSpeed USB device number 17 using xhci_hcd
[12514.869664] sd 3:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK cmd_age=13s
[12514.869670] sd 3:0:0:0: [sdb] tag#0 CDB: Write(10) 2a 00 00 00 d8 00 00 08 00 00
[12514.869672] I/O error, dev sdb, sector 55296 op 0x1:(WRITE) flags 0x104000 phys_seg 256 prio class 0
[12514.869677] buffer_io_error: 246 callbacks suppressed
[12514.869679] Buffer I/O error on dev sdb, logical block 6912, lost async page write
[12514.869687] Buffer I/O error on dev sdb, logical block 6913, lost async page write
[12514.869691] Buffer I/O error on dev sdb, logical block 6914, lost async page write
[12514.869694] Buffer I/O error on dev sdb, logical block 6915, lost async page write
[12514.869696] Buffer I/O error on dev sdb, logical block 6916, lost async page write
[12514.869699] Buffer I/O error on dev sdb, logical block 6917, lost async page write
[12514.869702] Buffer I/O error on dev sdb, logical block 6918, lost async page write
[12514.869704] Buffer I/O error on dev sdb, logical block 6919, lost async page write
[12514.869707] Buffer I/O error on dev sdb, logical block 6920, lost async page write
[12514.869710] Buffer I/O error on dev sdb, logical block 6921, lost async page write
[12516.220197] usb 2-4.2: reset SuperSpeed USB device number 17 using xhci_hcd
[12517.578194] usb 2-4.2: reset SuperSpeed USB device number 17 using xhci_hcd
[12517.972267] usb 2-4.2: Device not responding to setup address.
[12518.181140] usb 2-4.2: Device not responding to setup address.
[12518.389079] usb 2-4.2: device not accepting address 17, error -71
[12518.689135] usb 2-4.2: Device not responding to setup address.
[12518.901134] usb 2-4.2: Device not responding to setup address.
[12519.110068] usb 2-4.2: device not accepting address 17, error -71
[12519.409132] usb 2-4.2: Device not responding to setup address.
[12519.621131] usb 2-4.2: Device not responding to setup address.
[12519.829066] usb 2-4.2: device not accepting address 17, error -71
[12520.330101] usb 2-4.2: reset SuperSpeed USB device number 17 using xhci_hcd
[12520.721252] usb 2-4.2: Device not responding to setup address.
[12520.933127] usb 2-4.2: Device not responding to setup address.
[12521.141043] usb 2-4.2: device not accepting address 17, error -71
[12521.442118] usb 2-4.2: Device not responding to setup address.
[12521.653118] usb 2-4.2: Device not responding to setup address.
[12521.862035] usb 2-4.2: device not accepting address 17, error -71
[12522.163114] usb 2-4.2: Device not responding to setup address.
[12522.373113] usb 2-4.2: Device not responding to setup address.
[12522.581027] usb 2-4.2: device not accepting address 17, error -71
[12523.083058] usb 2-4.2: reset SuperSpeed USB device number 17 using xhci_hcd
[12523.474103] usb 2-4.2: Device not responding to setup address.
[12523.685103] usb 2-4.2: Device not responding to setup address.
[12523.894006] usb 2-4.2: device not accepting address 17, error -71
[12524.193100] usb 2-4.2: Device not responding to setup address.
[12524.405100] usb 2-4.2: Device not responding to setup address.
[12524.612992] usb 2-4.2: device not accepting address 17, error -71
[12524.914094] usb 2-4.2: Device not responding to setup address.
[12525.125844] usb 2-4.2: Device not responding to setup address.
[12525.333985] usb 2-4.2: device not accepting address 17, error -71
[12525.833026] usb 2-4.2: reset SuperSpeed USB device number 17 using xhci_hcd
[12526.225085] usb 2-4.2: Device not responding to setup address.
[12526.437086] usb 2-4.2: Device not responding to setup address.
[12526.644965] usb 2-4.2: device not accepting address 17, error -71
[12526.945083] usb 2-4.2: Device not responding to setup address.
[12527.158079] usb 2-4.2: Device not responding to setup address.
[12527.364956] usb 2-4.2: device not accepting address 17, error -71
[12527.665076] usb 2-4.2: Device not responding to setup address.
[12527.877075] usb 2-4.2: Device not responding to setup address.
[12528.084946] usb 2-4.2: device not accepting address 17, error -71
[12528.587994] usb 2-4.2: reset SuperSpeed USB device number 17 using xhci_hcd
[12528.599472] sd 3:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK cmd_age=12s
[12528.599477] sd 3:0:0:0: [sdb] tag#0 CDB: Write(10) 2a 00 00 00 e0 00 00 08 00 00
[12528.599479] I/O error, dev sdb, sector 57344 op 0x1:(WRITE) flags 0x104000 phys_seg 256 prio class 0
[12528.599484] buffer_io_error: 246 callbacks suppressed
[12528.599485] Buffer I/O error on dev sdb, logical block 7168, lost async page write
[12528.599494] Buffer I/O error on dev sdb, logical block 7169, lost async page write
[12528.599498] Buffer I/O error on dev sdb, logical block 7170, lost async page write
[12528.599501] Buffer I/O error on dev sdb, logical block 7171, lost async page write
[12528.599503] Buffer I/O error on dev sdb, logical block 7172, lost async page write
[12528.599506] Buffer I/O error on dev sdb, logical block 7173, lost async page write
[12528.599509] Buffer I/O error on dev sdb, logical block 7174, lost async page write
[12528.599512] Buffer I/O error on dev sdb, logical block 7175, lost async page write
[12528.599514] Buffer I/O error on dev sdb, logical block 7176, lost async page write
[12528.599517] Buffer I/O error on dev sdb, logical block 7177, lost async page write
[12528.977066] usb 2-4.2: Device not responding to setup address.
[12529.190065] usb 2-4.2: Device not responding to setup address.
[12529.396934] usb 2-4.2: device not accepting address 17, error -71
[12529.698063] usb 2-4.2: Device not responding to setup address.
[12529.910061] usb 2-4.2: Device not responding to setup address.
[12530.116916] usb 2-4.2: device not accepting address 17, error -71
[12530.418071] usb 2-4.2: Device not responding to setup address.
[12530.629058] usb 2-4.2: Device not responding to setup address.
[12530.836910] usb 2-4.2: device not accepting address 17, error -71
[12531.337949] usb 2-4.2: reset SuperSpeed USB device number 17 using xhci_hcd
[12532.698970] usb 2-4.2: reset SuperSpeed USB device number 17 using xhci_hcd
[12533.008965] usb 2-4.2: reset SuperSpeed USB device number 17 using xhci_hcd
[12533.329040] usb 2-4.2: Device not responding to setup address.
[12533.540923] usb 2-4.2: Device not responding to setup address.
[12533.748886] usb 2-4.2: device not accepting address 17, error -71
[12534.048911] usb 2-4.2: Device not responding to setup address.
[12534.260919] usb 2-4.2: Device not responding to setup address.
[12534.468860] usb 2-4.2: device not accepting address 17, error -71
[12534.768903] usb 2-4.2: Device not responding to setup address.
[12534.980914] usb 2-4.2: Device not responding to setup address.
[12535.188848] usb 2-4.2: device not accepting address 17, error -71
[12535.689883] usb 2-4.2: reset SuperSpeed USB device number 17 using xhci_hcd
[12535.797858] usb 2-4.2: USB disconnect, device number 17
[12536.492831] usb 2-4.2: device not accepting address 17, error -22
[12537.196819] usb 2-4.2: device not accepting address 17, error -22
[12537.900820] usb 2-4.2: device not accepting address 17, error -22
[12538.813797] usb 2-4.2: device not accepting address 17, error -22
[12538.823798] device offline error, dev sdb, sector 59392 op 0x1:(WRITE) flags 0x104000 phys_seg 256 prio class 0
[12538.823805] buffer_io_error: 246 callbacks suppressed
[12538.823806] Buffer I/O error on dev sdb, logical block 7424, lost async page write
[12538.823814] Buffer I/O error on dev sdb, logical block 7425, lost async page write
[12538.823817] Buffer I/O error on dev sdb, logical block 7426, lost async page write
[12538.823820] Buffer I/O error on dev sdb, logical block 7427, lost async page write
[12538.823822] Buffer I/O error on dev sdb, logical block 7428, lost async page write
[12538.823825] Buffer I/O error on dev sdb, logical block 7429, lost async page write
[12538.823828] Buffer I/O error on dev sdb, logical block 7430, lost async page write
[12538.823831] Buffer I/O error on dev sdb, logical block 7431, lost async page write
[12538.823833] Buffer I/O error on dev sdb, logical block 7432, lost async page write
[12538.823836] Buffer I/O error on dev sdb, logical block 7433, lost async page write
[12538.823985] device offline error, dev sdb, sector 1064288 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
[12538.827206] device offline error, dev sdb, sector 61440 op 0x1:(WRITE) flags 0x100000 phys_seg 102 prio class 0
[12538.827290] device offline error, dev sdb, sector 62256 op 0x1:(WRITE) flags 0x800 phys_seg 83 prio class 0
[12538.827352] device offline error, dev sdb, sector 62920 op 0x1:(WRITE) flags 0x100000 phys_seg 52 prio class 0
[12538.827454] device offline error, dev sdb, sector 63336 op 0x1:(WRITE) flags 0x800 phys_seg 69 prio class 0
[12538.827532] device offline error, dev sdb, sector 63888 op 0x1:(WRITE) flags 0x100000 phys_seg 63 prio class 0
[12538.827610] device offline error, dev sdb, sector 64392 op 0x1:(WRITE) flags 0x800 phys_seg 45 prio class 0
[12538.827667] device offline error, dev sdb, sector 64752 op 0x1:(WRITE) flags 0x100000 phys_seg 32 prio class 0
[12538.827694] device offline error, dev sdb, sector 65008 op 0x1:(WRITE) flags 0x800 phys_seg 18 prio class 0
[12539.167043] usb 2-4.4: USB disconnect, device number 11
[12539.310040] usb 2-4: reset SuperSpeed USB device number 3 using xhci_hcd
[12539.980830] usb 2-4.2: new SuperSpeed USB device number 18 using xhci_hcd
[12539.992211] usb 2-4.2: New USB device found, idVendor=2537, idProduct=1081, bcdDevice= 1.00
[12539.992216] usb 2-4.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[12539.992218] usb 2-4.2: Product: NS1081
[12539.992221] usb 2-4.2: Manufacturer: Norelsys
[12539.992222] usb 2-4.2: SerialNumber: 0123456789ABCDE
[12539.992613] usb-storage 2-4.2:1.0: USB Mass Storage device detected
[12539.992751] scsi host3: usb-storage 2-4.2:1.0
[12540.058525] usb 2-4.4: new SuperSpeed USB device number 19 using xhci_hcd
[12540.083883] usb 2-4.4: New USB device found, idVendor=0bda, idProduct=0411, bcdDevice= 0.04
[12540.083888] usb 2-4.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[12540.083890] usb 2-4.4: Product: USB3.2 Hub
[12540.083892] usb 2-4.4: Manufacturer: Generic
[12540.111317] hub 2-4.4:1.0: USB hub found
[12540.112888] hub 2-4.4:1.0: 4 ports detected
[12542.004876] scsi 3:0:0:0: Direct-Access     NORELSYS 1081CS0               PQ: 0 ANSI: 6
[12542.005146] scsi 3:0:0:1: Direct-Access     NORELSYS 1081CS1               PQ: 0 ANSI: 6
[12542.006121] sd 3:0:0:0: [sdb] 60874752 512-byte logical blocks: (31.2 GB/29.0 GiB)
[12542.006318] sd 3:0:0:1: [sdc] Media removed, stopped polling
[12542.006598] sd 3:0:0:0: [sdb] Write Protect is off
[12542.006602] sd 3:0:0:0: [sdb] Mode Sense: 23 00 00 00
[12542.006659] sd 3:0:0:1: [sdc] Attached SCSI removable disk
[12542.006965] sd 3:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[12542.029067]  sdb: sdb1 sdb2
[12542.029202] sd 3:0:0:0: [sdb] Attached SCSI removable disk

lsblk:

NAME   FSTYPE FSVER LABEL  UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
sdb                                                                            
├─sdb1 vfat   FAT32 boot   5DE4-665C                                           
└─sdb2 ext4   1.0   rootfs 7295bbc3-bbc2-4267-9fa0-099e10ef5bf0

dd:

1+0 records in
1+0 records out
512 bytes copied, 12.3395 s, 0.0 kB/s

As well as gives me the same layout on the disk

Offline

#6 2025-07-22 18:01:17

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,204

Re: [SOLVED] Cannot Write to SD Card

12514.857210] usb 2-4.2: reset SuperSpeed USB device number 17 using xhci_hcd
[12514.869664] sd 3:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK cmd_age=13s
[12514.869670] sd 3:0:0:0: [sdb] tag#0 CDB: Write(10) 2a 00 00 00 d8 00 00 08 00 00
[12514.869672] I/O error, dev sdb, sector 55296 op 0x1:(WRITE) flags 0x104000 phys_seg 256 prio class 0

That's bad…
Looks like it's an external reader? Perhaps even on an intermediate hub?
Can you try to
- reconnect it?
- to a different USB slot?
- with a different cable?

Offline

#7 2025-07-22 18:09:41

GregTheHun
Member
Registered: 2023-03-06
Posts: 9

Re: [SOLVED] Cannot Write to SD Card

seth wrote:

12514.857210] usb 2-4.2: reset SuperSpeed USB device number 17 using xhci_hcd
[12514.869664] sd 3:0:0:0: [sdb] tag#0 FAILED Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK cmd_age=13s
[12514.869670] sd 3:0:0:0: [sdb] tag#0 CDB: Write(10) 2a 00 00 00 d8 00 00 08 00 00
[12514.869672] I/O error, dev sdb, sector 55296 op 0x1:(WRITE) flags 0x104000 phys_seg 256 prio class 0

That's bad…
Looks like it's an external reader? Perhaps even on an intermediate hub?
Can you try to
- reconnect it?
- to a different USB slot?
- with a different cable?

So, I did buy a new card reader along with a new SD card, same results as above. Even USB devices have the same results, but now I'm wondering if it's the USB hub I'm using.

Offline

#8 2025-07-22 18:11:57

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,204

Re: [SOLVED] Cannot Write to SD Card

[quote}I'm wondering if it's the USB hub I'm using.[/quote}
Yes. Or one of the cables…

Offline

#9 2025-07-22 18:23:43

GregTheHun
Member
Registered: 2023-03-06
Posts: 9

Re: [SOLVED] Cannot Write to SD Card

OK, I figured it was a stupid cable from UGREEN, I don't know why I bought it as I've had multiple things go wrong with them in the past

Offline

#10 2025-07-22 18:32:39

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,204

Offline

Board footer

Powered by FluxBB