Formatting USB stick by Foris failed

Formatting drive failed, try unpluging it and repluging it in again.

Technical details:
btrfs-progs v4.16.1
See http://btrfs.wiki.kernel.org for more information.

Label: srv
UUID: c166a7be-e0f8-4a79-9df5-f04139e4fefd
Node size: 16384
Sector size: 4096
Filesystem size: 29.49GiB
Block group profiles:
Data: single 8.00MiB
Metadata: DUP 1.00GiB
System: DUP 8.00MiB
SSD detected: no
Incompat features: extref, skinny-metadata
Number of devices: 1
Devices:
ID SIZE PATH
1 29.49GiB /dev/sda

WARNING: fsync on device 1 failed: I/O error
ERROR: failed to close ctree, the filesystem may be inconsistent: -5

Turris Omnia, OS 3.10.3

Tried multiple times, also in previous OS version.

It might be helpful to also give us the dmesg from when you plug it in.

Do I understand correctly it should be in /var/log/messages? What to look for there?

I can not physically manipulate with it now, so my only option is to restart it remotely, wait for OpenVPN and SSH deamons working and then see logs.

Actually, what you’ll want to do is plug the USB stick/drive in and then run dmesg and take a look at the latest output. A normal one looks like this:

[    9.480956] usb 4-1.1.3: new low-speed USB device number 5 using xhci-hcd
[    9.626796] usb 4-1.1.3: ep 0x81 - rounding interval to 64 microframes, ep desc says 80 microframes
[   10.401361] scsi 2:0:0:0: Direct-Access     Initio   External 0       2.03 PQ: 0 ANSI: 0
[   10.409986] sd 2:0:0:0: [sdb] 1562845536 512-byte logical blocks: (800 GB/745 GiB)
[   10.418196] sd 2:0:0:0: [sdb] Write Protect is off
[   10.423017] sd 2:0:0:0: [sdb] Mode Sense: 23 00 00 00
[   10.423609] sd 2:0:0:0: [sdb] No Caching mode page found
[   10.428934] sd 2:0:0:0: [sdb] Assuming drive cache: write through
[   10.443497]  sdb: sdb1
[   10.447553] sd 2:0:0:0: [sdb] Attached SCSI disk

Yours might show errors instead.

Unplugged and then plugged:

[20986.923386] usb 4-1: USB disconnect, device number 2
…
[20992.317322] usb 4-1: new high-speed USB device number 3 using xhci-hcd
[20992.458258] usb-storage 4-1:1.0: USB Mass Storage device detected
[20992.458478] scsi host3: usb-storage 4-1:1.0
[20993.457525] scsi 3:0:0:0: Direct-Access     Generic  Flash Disk       1.68 PQ: 0 ANSI: 2
[20993.458079] sd 3:0:0:0: [sda] 61849600 512-byte logical blocks: (31.7 GB/29.5 GiB)
[20993.458250] sd 3:0:0:0: [sda] Write Protect is off
[20993.458258] sd 3:0:0:0: [sda] Mode Sense: 03 00 00 00
[20993.458429] sd 3:0:0:0: [sda] No Caching mode page found
[20993.463796] sd 3:0:0:0: [sda] Assuming drive cache: write through
[20993.473052] sd 3:0:0:0: [sda] Attached SCSI removable disk

Then triggered formatting in Foris, same fail message in Foris and dmesg print this:

[21242.322767] sd 3:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x07 driverbyte=0x00
[21242.322779] sd 3:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 00 00 00 00 00 00 f0 00
[21242.322784] blk_update_request: I/O error, dev sda, sector 0
[21242.328464] Buffer I/O error on dev sda, logical block 0, lost async page write
[21242.335824] Buffer I/O error on dev sda, logical block 1, lost async page write
[21242.343165] Buffer I/O error on dev sda, logical block 2, lost async page write
[21242.350499] Buffer I/O error on dev sda, logical block 3, lost async page write
[21242.357833] Buffer I/O error on dev sda, logical block 4, lost async page write
[21242.365166] Buffer I/O error on dev sda, logical block 5, lost async page write
[21242.372508] Buffer I/O error on dev sda, logical block 6, lost async page write
[21242.379838] Buffer I/O error on dev sda, logical block 7, lost async page write
[21242.387172] Buffer I/O error on dev sda, logical block 8, lost async page write
[21242.394514] Buffer I/O error on dev sda, logical block 9, lost async page write
[21242.742246] sd 3:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x07 driverbyte=0x00
[21242.742257] sd 3:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 00 00 00 f0 00 00 f0 00
[21242.742262] blk_update_request: I/O error, dev sda, sector 240
[21243.093697] sd 3:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x07 driverbyte=0x00
[21243.093707] sd 3:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 00 00 01 e0 00 00 f0 00
[21243.093712] blk_update_request: I/O error, dev sda, sector 480
...
[21243.262710] sd 3:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x07 driverbyte=0x00
[21243.262719] sd 3:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 00 00 02 d0 00 00 f0 00
[21243.262724] blk_update_request: I/O error, dev sda, sector 720
[21243.612673] sd 3:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x07 driverbyte=0x00
[21243.612685] sd 3:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 00 00 03 c0 00 00 f0 00
[21243.612690] blk_update_request: I/O error, dev sda, sector 960
[21243.962601] sd 3:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x07 driverbyte=0x00
[21243.962612] sd 3:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 00 00 04 b0 00 00 f0 00
[21243.962617] blk_update_request: I/O error, dev sda, sector 1200
[21244.132672] sd 3:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x07 driverbyte=0x00
[21244.132682] sd 3:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 00 00 05 a0 00 00 f0 00
[21244.132687] blk_update_request: I/O error, dev sda, sector 1440
[21244.482650] sd 3:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x07 driverbyte=0x00
[21244.482662] sd 3:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 00 00 06 90 00 00 f0 00
[21244.482667] blk_update_request: I/O error, dev sda, sector 1680
...
[21245.002541] sd 3:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x07 driverbyte=0x00
[21245.002551] sd 3:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 00 00 07 80 00 00 f0 00
[21245.002557] blk_update_request: I/O error, dev sda, sector 1920
[21245.172420] sd 3:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x07 driverbyte=0x00
[21245.172429] sd 3:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 00 00 08 70 00 00 f0 00
[21245.172434] blk_update_request: I/O error, dev sda, sector 2160
...
...
[21247.419563] scsi_io_completion: 8 callbacks suppressed
[21247.419579] sd 3:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x07 driverbyte=0x00
[21247.419587] sd 3:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 00 02 00 00 00 00 08 00
[21247.419591] blk_update_request: 8 callbacks suppressed
[21247.419594] blk_update_request: I/O error, dev sda, sector 131072
[21247.425712] buffer_io_error: 502 callbacks suppressed
[21247.425716] Buffer I/O error on dev sda, logical block 16384, lost async page write
[21247.543551] sd 3:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x07 driverbyte=0x00
[21247.543562] sd 3:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 03 af b0 00 00 00 f0 00
[21247.543566] blk_update_request: I/O error, dev sda, sector 61845504
[21247.549859] Buffer I/O error on dev sda, logical block 7730688, lost async page write
[21247.557728] Buffer I/O error on dev sda, logical block 7730689, lost async page write
[21247.565595] Buffer I/O error on dev sda, logical block 7730690, lost async page write
[21247.573449] Buffer I/O error on dev sda, logical block 7730691, lost async page write
[21247.581313] Buffer I/O error on dev sda, logical block 7730692, lost async page write
[21247.589166] Buffer I/O error on dev sda, logical block 7730693, lost async page write
[21247.597023] Buffer I/O error on dev sda, logical block 7730694, lost async page write
[21247.604889] Buffer I/O error on dev sda, logical block 7730695, lost async page write
[21247.612742] Buffer I/O error on dev sda, logical block 7730696, lost async page write
[21247.723511] sd 3:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x07 driverbyte=0x00
[21247.723520] sd 3:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 03 af b0 f0 00 00 f0 00
[21247.723525] blk_update_request: I/O error, dev sda, sector 61845744
[21247.833526] sd 3:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x07 driverbyte=0x00
[21247.833534] sd 3:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 03 af b1 e0 00 00 f0 00
[21247.833539] blk_update_request: I/O error, dev sda, sector 61845984
[21247.943551] sd 3:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x07 driverbyte=0x00
[21247.943559] sd 3:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 03 af b2 d0 00 00 f0 00
[21247.943564] blk_update_request: I/O error, dev sda, sector 61846224
[21248.053446] sd 3:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x07 driverbyte=0x00
[21248.053454] sd 3:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 03 af b3 c0 00 00 f0 00
[21248.053458] blk_update_request: I/O error, dev sda, sector 61846464
[21248.163484] sd 3:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x07 driverbyte=0x00
[21248.163493] sd 3:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 03 af b4 b0 00 00 f0 00
[21248.163498] blk_update_request: I/O error, dev sda, sector 61846704
[21248.273473] sd 3:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x07 driverbyte=0x00
[21248.273483] sd 3:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 03 af b5 a0 00 00 f0 00
[21248.273487] blk_update_request: I/O error, dev sda, sector 61846944
[21248.383490] sd 3:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x07 driverbyte=0x00
[21248.383500] sd 3:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 03 af b6 90 00 00 f0 00
[21248.383505] blk_update_request: I/O error, dev sda, sector 61847184
[21248.493488] sd 3:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x07 driverbyte=0x00
[21248.493498] sd 3:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 03 af b7 80 00 00 f0 00
[21248.493503] blk_update_request: I/O error, dev sda, sector 61847424
...
...
...
...
...
...
...
[21252.592109] scsi_io_completion: 18 callbacks suppressed
[21252.592124] sd 3:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x07 driverbyte=0x00
[21252.592132] sd 3:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 00 21 28 00 00 00 f0 00
[21252.592136] blk_update_request: 18 callbacks suppressed
[21252.592140] blk_update_request: I/O error, dev sda, sector 2172928
[21252.598353] buffer_io_error: 597 callbacks suppressed
[21252.598358] Buffer I/O error on dev sda, logical block 271616, lost async page write
[21252.606125] Buffer I/O error on dev sda, logical block 271617, lost async page write
[21252.613901] Buffer I/O error on dev sda, logical block 271618, lost async page write
[21252.621677] Buffer I/O error on dev sda, logical block 271619, lost async page write
[21252.629443] Buffer I/O error on dev sda, logical block 271620, lost async page write
[21252.637219] Buffer I/O error on dev sda, logical block 271621, lost async page write
[21252.644990] Buffer I/O error on dev sda, logical block 271622, lost async page write
[21252.652758] Buffer I/O error on dev sda, logical block 271623, lost async page write
[21252.660524] Buffer I/O error on dev sda, logical block 271624, lost async page write
[21252.668291] Buffer I/O error on dev sda, logical block 271625, lost async page write
[21252.782577] sd 3:0:0:0: [sda] tag#0 UNKNOWN(0x2003) Result: hostbyte=0x07 driverbyte=0x00
[21252.782587] sd 3:0:0:0: [sda] tag#0 CDB: opcode=0x2a 2a 00 00 21 28 f0 00 00 50 00
[21252.782592] blk_update_request: I/O error, dev sda, sector 2173168

Lots of I/O errors. Are you sure the drive is OK? Reading online

indicates that SMART is trying to access it or there are issues with the disk controller.

If you try to format it by hand do you still get all the I/O errors?

If I format it in Mac to EXFAT it will work there. But when I plug it to Turris and format there it will end the same.

Btw, after failed fomatting by Turris I see it there and in Mac with a btrfs filesystem in a table.

Tried to format /dev/sda or /dev/sda2.

Hello,

from logs, I can see that something is wrong with your USB flash drive.
Would you please tell me, which flash drive do you have and if you can try another one? Most common USB flash drivers don’t have support for S.M.A.R.T, but I think H2testw should tell you more details.

I tried some old 1GB SD card and it successfully initialized.

So maybe something wrong with that flash drive.